3 var logViewer = new List('log-viewer', {
4 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
8 var taskState = newTaskState();
10 var makeFilter = function() {
12 $(".toggle-filter").each(function(i, e) {
14 pass.push(e.id.substr(5));
18 return (function(item) {
20 if (item.values().taskid !== "") {
22 if (pass[a] == "all-tasks") { v = true; }
23 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
24 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
30 if (pass[a] == item.values().type) { return v; }
37 <% logcollection = Collection.find @object.log %>
39 $.ajax('<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>').
40 done(function(data, status, jqxhr) {
42 addToLogViewer(logViewer, data.split("\n"), taskState);
43 logViewer.filter(makeFilter());
44 generateJobOverview("#log-viewer-overview", logViewer, taskState);
45 $("#logloadspinner").detach();
48 <%# Live log loading not implemented yet. %>
51 $(".toggle-filter").on("change", function() {
52 logViewer.filter(makeFilter());
55 $("#filter-all").on("click", function() {
56 $(".toggle-filter").each(function(i, f) { f.checked = true; });
57 logViewer.filter(makeFilter());
60 $("#filter-none").on("click", function() {
61 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
62 logViewer.filter(makeFilter());
65 $("#sort-by-time").on("change", function() {
66 logViewer.sort("id", {sortFunction: sortById});
69 $("#sort-by-task").on("change", function() {
70 logViewer.sort("taskid", {sortFunction: sortByTask});
73 $("#sort-by-node").on("change", function() {
74 logViewer.sort("node", {sortFunction: sortByNode});
77 $("#set-show-failed-only").on("click", function() {
78 $("#sort-by-task").prop("checked", true);
79 $("#show-failed-tasks").prop("checked", true);
80 $("#show-crunch").prop("checked", false);
81 $("#show-task-dispatch").prop("checked", true);
82 $("#show-task-output").prop("checked", true);
83 $("#show-crunchstat").prop("checked", false);
84 logViewer.filter(makeFilter());
85 logViewer.sort("taskid", {sortFunction: sortByTask});
95 <div id="log-viewer-overview"></div>
97 <% if @object.tasks_summary[:failed] > 0 %>
98 <button id="set-show-failed-only" class="btn btn-danger" style="margin-top: 1em">
99 Show failed task output only
105 <span class="pull-right">
106 <button id="filter-all" class="btn">
109 <button id="filter-none" class="btn">
116 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
117 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
119 <div class="radio-inline log-viewer-button">
120 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
123 <div class="radio-inline log-viewer-button">
124 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
129 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
130 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="toggle-filter"> Show all tasks</label>
132 <div class="radio-inline log-viewer-button">
133 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only successful tasks</label>
135 <div class="radio-inline log-viewer-button">
136 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only failed tasks</label>
141 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
142 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch output</label>
144 <div class="checkbox-inline log-viewer-button">
145 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
147 <div class="checkbox-inline log-viewer-button">
148 <label><input id="show-task-output" type="checkbox" checked="true" class="toggle-filter"> Show task output</label>
150 <div class="checkbox-inline log-viewer-button">
151 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
156 <table class="log-viewer-table">
159 <th class="id" data-sort="id"></th>
160 <th class="timestamp" data-sort="timestamp">Timestamp</th>
161 <th class="node" data-sort="node">Node</th>
162 <th class="slot" data-sort="slot">Slot</th>
163 <th class="type" data-sort="type">Log type</th>
164 <th class="taskid" data-sort="taskid">Task</th>
165 <th class="message" data-sort="message">Message</th>
171 <td class="timestamp"></td>
172 <td class="node"></td>
173 <td class="slot"></td>
174 <td class="type"></td>
175 <td class="taskid"></td>
176 <td class="message"></td>
183 <% if !@object.log %>
184 This job is still running. The job log will be available when the job is complete.
187 <%= image_tag 'ajax-loader.gif', id: "logloadspinner" %>