Skip to content

Commit 6a08e27

Browse files
Erwin Dondorperwindon
authored andcommitted
auto refresh for job (always)
1 parent 516d498 commit 6a08e27

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

  • saltgui/static/scripts/panels

saltgui/static/scripts/panels/Job.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class JobPanel extends Panel {
1919
}
2020
this.addPanelMenu();
2121
this.addSearchButton();
22+
this.addPlayPauseButton();
2223

2324
// 1: re-run with original target pattern
2425
this._addPanelMenuItemJobRerunJob();
@@ -57,6 +58,21 @@ export class JobPanel extends Panel {
5758
this.div.append(this.output);
5859
}
5960

61+
_scheduleRefreshJob () {
62+
const jobsActiveSpan = document.getElementById("summary-jobs-active");
63+
if (jobsActiveSpan && jobsActiveSpan.innerText === "done") {
64+
console.log("DONE");
65+
// no updates after "done"
66+
return;
67+
}
68+
69+
console.log("scheduling onShow in 5s");
70+
window.setTimeout(() => {
71+
console.log("running onShow");
72+
this.onShow();
73+
}, 5000);
74+
}
75+
6076
onShow () {
6177
const jobId = decodeURIComponent(Utils.getQueryParam("id"));
6278
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
@@ -70,6 +86,7 @@ export class JobPanel extends Panel {
7086
this._handleJobRunnerJobsListJob(pRunnerJobsListJobData, jobId, minionId);
7187
runnerJobsActivePromise.then((pRunnerJobsActiveData) => {
7288
this._handleRunnerJobsActive(jobId, pRunnerJobsActiveData);
89+
this._scheduleRefreshJob();
7390
return true;
7491
}, (pRunnerJobsActiveMsg) => {
7592
this._handleRunnerJobsActive(jobId, JSON.stringify(pRunnerJobsActiveMsg));

0 commit comments

Comments
 (0)