templates_jobs_messagesdir = $(templates_jobsdir)/messages
-dist_templates_jobs_modules_DATA = \
- src/templates/jobs/modules/log-stream.html
-
-templates_jobs_modulesdir = $(templates_jobsdir)/modules
-
templates_messagesdir = $(templatesdir)/messages
dist_templates_mirrors_DATA = \
static_js_DATA = \
src/static/js/jquery.min.js \
- src/static/js/job-log-stream.min.js \
src/static/js/notification-worker.min.js \
src/static/js/pbs.min.js
static_jsdir = $(staticdir)/js
EXTRA_DIST += \
- src/static/js/job-log-stream.js \
src/static/js/notification-worker.js \
src/static/js/pbs.js
+++ /dev/null
-$(".jobs-log-stream").each(function() {
- // Fetch the UUID of the job
- const uuid = $(this).data("uuid");
-
- // Fetch the limit
- const limit = $(this).data("limit");
-
- // Find where we are appending lines to
- const log = $(this);
-
- // Make the URL
- var url = "wss://" + window.location.host + "/api/v1/jobs/" + uuid + "/log/stream";
-
- if (limit > 0)
- url += "?limit=" + limit;
-
- // Try to connect to the stream
- const stream = new WebSocket(url);
-
- stream.addEventListener("message", (event) => {
- // Parse message as JSON
- const data = JSON.parse(event.data);
-
- console.log("Message from server: ", data);
-
- // If there is a limit, reduce the number of rows first
- while (limit > 0 && log.children().length >= limit) {
- log.children().first().remove();
- }
-
- // Create a new line
- var line = $("<li></li>");
-
- // Set the log level
- line.addClass(data.level);
-
- // Set the content
- line.text(data.message);
-
- // Append it to the log window
- log.append(line);
- });
-});
updateProgressBar(swap_usage, data.swap_usage);
});
});
+
+/*
+ * Log Stream
+ */
+$(".jobs-log-stream").each(function() {
+ // Fetch the UUID of the job
+ const uuid = $(this).data("uuid");
+
+ // Fetch the limit
+ const limit = $(this).data("limit");
+
+ // Find where we are appending lines to
+ const log = $(this);
+
+ // Make the URL
+ var url = "wss://" + window.location.host + "/api/v1/jobs/" + uuid + "/log/stream";
+
+ if (limit > 0)
+ url += "?limit=" + limit;
+
+ // Try to connect to the stream
+ const stream = new WebSocket(url);
+
+ stream.addEventListener("message", (event) => {
+ // Parse message as JSON
+ const data = JSON.parse(event.data);
+
+ console.log("Message from server: ", data);
+
+ // If there is a limit, reduce the number of rows first
+ while (limit > 0 && log.children().length >= limit) {
+ log.children().first().remove();
+ }
+
+ // Create a new line
+ var line = $("<li></li>");
+
+ // Set the log level
+ line.addClass(data.level);
+
+ // Set the content
+ line.text(data.message);
+
+ // Append it to the log window
+ log.append(line);
+ });
+});
-{% extends "../base.html" %}
+{% extends "base.html" %}
-{% block title %}{{ job }} - {{ _("Log") }}{% end block %}
+{% block title %}{{ job }} - {{ _("Log") }}{% endblock %}
{% block container %}
<nav class="breadcrumb" aria-label="breadcrumbs">
</ul>
</nav>
- {% module JobsLogStream(job) %}
-{% end block %}
+ {{ JobLogStream(job) }}
+{% endblock %}
{# Log #}
{% if job.is_running() %}
<div class="panel-block">
- {..% module JobsLogStream(job, limit=5) %..}
+ {{ JobLogStream(job, limit=5) }}
</div>
{# Dependency Issues #}
{% endfor %}
</nav>
{% endmacro %}
+
+{% macro JobLogStream(job, small=False, limit=None) %}
+ <ul class="jobs-log-stream {% if small %}is-small{% endif %}"
+ data-uuid="{{ job.uuid }}" {% if limit %}data-limit="{{ limit }}"{% endif %}></ul>
+{% endmacro %}
+++ /dev/null
-<ul class="jobs-log-stream {% if small %}is-small{% end %}"
- data-uuid="{{ job.uuid }}" {% if limit %}data-limit="{{ limit }}"{% end %}></ul>