Skip to content

Commit 3b9753c

Browse files
committed
Display pipeline information
1 parent e7116a4 commit 3b9753c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

dashboard/assets/scripts/dashboard.js

Lines changed: 33 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";
@@ -326,8 +330,22 @@ class JobsRenderer {
326330
return h("div");
327331
}
328332

333+
pipelineInfo(job) {
334+
const pipeline_id = job.pipeline_id;
335+
const pipeline_just_id = pipeline_id.removePrefix("pipeline:");
336+
const pipeline_nick = this.pipelines[pipeline_id];
337+
return [
338+
`pipeline ${pipeline_nick ?? "unknown"} ${pipeline_just_id}`,
339+
pipeline_nick ?? pipeline_just_id,
340+
]
341+
}
342+
329343
updatePipelines(pipelines) {
330344
this.pipelines = pipelines;
345+
for (const job of this.jobs.sorted) {
346+
const pipeline = this.renderInfo[job.ident].statsElements.pipeline;
347+
[pipeline.title, pipeline.textContent] = this.pipelineInfo(job);
348+
}
331349
}
332350

333351
_createLogContainer(jobData) {
@@ -368,6 +386,9 @@ class JobsRenderer {
368386
return s;
369387
};
370388

389+
390+
const [pipeline_title, pipeline_text] = this.pipelineInfo(jobData);
391+
371392
const statsElements = {
372393
mb: h("span", { className: `inline-stat ${maybeAligned("job-mb")}` }, "?"),
373394
responses: h("span", { className: `inline-stat ${maybeAligned("job-responses")}` }, "?"),
@@ -380,6 +401,12 @@ class JobsRenderer {
380401
href: `//${ds.host}${ds.port}/ignores/${ident}?compact=true`,
381402
onclick: (ev) => { ev.stopPropagation(); },
382403
}, "?" ),
404+
pipeline: h("a", {
405+
className: `inline-stat ${maybeAligned("job-pipeline")}`,
406+
href: `//${ds.host}${ds.port}/pipelines?initialFilter=${jobData.pipeline_id}`,
407+
title: pipeline_title,
408+
onclick: (ev) => { ev.stopPropagation(); },
409+
}, pipeline_text),
383410
jobInfo: null /* set later */,
384411
};
385412

@@ -428,6 +455,8 @@ class JobsRenderer {
428455
statsElements.delay,
429456
"; ",
430457
statsElements.ignores,
458+
"; ",
459+
statsElements.pipeline,
431460
],
432461
),
433462
]);
@@ -605,6 +634,10 @@ class JobsRenderer {
605634
}
606635
}
607636

637+
// Update pipeline in case a job is restarted on another pipline
638+
const pipeline = info.statsElements.pipeline;
639+
[pipeline.title, pipeline.textContent] = this.pipelineInfo(jobData);
640+
608641
// Update note
609642
info.jobNote.textContent = isBlank(jobData.note) ? "" : ` (${jobData.note})`;
610643
if (isBlank(jobData.note)) {

0 commit comments

Comments
 (0)