summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2020-09-29 21:41:54 +0100
committerBen Hutchings <ben.hutchings@codethink.co.uk>2020-10-06 01:50:09 +0100
commit19e8f1bdf0205cc26ef7679a20c3f38b7a7cb9a7 (patch)
tree21646ef8dc6a8f82b37e07a447a8dd8243559669 /templates
parent2beec955ccf893fada8381aa821189aeddd6ca9b (diff)
downloadlorry-controller-19e8f1bdf0205cc26ef7679a20c3f38b7a7cb9a7.tar.gz
Add a page listing failing lorries
Provide a status page that lists only the lorries that failed to update on the last attempt. This will make it easier to spot problems that require an update to the lorry configuration. Reuse some of the existing status page logic and render the run queue with a different template. Add a link to this page from the status page. Closes #20.
Diffstat (limited to 'templates')
-rw-r--r--templates/failures.tpl45
-rw-r--r--templates/status.tpl2
2 files changed, 47 insertions, 0 deletions
diff --git a/templates/failures.tpl b/templates/failures.tpl
new file mode 100644
index 0000000..5c7b6ce
--- /dev/null
+++ b/templates/failures.tpl
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>Failing lorries</title>
+ <link rel="stylesheet" href="/lc-static/style.css" type="text/css" />
+ </head>
+ <body>
+ <h1>Failing lorries</h1>
+
+ <p>See the <a href="/1.0/status-html">full status</a>.</p>
+
+ <table>
+ <tr>
+ <th>Path</th>
+ <th>Due</th>
+ <th>Last run exit</th>
+ <th>Job?</th>
+ </tr>
+% failures = [spec for spec in run_queue
+% if spec['last_run_exit'] not in [None, '0']]
+% for spec in sorted(failures, key=(lambda spec: spec['path'])):
+ <tr>
+ <td><a href="/1.0/lorry-html/{{spec['path']}}">{{spec['path']}}</a></td>
+ <td nowrap>{{spec['due_nice']}}</td>
+ <td>
+ <details>
+ <summary>{{spec['last_run_exit']}}: Show log</summary>
+ <p><pre>{{spec['last_run_error']}}</pre></p>
+ </details>
+ </td>
+% if spec['running_job']:
+ <td><a href="/1.0/job-html/{{spec['running_job']}}">{{spec['running_job']}}</a></td>
+% else:
+ <td></td>
+% end
+ </tr>
+% end
+ </table>
+
+ <hr>
+
+ <p>Updated: {{timestamp}}</p>
+
+ </body>
+</html>
diff --git a/templates/status.tpl b/templates/status.tpl
index ff572de..61c3aa9 100644
--- a/templates/status.tpl
+++ b/templates/status.tpl
@@ -100,6 +100,8 @@
% if links:
<p>See separate list of <a href="/1.0/list-jobs-html">all jobs that
have ever been started</a>.</p>
+
+<p>See the list of <a href="/1.0/failures-html">failing lorries</a>.</p>
% end
<h2>Run-queue</h2>