3193: minor ui updates
[arvados.git] / apps / workbench / app / views / jobs / _show_log.html.erb
index 85082873b3706d3bceb4cdb61cddce902da51648..f1466aab7d8ae8814966fd51323c6ebfab809548 100644 (file)
@@ -15,7 +15,7 @@ var taskState = newTaskState();
 
 var makeFilter = function() {
   var pass = [];
-  $(".toggle-filter").each(function(i, e) {
+  $(".toggle-filter, .radio-filter").each(function(i, e) {
     if (e.checked) {
       pass.push(e.id.substr(5));
     }
@@ -40,21 +40,25 @@ var makeFilter = function() {
 }
 
 <% if @object.log %>
-<% logcollection = Collection.find @object.log %>
-
-$.ajax('<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>').
-  done(function(data, status, jqxhr) {
-    logViewer.filter();
-    addToLogViewer(logViewer, data.split("\n"), taskState);
-    logViewer.filter(makeFilter());
-    generateJobOverview("#log-viewer-overview", logViewer, taskState);
-    $("#logloadspinner").detach();
-  });
+  <% logcollection = Collection.find @object.log %>
+  <% if logcollection %>
+    $.ajax('<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>').
+       done(function(data, status, jqxhr) {
+           logViewer.filter();
+           addToLogViewer(logViewer, data.split("\n"), taskState);
+           logViewer.filter(makeFilter());
+           generateJobOverview("#log-viewer-overview", logViewer, taskState);
+           $("#log-viewer .spinner").detach();
+       }).
+       fail(function(jqxhr, status, error) {
+           $("#log-viewer .spinner").detach();
+       });
+  <% end %>
 <% else %>
   <%# Live log loading not implemented yet. %>
 <% end %>
 
-$(".toggle-filter").on("change", function() {
+$(".toggle-filter, .radio-filter").on("change", function() {
   logViewer.filter(makeFilter());
 });
 
@@ -65,7 +69,6 @@ $("#filter-all").on("click", function() {
 
 $("#filter-none").on("click", function() {
   $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
-  $("#show-all-tasks").prop("checked", true);
   logViewer.filter(makeFilter());
 });
 
@@ -86,7 +89,7 @@ $("#set-show-failed-only").on("click", function() {
   $("#show-failed-tasks").prop("checked", true);
   $("#show-crunch").prop("checked", false);
   $("#show-task-dispatch").prop("checked", true);
-  $("#show-task-output").prop("checked", true);
+  $("#show-script-print").prop("checked", true);
   $("#show-crunchstat").prop("checked", false);
   logViewer.filter(makeFilter());
   logViewer.sort("taskid", {sortFunction: sortByTask});
@@ -99,14 +102,26 @@ $("#set-show-failed-only").on("click", function() {
 <div id="log-viewer">
 
   <h3>Summary</h3>
-  <div id="log-viewer-overview"></div>
+  <p id="log-viewer-overview">
+    <% if !@object.log %>
+      <% if @object.finished_at %>
+        This job did not produce an diagnostic log.
+      <% else %>
+        This job is still running.  The job log will be available when the job is complete.
+      <% end %>
+    <% else %>
+      <% if !logcollection %>
+        The collection containing the job log was not found.
+      <% end %>
+    <% end %>
+  </p>
 
   <div class="h3">Log
 
     <span class="pull-right">
-      <% if @object.tasks_summary[:failed] > 0 %>
+      <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
         <button id="set-show-failed-only" class="btn btn-danger">
-          Show failed task output only
+          Show failed task diagnostics only
         </button>
       <% end %>
 
@@ -136,25 +151,25 @@ $("#set-show-failed-only").on("click", function() {
 
   <div>
     <div class="radio-inline log-viewer-button" style="margin-left: 10px">
-      <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="toggle-filter"> Show all tasks</label>
+      <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
     </div>
     <div class="radio-inline log-viewer-button">
-      <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only successful tasks</label>
+      <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
     </div>
     <div class="radio-inline log-viewer-button">
-      <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only failed tasks</label>
+      <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
     </div>
   </div>
 
   <div>
     <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
-      <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch output</label>
+      <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
     </div>
     <div class="checkbox-inline log-viewer-button">
       <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
     </div>
     <div class="checkbox-inline log-viewer-button">
-      <label><input id="show-task-output" type="checkbox" checked="true" class="toggle-filter"> Show task output</label>
+      <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
     </div>
     <div class="checkbox-inline log-viewer-button">
       <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
@@ -163,41 +178,40 @@ $("#set-show-failed-only").on("click", function() {
   </div>
 
   <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
-  <table class="log-viewer-table">
-    <thead>
-      <tr>
-        <th class="id" data-sort="id"></th>
-        <th class="timestamp" data-sort="timestamp">Timestamp</th>
-        <th class="node"  data-sort="node">Node</th>
-        <th class="slot"  data-sort="slot">Slot</th>
-        <th class="type" data-sort="type">Log type</th>
-        <th class="taskid"  data-sort="taskid">Task</th>
-        <th class="message" data-sort="message">Message</th>
-      </tr>
-    </thead>
-    <tbody class="list">
-      <tr>
-        <td class="id"></td>
-        <td class="timestamp"></td>
-        <td class="node"></td>
-        <td class="slot"></td>
-        <td class="type"></td>
-        <td class="taskid"></td>
-        <td class="message"></td>
-      </tr>
-    </tbody>
-  </table>
-</div>
+    <table class="log-viewer-table">
+      <thead>
+        <tr>
+          <th class="id" data-sort="id"></th>
+          <th class="timestamp" data-sort="timestamp">Timestamp</th>
+          <th class="node"  data-sort="node">Node</th>
+          <th class="slot"  data-sort="slot">Slot</th>
+          <th class="type" data-sort="type">Log type</th>
+          <th class="taskid"  data-sort="taskid">Task</th>
+          <th class="message" data-sort="message">Message</th>
+        </tr>
+      </thead>
+      <tbody class="list">
+        <tr>
+          <td class="id"></td>
+          <td class="timestamp"></td>
+          <td class="node"></td>
+          <td class="slot"></td>
+          <td class="type"></td>
+          <td class="taskid"></td>
+          <td class="message"></td>
+        </tr>
+      </tbody>
+    </table>
+
+    <% if @object.log and logcollection %>
+      <div class="spinner spinner-32px"></div>
+    <% end %>
+
+  </div>
+
   <div class="log-viewer-paging-div" style="margin-bottom: -15px">
     <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
     <span class="log-viewer-paging"></span>
     <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>
   </div>
-
 </div>
-
-<% if !@object.log %>
-  This job is still running.  The job log will be available when the job is complete.
-<% end %>
-
-<%= image_tag 'ajax-loader.gif', id: "logloadspinner" %>