3 <% log_history = stderr_log_history([@object.uuid]) %>
4 <div class="arv-log-event-listener arv-log-event-handler-append-logs arv-job-log-window" id="pipeline_event_log_div" data-object-uuids="<%= @object.uuid %>">
5 <% log_history.each do |entry| %>
15 var logViewer = new List('log-viewer', {
16 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
20 logViewer.page_offset = 0;
21 logViewer.on("updated", function() { updatePaging(".log-viewer-paging", logViewer, pagesize) } );
22 $(".log-viewer-page-up").on("click", function() { prevPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
23 $(".log-viewer-page-down").on("click", function() { nextPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
25 var taskState = newTaskState();
27 var makeFilter = function() {
29 $(".toggle-filter, .radio-filter").each(function(i, e) {
31 pass.push(e.id.substr(5));
35 return (function(item) {
37 if (item.values().taskid !== "") {
39 if (pass[a] == "all-tasks") { v = true; }
40 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
41 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
47 if (pass[a] == item.values().type) { return v; }
54 <% logcollection = Collection.find @object.log %>
55 <% if logcollection %>
56 $.ajax('<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>').
57 done(function(data, status, jqxhr) {
59 addToLogViewer(logViewer, data.split("\n"), taskState);
60 logViewer.filter(makeFilter());
61 generateJobOverview("#log-viewer-overview", logViewer, taskState);
62 $("#log-viewer .spinner").detach();
64 fail(function(jqxhr, status, error) {
65 $("#log-viewer .spinner").detach();
69 <%# Live log loading not implemented yet. %>
72 $(".toggle-filter, .radio-filter").on("change", function() {
73 logViewer.filter(makeFilter());
76 $("#filter-all").on("click", function() {
77 $(".toggle-filter").each(function(i, f) { f.checked = true; });
78 logViewer.filter(makeFilter());
81 $("#filter-none").on("click", function() {
82 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
83 logViewer.filter(makeFilter());
86 $("#sort-by-time").on("change", function() {
87 logViewer.sort("id", {sortFunction: sortById});
90 $("#sort-by-task").on("change", function() {
91 logViewer.sort("taskid", {sortFunction: sortByTask});
94 $("#sort-by-node").on("change", function() {
95 logViewer.sort("node", {sortFunction: sortByNode});
98 $("#set-show-failed-only").on("click", function() {
99 $("#sort-by-task").prop("checked", true);
100 $("#show-failed-tasks").prop("checked", true);
101 $("#show-crunch").prop("checked", false);
102 $("#show-task-dispatch").prop("checked", true);
103 $("#show-script-print").prop("checked", true);
104 $("#show-crunchstat").prop("checked", false);
105 logViewer.filter(makeFilter());
106 logViewer.sort("taskid", {sortFunction: sortByTask});
113 <div id="log-viewer">
116 <p id="log-viewer-overview">
117 <% if !logcollection %>
118 The collection containing the job log was not found.
124 <span class="pull-right">
125 <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
126 <button id="set-show-failed-only" class="btn btn-danger">
127 Show failed task diagnostics only
131 <button id="filter-all" class="btn">
134 <button id="filter-none" class="btn">
140 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
143 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
144 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
146 <div class="radio-inline log-viewer-button">
147 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
150 <div class="radio-inline log-viewer-button">
151 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
156 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
157 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
159 <div class="radio-inline log-viewer-button">
160 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
162 <div class="radio-inline log-viewer-button">
163 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
168 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
169 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
171 <div class="checkbox-inline log-viewer-button">
172 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
174 <div class="checkbox-inline log-viewer-button">
175 <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
177 <div class="checkbox-inline log-viewer-button">
178 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
183 <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
184 <table class="log-viewer-table">
187 <th class="id" data-sort="id"></th>
188 <th class="timestamp" data-sort="timestamp">Timestamp</th>
189 <th class="node" data-sort="node">Node</th>
190 <th class="slot" data-sort="slot">Slot</th>
191 <th class="type" data-sort="type">Log type</th>
192 <th class="taskid" data-sort="taskid">Task</th>
193 <th class="message" data-sort="message">Message</th>
199 <td class="timestamp"></td>
200 <td class="node"></td>
201 <td class="slot"></td>
202 <td class="type"></td>
203 <td class="taskid"></td>
204 <td class="message"></td>
209 <% if @object.log and logcollection %>
210 <div class="spinner spinner-32px"></div>
215 <div class="log-viewer-paging-div" style="margin-bottom: -15px">
216 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
217 <span class="log-viewer-paging"></span>
218 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>