Skip to content

Commit 726df98

Browse files
committed
resources
1 parent 243c5dc commit 726df98

File tree

4 files changed

+43
-11
lines changed

4 files changed

+43
-11
lines changed

services/static-webserver/client/source/class/osparc/data/Resources.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,24 @@ qx.Class.define("osparc.data.Resources", {
319319
}
320320
}
321321
},
322+
"jobs": {
323+
useCache: false, // handled in osparc.store.Jobs
324+
endpoints: {
325+
getPage: {
326+
method: "GET",
327+
url: statics.API + "/computations/-/iterations/latest?offset={offset}&limit={limit}&order_by={orderBy}"
328+
},
329+
}
330+
},
331+
"subJobs": {
332+
useCache: false, // handled in osparc.store.Jobs
333+
endpoints: {
334+
getPage: {
335+
method: "GET",
336+
url: statics.API + "/computations/{studyId}/iterations/latest/tasks?offset={offset}&limit={limit}&order_by={orderBy}"
337+
},
338+
}
339+
},
322340
"folders": {
323341
useCache: true,
324342
idField: "uuid",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ qx.Class.define("osparc.jobs.JobInfo", {
2525
this._setLayout(new qx.ui.layout.VBox());
2626

2727
const jobInfoViewer = this.getChildControl("job-info-viewer");
28-
osparc.store.Jobs.getInstance().fetchJobInfo(jobId)
28+
osparc.store.Jobs.getInstance().fetchSubJobs(jobId)
2929
.then(info => {
3030
jobInfoViewer.setJson(info);
3131
});

services/static-webserver/client/source/class/osparc/store/Jobs.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,16 @@ qx.Class.define("osparc.store.Jobs", {
3333
},
3434

3535
members: {
36-
fetchJobs: function() {
37-
return osparc.utils.Utils.fetchJSON("/resource/osparc/mock_jobs.json")
36+
fetchJobs: function(orderBy = {
37+
field: "submitted_at",
38+
direction: "desc"
39+
}) {
40+
const params = {
41+
url: {
42+
orderBy: JSON.stringify(orderBy),
43+
}
44+
};
45+
return osparc.data.Resources.getInstance().getAllPages("jobs", params)
3846
.then(jobsData => {
3947
if ("jobs" in jobsData) {
4048
jobsData["jobs"].forEach(jobData => {
@@ -46,11 +54,20 @@ qx.Class.define("osparc.store.Jobs", {
4654
.catch(err => console.error(err));
4755
},
4856

49-
fetchJobInfo: function(jobId) {
50-
return osparc.utils.Utils.fetchJSON("/resource/osparc/mock_jobs.json")
57+
fetchSubJobs: function(studyId, orderBy = {
58+
field: "submitted_at",
59+
direction: "desc"
60+
}) {
61+
const params = {
62+
url: {
63+
studyId,
64+
orderBy: JSON.stringify(orderBy),
65+
}
66+
};
67+
return osparc.data.Resources.getInstance().getAllPages("subJobs", params)
5168
.then(jobsData => {
52-
if ("jobs_info" in jobsData && jobId in jobsData["jobs_info"]) {
53-
return jobsData["jobs_info"][jobId];
69+
if ("jobs_info" in jobsData && studyId in jobsData["jobs_info"]) {
70+
return jobsData["jobs_info"][studyId];
5471
}
5572
return null;
5673
})

services/static-webserver/client/source/class/osparc/utils/DisabledPlugins.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ qx.Class.define("osparc.utils.DisabledPlugins", {
6161
},
6262

6363
isJobsEnabled: function() {
64-
if (osparc.store.StaticInfo.getInstance().isDevFeaturesEnabled() && osparc.product.Utils.isS4LProduct()) {
65-
return true;
66-
}
67-
return false;
64+
return osparc.store.StaticInfo.getInstance().isDevFeaturesEnabled();
6865
},
6966

7067
isHypertoolsEnabled: function() {

0 commit comments

Comments
 (0)