Skip to content

Commit cb300c3

Browse files
committed
__startRefreshTimer
1 parent 252e3c1 commit cb300c3

File tree

1 file changed

+21
-1
lines changed
  • services/static-webserver/client/source/class/osparc/jobs

1 file changed

+21
-1
lines changed

services/static-webserver/client/source/class/osparc/jobs/JobsButton.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ qx.Class.define("osparc.jobs.JobsButton", {
4848
},
4949

5050
members: {
51+
__fetchNJobs: null,
52+
5153
_createChildControlImpl: function(id) {
5254
let control;
5355
switch (id) {
@@ -100,7 +102,7 @@ qx.Class.define("osparc.jobs.JobsButton", {
100102
if (osparc.study.Utils.amIRunningTheStudy(content)) {
101103
this.__updateJobsButton(true);
102104
}
103-
// ...in the next iteration: listen to main store's "studyStateChanged"
105+
// ...in the next iteration: listen to main store's "studyStateChanged", which will cover all users
104106
}, this);
105107
},
106108

@@ -114,6 +116,24 @@ qx.Class.define("osparc.jobs.JobsButton", {
114116
visibility: isActive ? "visible" : "excluded"
115117
});
116118
});
119+
120+
// Start or restart timer when isActive is true
121+
if (isActive) {
122+
this.__startRefreshTimer();
123+
}
124+
},
125+
126+
__startRefreshTimer: function() {
127+
// Stop existing timer if running
128+
if (this.__refreshTimer) {
129+
this.__refreshTimer.stop();
130+
this.__refreshTimer.dispose();
131+
}
132+
133+
// Create and start new timer (30 seconds = 30000ms)
134+
this.__refreshTimer = new qx.event.Timer(30000);
135+
this.__refreshTimer.addListener("interval", () => this.__fetchNJobs(), this);
136+
this.__refreshTimer.start();
117137
},
118138
}
119139
});

0 commit comments

Comments
 (0)