<%= javascript_tag do %> $(document).ready(function() { refreshLogs('<%= nodes_info_refresh_path(:kb_host => @kb_host, :last_event_id => @last_event_id, :format => :js) %>'); $('.plugin-link').one('ajax:beforeSend', function() { // Prevent other clicks $('.plugin-link').removeAttr('data-remote') .removeAttr('data-method') .removeAttr('href') // Spin $(this).children().addClass('fa-spin'); }); $('.plugin-link').one('ajax:complete', function() { // Delay a bit, to give time for the plugin state to change before the next refresh setTimeout(fakeOperationComplete, 6000); }); <%- if @installing %> // Prevent other clicks $('.plugin-link').removeAttr('data-remote') .removeAttr('data-method') .removeAttr('href') $('#nodes-table-wrapper').css({ opacity: 0.5 }); $('#install-in-progress').show(); $('#install-in-progress').children().addClass('fa-spin'); setTimeout(fakeOperationComplete, 6000); <% end %> function fakeOperationComplete() { $('#install-in-progress').hide(); $('.plugin-link').children().removeClass('fa-spin'); $('#nodes-table-wrapper').fadeTo("slow", 0.5); $('#reload-page').fadeIn("slow"); } }); <% end %>