4 var logViewer = new List('log-viewer', {
5 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
9 logViewer.page_offset = 0;
10 logViewer.on("updated", function() { updatePaging(".log-viewer-paging", logViewer, pagesize) } );
11 $(".log-viewer-page-up").on("click", function() { prevPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
12 $(".log-viewer-page-down").on("click", function() { nextPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
14 var taskState = newTaskState();
16 var makeFilter = function() {
18 $(".toggle-filter, .radio-filter").each(function(i, e) {
20 pass.push(e.id.substr(5));
24 return (function(item) {
26 if (item.values().taskid !== "") {
28 if (pass[a] == "all-tasks") { v = true; }
29 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
30 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
36 if (pass[a] == item.values().type) { return v; }
43 <% logcollection = Collection.find @object.log %>
44 <% if logcollection %>
45 $.ajax('<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>').
46 done(function(data, status, jqxhr) {
48 addToLogViewer(logViewer, data.split("\n"), taskState);
49 logViewer.filter(makeFilter());
50 generateJobOverview("#log-viewer-overview", logViewer, taskState);
51 $("#log-viewer .spinner").detach();
53 fail(function(jqxhr, status, error) {
54 $("#log-viewer .spinner").detach();
58 <%# Live log loading not implemented yet. %>
61 $(".toggle-filter, .radio-filter").on("change", function() {
62 logViewer.filter(makeFilter());
65 $("#filter-all").on("click", function() {
66 $(".toggle-filter").each(function(i, f) { f.checked = true; });
67 logViewer.filter(makeFilter());
70 $("#filter-none").on("click", function() {
71 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
72 logViewer.filter(makeFilter());
75 $("#sort-by-time").on("change", function() {
76 logViewer.sort("id", {sortFunction: sortById});
79 $("#sort-by-task").on("change", function() {
80 logViewer.sort("taskid", {sortFunction: sortByTask});
83 $("#sort-by-node").on("change", function() {
84 logViewer.sort("node", {sortFunction: sortByNode});
87 $("#set-show-failed-only").on("click", function() {
88 $("#sort-by-task").prop("checked", true);
89 $("#show-failed-tasks").prop("checked", true);
90 $("#show-crunch").prop("checked", false);
91 $("#show-task-dispatch").prop("checked", true);
92 $("#show-script-print").prop("checked", true);
93 $("#show-crunchstat").prop("checked", false);
94 logViewer.filter(makeFilter());
95 logViewer.sort("taskid", {sortFunction: sortByTask});
102 <div id="log-viewer">
105 <p id="log-viewer-overview">
106 <% if !@object.log %>
107 <% if @object.finished_at %>
108 This job did not produce an diagnostic log.
110 This job is still running. The job log will be available when the job is complete.
113 <% if !logcollection %>
114 The collection containing the job log was not found.
121 <span class="pull-right">
122 <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
123 <button id="set-show-failed-only" class="btn btn-danger">
124 Show failed task diagnostics only
128 <button id="filter-all" class="btn">
131 <button id="filter-none" class="btn">
137 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
140 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
141 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
143 <div class="radio-inline log-viewer-button">
144 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
147 <div class="radio-inline log-viewer-button">
148 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
153 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
154 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
156 <div class="radio-inline log-viewer-button">
157 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
159 <div class="radio-inline log-viewer-button">
160 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
165 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
166 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
168 <div class="checkbox-inline log-viewer-button">
169 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
171 <div class="checkbox-inline log-viewer-button">
172 <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
174 <div class="checkbox-inline log-viewer-button">
175 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
180 <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
181 <table class="log-viewer-table">
184 <th class="id" data-sort="id"></th>
185 <th class="timestamp" data-sort="timestamp">Timestamp</th>
186 <th class="node" data-sort="node">Node</th>
187 <th class="slot" data-sort="slot">Slot</th>
188 <th class="type" data-sort="type">Log type</th>
189 <th class="taskid" data-sort="taskid">Task</th>
190 <th class="message" data-sort="message">Message</th>
196 <td class="timestamp"></td>
197 <td class="node"></td>
198 <td class="slot"></td>
199 <td class="type"></td>
200 <td class="taskid"></td>
201 <td class="message"></td>
206 <% if @object.log and logcollection %>
207 <div class="spinner spinner-32px"></div>
212 <div class="log-viewer-paging-div" style="margin-bottom: -15px">
213 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
214 <span class="log-viewer-paging"></span>
215 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>