3 var logViewer = new List('log-viewer', {
4 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
8 var taskState = {"success_count": 0, "failure_count": 0, "nodes": []};
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});
84 <div id="log-viewer-overview"></div>
88 <span class="pull-right">
89 <button id="filter-all" class="btn">
92 <button id="filter-none" class="btn">
99 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
100 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
102 <div class="radio-inline log-viewer-button">
103 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
106 <div class="radio-inline log-viewer-button">
107 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
112 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
113 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="toggle-filter"> Show all tasks</label>
115 <div class="radio-inline log-viewer-button">
116 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only successful tasks</label>
118 <div class="radio-inline log-viewer-button">
119 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only failed tasks</label>
124 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
125 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch output</label>
127 <div class="checkbox-inline log-viewer-button">
128 <label><input id="show-job-status" type="checkbox" checked="true" class="toggle-filter"> Show job status</label>
130 <div class="checkbox-inline log-viewer-button">
131 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
133 <div class="checkbox-inline log-viewer-button">
134 <label><input id="show-task-output" type="checkbox" checked="true" class="toggle-filter"> Show task output</label>
136 <div class="checkbox-inline log-viewer-button">
137 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
142 <table class="log-viewer-table">
145 <th class="id" data-sort="id"></th>
146 <th class="timestamp" data-sort="timestamp">Timestamp</th>
147 <th class="node" data-sort="node">Node</th>
148 <th class="slot" data-sort="slot">Slot</th>
149 <th class="type" data-sort="type">Log type</th>
150 <th class="taskid" data-sort="taskid">Task</th>
151 <th class="message" data-sort="message">Message</th>
157 <td class="timestamp"></td>
158 <td class="node"></td>
159 <td class="slot"></td>
160 <td class="type"></td>
161 <td class="taskid"></td>
162 <td class="message"></td>
169 <% if !@object.log %>
170 This job is still running. The job log will be available when the job is complete.
173 <%= image_tag 'ajax-loader.gif', id: "logloadspinner" %>