Skip to content

Commit f478f1f

Browse files
Erwin Dondorperwindon
authored andcommitted
added play/pause button
1 parent 6a08e27 commit f478f1f

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

  • saltgui/static/scripts/panels

saltgui/static/scripts/panels/Job.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,28 @@ export class JobPanel extends Panel {
5858
this.div.append(this.output);
5959
}
6060

61+
updateFooter () {
62+
// PlayPause uses this as call-back
63+
if (this.playOrPause === "play" || this.playOrPause === "pause") {
64+
// store the user preference for next time
65+
Utils.setStorageItem("local", "jobrefresh", this.playOrPause);
66+
}
67+
}
68+
6169
_scheduleRefreshJob () {
6270
const jobsActiveSpan = document.getElementById("summary-jobs-active");
6371
if (jobsActiveSpan && jobsActiveSpan.innerText === "done") {
64-
console.log("DONE");
6572
// no updates after "done"
73+
this.setPlayPauseButton("none");
6674
return;
6775
}
6876

69-
console.log("scheduling onShow in 5s");
7077
window.setTimeout(() => {
71-
console.log("running onShow");
72-
this.onShow();
78+
if (this.playOrPause === "play") {
79+
this.onShow();
80+
} else {
81+
this._scheduleRefreshJob();
82+
}
7383
}, 5000);
7484
}
7585

@@ -90,14 +100,22 @@ console.log("running onShow");
90100
return true;
91101
}, (pRunnerJobsActiveMsg) => {
92102
this._handleRunnerJobsActive(jobId, JSON.stringify(pRunnerJobsActiveMsg));
103+
this.setPlayPauseButton("none");
93104
return false;
94105
});
95106
return true;
96107
}, (pRunnerJobsListJobsMsg) => {
97108
this._handleJobRunnerJobsListJob(JSON.stringify(pRunnerJobsListJobsMsg), jobId, undefined);
98109
Utils.ignorePromise(runnerJobsActivePromise);
110+
this.setPlayPauseButton("none");
99111
return false;
100112
});
113+
114+
let jobRefresh = Utils.getStorageItem("local", "jobrefresh", "pause");
115+
if (jobRefresh !== "play" && jobRefresh !== "pause") {
116+
jobRefresh = "pause";
117+
}
118+
this.setPlayPauseButton(jobRefresh);
101119
}
102120

103121
static _isResultOk (result) {
@@ -505,6 +523,7 @@ console.log("running onShow");
505523
if (typeof pData !== "object") {
506524
summaryJobsActiveSpan.innerText = "(error)";
507525
Utils.addToolTip(summaryJobsActiveSpan, pData, "bottom-left");
526+
this.setPlayPauseButton("none");
508527
return;
509528
}
510529

@@ -514,6 +533,7 @@ console.log("running onShow");
514533
if (!info) {
515534
summaryJobsActiveSpan.innerText = "done";
516535
this.jobIsTerminated = true;
536+
this.setPlayPauseButton("none");
517537
return;
518538
}
519539
this.jobIsTerminated = false;

0 commit comments

Comments
 (0)