Skip to content

Commit 283899c

Browse files
committed
Display pipeline information
1 parent d0956a9 commit 283899c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

dashboard/assets/scripts/dashboard.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
"use strict";
77

8+
String.prototype.removePrefix = function (prefix) {
9+
return this.startsWith(prefix) ? this.substr(prefix.length) : this.toString();
10+
};
11+
812
function assert(condition, message) {
913
if (!condition) {
1014
throw message || "Assertion failed";
@@ -328,6 +332,14 @@ class JobsRenderer {
328332

329333
updatePipelines(pipelines) {
330334
this.pipelines = pipelines;
335+
for (const job of this.jobs.sorted) {
336+
const pipeline_id = job.pipeline_id;
337+
const pipeline_just_id = pipeline_id.removePrefix("pipeline:");
338+
const pipeline_nick = this.pipelines[pipeline_id];
339+
const pipeline = this.renderInfo[job.ident].statsElements.pipeline;
340+
pipeline.title = `pipeline ${pipeline_nick ?? "unknown"} ${pipeline_just_id}`;
341+
pipeline.textContent = pipeline_nick ?? pipeline_just_id;
342+
}
331343
}
332344

333345
_createLogContainer(jobData) {
@@ -368,6 +380,10 @@ class JobsRenderer {
368380
return s;
369381
};
370382

383+
const pipeline_id = jobData.pipeline_id;
384+
const pipeline_just_id = pipeline_id.removePrefix("pipeline:");
385+
const pipeline_nick = this.pipelines[pipeline_id];
386+
371387
const statsElements = {
372388
mb: h("span", { className: `inline-stat ${maybeAligned("job-mb")}` }, "?"),
373389
responses: h("span", { className: `inline-stat ${maybeAligned("job-responses")}` }, "?"),
@@ -380,6 +396,12 @@ class JobsRenderer {
380396
href: `//${ds.host}${ds.port}/ignores/${ident}?compact=true`,
381397
onclick: (ev) => { ev.stopPropagation(); },
382398
}, "?" ),
399+
pipeline: h("a", {
400+
className: `inline-stat ${maybeAligned("job-pipeline")}`,
401+
href: `//${ds.host}${ds.port}/pipelines?initialFilter=${pipeline_id}`,
402+
title: `pipeline ${pipeline_nick ?? "unknown"} ${pipeline_just_id}`,
403+
onclick: (ev) => { ev.stopPropagation(); },
404+
}, pipeline_nick ?? pipeline_just_id),
383405
jobInfo: null /* set later */,
384406
};
385407

@@ -428,6 +450,8 @@ class JobsRenderer {
428450
statsElements.delay,
429451
"; ",
430452
statsElements.ignores,
453+
"; ",
454+
statsElements.pipeline,
431455
],
432456
),
433457
]);

0 commit comments

Comments
 (0)