4084: Skip the "inactive pane" optimization when the div is not a tab pane.
authorTom Clegg <tom@curoverse.com>
Wed, 5 Nov 2014 03:54:12 +0000 (22:54 -0500)
committerTom Clegg <tom@curoverse.com>
Wed, 5 Nov 2014 03:54:12 +0000 (22:54 -0500)
Content divs that are _not_ tabbed panes no longer need to remember to
add an "active" flag.

apps/workbench/app/assets/javascripts/tab_panes.js
apps/workbench/app/views/jobs/_show_status.html.erb
apps/workbench/app/views/jobs/show.html.erb
apps/workbench/app/views/pipeline_instances/_show_log.html.erb

index 3f1645b36d9544caeb84cd74dd104429b14266dd..6c58a57249d25202ec725a166b6a65298b023e20 100644 (file)
@@ -84,9 +84,15 @@ $(document).on('arv:pane:reload', '[data-pane-content-url]', function(e) {
     $pane.removeClass('pane-loaded');
     $pane.removeClass('pane-stale');
 
-    if (!$pane.hasClass('active')) {
-        // When the user selects e.target tab, show a spinner instead of
-        // old content while loading.
+    if (!$pane.hasClass('active') &&
+        $pane.parent().hasClass('tab-content')) {
+        // $pane is one of the content areas in a bootstrap tabs
+        // widget, and it isn't the currently selected tab. If and
+        // when the user does select the corresponding tab, it will
+        // get a shown.bs.tab event, which will invoke this reload
+        // function again (see handler above). For now, we just insert
+        // a spinner, which will be displayed while the new content is
+        // loading.
         $pane.html('<div class="spinner spinner-32px spinner-h-center"></div>');
         return;
     }
index 5bb37c3e6cc9c22afc79eb1323cb7885f0cd716e..cfff0daad329c3a93bef64c45206edb11f647cbe 100644 (file)
@@ -7,7 +7,7 @@
      data-object-uuid="<%= @object.uuid %>"
      data-load-throttle="5000"
      >
-  <div id="job-status-pane" class="active">
+  <div id="job-status-pane">
     <%=
        pj = {}
        pj[:job] = @object
index d83bc722a27eb01732db8042fc1e41cc26c1ae62..566014e4f328e256e81a8ba33d31794b41a6a29f 100644 (file)
@@ -1,5 +1,5 @@
 <% content_for :tab_line_buttons do %>
-  <div class="active pane-loaded arv-log-event-listener arv-refresh-on-state-change"
+  <div class="pane-loaded arv-log-event-listener arv-refresh-on-state-change"
        data-pane-content-url="<%= url_for(params.merge(tab_pane: "job_buttons")) %>"
        data-object-uuid="<%= @object.uuid %>"
        style="display: inline">
index 2a71aefc498aaa9897695990b97b977a9c43eeb9..060a66951c530fb447d98504142e80ca99299597 100644 (file)
@@ -1,7 +1,7 @@
 <% log_uuids = [@object.uuid] + pipeline_jobs(@object).collect{|x|x[:job].andand[:uuid]}.compact %>
 <% log_history = stderr_log_history(log_uuids) %>
 <div id="pipeline_event_log_div"
-     class="active arv-log-event-listener arv-log-event-handler-append-logs arv-log-event-subscribe-to-pipeline-job-uuids arv-job-log-window"
+     class="arv-log-event-listener arv-log-event-handler-append-logs arv-log-event-subscribe-to-pipeline-job-uuids arv-job-log-window"
      data-object-uuids="<%= log_uuids.join(' ') %>"
      ><%= log_history.join("\n") %></div>
 <div class="arv-log-refresh-control"