Debian Codegraph @

src/webdash/templates/default/jobs/logviewer.html

raw symbols SCIP
1 {% extends 'layouts/base.html' %}
2
3 {% set active_menu = 'jobqueue' %}
4 {% set page_title = 'View Log: ' + log_title %}
5
6 {% block body_header %}
7 <h1 class="title mb-4">Log data {{log_title}}</h1>
8 {% endblock %}
9
10 {% block js_pre %}
11 <script src="{{ url_for('static', filename='js/term2html.js') }}"></script>
12 {% endblock %}
13
14 {% block body %}
15 <div class="columns is-multiline is-gapless">
16 <div class="column is-full mx-0">
17 <b>ID:</b> {{job.uuid}}<br/>
18 <br/>
19 <b>Created:</b> {{humanized_timediff(job.time_created)}}<br/>
20 <b>Assigned:</b> {{humanized_timediff(job.time_assigned)}}<br/>
21 {% if job.time_finished %}<b>Finished:</b> {{humanized_timediff(job.time_finished)}}<br/>{% endif %}
22 {% if worker %}
23 <b>Worker:</b> <a href="{{ url_for('jobs.workers') }}">{{worker.name}}</a><br/>
24 {% endif %}
25
26 {% if log_url %}
27 <div class="column is-full mb-2 mx-0 pl-0">
28 <a class="is-pulled-left button is-info" href="{{ url_for('jobs.job', uuid=job.uuid)}}"><i class="fa-solid fa-chevron-left"></i>&nbsp;Job Details</a>
29
30 <div class="is-pulled-right">
31 <a class="button is-primary" href="{{log_url}}"><i class="fa-solid fa-download"></i>&nbsp;Download</a>
32 {% if firehose_url %}
33 <a class="button is-info is-light" href="{{firehose_url}}"><i class="fa-solid fa-code-commit"></i>&nbsp;Firehose XML</a>
34 {% endif %}
35 </div>
36 </div>
37
38 <div class="column is-full mx-0 pl-0 mt-5">
39 <div class="box">
40 <pre style="padding: 0; background-color: initial;" id="logDisplay"><i class="fa-solid fa-asterisk fa-spin"></i>&nbsp;Loading...</pre>
41 </div>
42 </div>
43
44 <script>
45 const escapeHtml = (text) => {
46 return text.replaceAll('&', '&amp;')
47 .replaceAll('<', '&lt;')
48 .replaceAll('>', '&gt;')
49 .replaceAll('"', '&quot;')
50 .replaceAll("'", '&#039;');
51 };
52
53 fetch('{{ log_url }}', {method: 'GET', mode: 'cors'})
54 .then(response => {
55 if (!response.ok) {
56 throw new Error('Request failed with status code ' + response.status);
57 }
58 return response.text();
59 })
60 .then(text => {
61 const logDisplay = document.getElementById('logDisplay');
62 logDisplay.innerHTML = term2html(text);
63 })
64 .catch(error => {
65 console.error(error);
66 logDisplay.innerHTML = 'Unable to obtain log data:\n' + error + '\nTry downloading the log file manually!';
67 });
68 </script>
69 {% else %}
70 <div class="notification is-warning">
71 This log was not found. It may not (yet) be available.
72 </div>
73 {% endif %}
74
75 </div>
76 </div>
77 {% endblock %}