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").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 %>
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 $("#logloadspinner").detach();
54 <%# Live log loading not implemented yet. %>
57 $(".toggle-filter").on("change", function() {
58 logViewer.filter(makeFilter());
61 $("#filter-all").on("click", function() {
62 $(".toggle-filter").each(function(i, f) { f.checked = true; });
63 logViewer.filter(makeFilter());
66 $("#filter-none").on("click", function() {
67 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
68 $("#show-all-tasks").prop("checked", true);
69 logViewer.filter(makeFilter());
72 $("#sort-by-time").on("change", function() {
73 logViewer.sort("id", {sortFunction: sortById});
76 $("#sort-by-task").on("change", function() {
77 logViewer.sort("taskid", {sortFunction: sortByTask});
80 $("#sort-by-node").on("change", function() {
81 logViewer.sort("node", {sortFunction: sortByNode});
84 $("#set-show-failed-only").on("click", function() {
85 $("#sort-by-task").prop("checked", true);
86 $("#show-failed-tasks").prop("checked", true);
87 $("#show-crunch").prop("checked", false);
88 $("#show-task-dispatch").prop("checked", true);
89 $("#show-task-output").prop("checked", true);
90 $("#show-crunchstat").prop("checked", false);
91 logViewer.filter(makeFilter());
92 logViewer.sort("taskid", {sortFunction: sortByTask});
102 <div id="log-viewer-overview"></div>
104 <% if @object.tasks_summary[:failed] > 0 %>
105 <button id="set-show-failed-only" class="btn btn-danger" style="margin-top: 1em">
106 Show failed task output only
112 <span class="pull-right">
113 <button id="filter-all" class="btn">
116 <button id="filter-none" class="btn">
122 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
125 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
126 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
128 <div class="radio-inline log-viewer-button">
129 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
132 <div class="radio-inline log-viewer-button">
133 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
138 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
139 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="toggle-filter"> Show all tasks</label>
141 <div class="radio-inline log-viewer-button">
142 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only successful tasks</label>
144 <div class="radio-inline log-viewer-button">
145 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only failed tasks</label>
150 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
151 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch output</label>
153 <div class="checkbox-inline log-viewer-button">
154 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
156 <div class="checkbox-inline log-viewer-button">
157 <label><input id="show-task-output" type="checkbox" checked="true" class="toggle-filter"> Show task output</label>
159 <div class="checkbox-inline log-viewer-button">
160 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
165 <div class="log-viewer-paging-div">
166 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
167 <span class="log-viewer-paging"></span>
168 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>
171 <table class="log-viewer-table">
174 <th class="id" data-sort="id"></th>
175 <th class="timestamp" data-sort="timestamp">Timestamp</th>
176 <th class="node" data-sort="node">Node</th>
177 <th class="slot" data-sort="slot">Slot</th>
178 <th class="type" data-sort="type">Log type</th>
179 <th class="taskid" data-sort="taskid">Task</th>
180 <th class="message" data-sort="message">Message</th>
186 <td class="timestamp"></td>
187 <td class="node"></td>
188 <td class="slot"></td>
189 <td class="type"></td>
190 <td class="taskid"></td>
191 <td class="message"></td>
197 <div style="font-size: 18px">
198 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
199 <span class="log-viewer-paging"></span>
200 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>
206 <% if !@object.log %>
207 This job is still running. The job log will be available when the job is complete.
210 <%= image_tag 'ajax-loader.gif', id: "logloadspinner" %>