Skip to content

Commit 9188df0

Browse files
🎨 [Frontend] Runs with children (#7712)
Co-authored-by: Matus Drobuliak <[email protected]>
1 parent e395992 commit 9188df0

File tree

9 files changed

+39
-29
lines changed

9 files changed

+39
-29
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ qx.Class.define("osparc.data.Resources", {
347347
},
348348
}
349349
},
350-
"jobs": {
350+
"runs": {
351351
useCache: false, // handled in osparc.store.Jobs
352352
endpoints: {
353353
getPageLatestActive: {
@@ -356,16 +356,16 @@ qx.Class.define("osparc.data.Resources", {
356356
},
357357
getPageHistory: {
358358
method: "GET",
359-
url: statics.API + "/computations/{studyId}/iterations?offset={offset}&limit={limit}&order_by=%7B%22field%22:%22submitted_at%22,%22direction%22:%22desc%22%7D"
359+
url: statics.API + "/computations/{studyId}/iterations?offset={offset}&limit={limit}&order_by=%7B%22field%22:%22submitted_at%22,%22direction%22:%22desc%22%7D&include_children={includeChildren}"
360360
},
361361
}
362362
},
363-
"subJobs": {
363+
"subRuns": {
364364
useCache: false, // handled in osparc.store.Jobs
365365
endpoints: {
366366
getPageLatest: {
367367
method: "GET",
368-
url: statics.API + "/computations/{studyId}/iterations/latest/tasks?offset={offset}&limit={limit}"
368+
url: statics.API + "/computations/{studyId}/iterations/latest/tasks?offset={offset}&limit={limit}&include_children={includeChildren}"
369369
},
370370
}
371371
},

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ qx.Class.define("osparc.jobs.ActivityOverview", {
5353
runsHistoryTitleLayout.add(runsHistoryTitleHelper);
5454
this._add(runsHistoryTitleLayout);
5555

56-
const latestOnly = false;
5756
const projectUuid = projectData["uuid"];
58-
const runsTable = new osparc.jobs.RunsTable(latestOnly, projectUuid);
57+
const includeChildren = true;
58+
const runsTable = new osparc.jobs.RunsTable(projectUuid, includeChildren);
5959
const columnModel = runsTable.getTableColumnModel();
6060
// Hide project name column
6161
columnModel.setColumnVisible(osparc.jobs.RunsTable.COLS.PROJECT_NAME.column, false);
@@ -82,7 +82,7 @@ qx.Class.define("osparc.jobs.ActivityOverview", {
8282
latestTasksTitleLayout.add(latestTasksTitleHelper);
8383
this._add(latestTasksTitleLayout);
8484

85-
const subRunsTable = new osparc.jobs.SubRunsTable(projectData["uuid"]);
85+
const subRunsTable = new osparc.jobs.SubRunsTable(projectUuid, includeChildren);
8686
subRunsTable.set({
8787
maxHeight: 250,
8888
})

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ qx.Class.define("osparc.jobs.RunsBrowser", {
6161
});
6262
break;
6363
case "runs-table": {
64-
const latestOnly = true;
6564
const projectUuid = null;
66-
control = new osparc.jobs.RunsTable(latestOnly, projectUuid);
65+
const includeChildren = false;
66+
control = new osparc.jobs.RunsTable(projectUuid, includeChildren);
6767
control.addListener("runSelected", e => this.fireDataEvent("runSelected", e.getData()));
6868
this._add(control);
6969
break;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
qx.Class.define("osparc.jobs.RunsTable", {
2020
extend: qx.ui.table.Table,
2121

22-
construct: function(latestOnly = true, projectUuid = null) {
22+
construct: function(projectUuid = null, includeChildren = false) {
2323
this.base(arguments);
2424

25-
const model = new osparc.jobs.RunsTableModel(latestOnly, projectUuid);
25+
const model = new osparc.jobs.RunsTableModel(projectUuid, includeChildren);
2626
this.setTableModel(model);
2727

2828
this.set({

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
qx.Class.define("osparc.jobs.RunsTableModel", {
2020
extend: qx.ui.table.model.Remote,
2121

22-
construct: function(latestOnly = true, projectUuid = null) {
22+
construct: function(projectUuid = null, includeChildren = false) {
2323
this.base(arguments);
2424

25-
this.__latestOnly = latestOnly;
2625
this.__projectUuid = projectUuid;
26+
this.__includeChildren = includeChildren;
2727

2828
const jobsCols = osparc.jobs.RunsTable.COLS;
2929
const colLabels = Object.values(jobsCols).map(col => col.label);
@@ -58,16 +58,19 @@ qx.Class.define("osparc.jobs.RunsTableModel", {
5858
},
5959

6060
members: {
61+
__projectUuid: null,
62+
__includeChildren: false,
63+
6164
// overridden
6265
_loadRowCount() {
6366
const offset = 0;
6467
const limit = 1;
6568
const resolveWResponse = true;
6669
let promise;
67-
if (this.__latestOnly && this.__projectUuid === null) {
68-
promise = osparc.store.Jobs.getInstance().fetchJobsActive(offset, limit, JSON.stringify(this.getOrderBy()), resolveWResponse);
70+
if (this.__projectUuid) {
71+
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.__projectUuid, this.__includeChildren, offset, limit, JSON.stringify(this.getOrderBy()), resolveWResponse);
6972
} else {
70-
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.__projectUuid, offset, limit, JSON.stringify(this.getOrderBy()), resolveWResponse);
73+
promise = osparc.store.Jobs.getInstance().fetchJobsActive(offset, limit, JSON.stringify(this.getOrderBy()), resolveWResponse);
7174
}
7275
promise
7376
.then(resp => {
@@ -86,10 +89,10 @@ qx.Class.define("osparc.jobs.RunsTableModel", {
8689
// Returns a request promise with given offset and limit
8790
const getFetchPromise = (offset, limit) => {
8891
let promise;
89-
if (this.__latestOnly && this.__projectUuid === null) {
90-
promise = osparc.store.Jobs.getInstance().fetchJobsActive(offset, limit, JSON.stringify(this.getOrderBy()));
92+
if (this.__projectUuid) {
93+
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.__projectUuid, this.__includeChildren, offset, limit, JSON.stringify(this.getOrderBy()));
9194
} else {
92-
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.__projectUuid, offset, limit, JSON.stringify(this.getOrderBy()));
95+
promise = osparc.store.Jobs.getInstance().fetchJobsActive(offset, limit, JSON.stringify(this.getOrderBy()));
9396
}
9497
return promise
9598
.then(jobs => {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ qx.Class.define("osparc.jobs.SubRunsBrowser", {
7474

7575
this.__titleLabel.setValue(project["projectName"])
7676

77-
const subRunsTable = this.__subRunsTable = new osparc.jobs.SubRunsTable(project["projectUuid"]);
77+
const includeChildren = false;
78+
const subRunsTable = this.__subRunsTable = new osparc.jobs.SubRunsTable(project["projectUuid"], includeChildren);
7879
this._add(subRunsTable, {
7980
flex: 1
8081
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
qx.Class.define("osparc.jobs.SubRunsTable", {
2020
extend: qx.ui.table.Table,
2121

22-
construct: function(projectUuid) {
22+
construct: function(projectUuid, includeChildren = false) {
2323
this.base(arguments);
2424

25-
const model = new osparc.jobs.SubRunsTableModel(projectUuid);
25+
const model = new osparc.jobs.SubRunsTableModel(projectUuid, includeChildren);
2626
this.setTableModel(model);
2727

2828
this.set({

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
qx.Class.define("osparc.jobs.SubRunsTableModel", {
2020
extend: qx.ui.table.model.Remote,
2121

22-
construct: function(projectUuid) {
22+
construct: function(projectUuid, includeChildren = false) {
2323
this.base(arguments);
2424

2525
const subJobsCols = osparc.jobs.SubRunsTable.COLS;
@@ -34,6 +34,7 @@ qx.Class.define("osparc.jobs.SubRunsTableModel", {
3434
});
3535

3636
this.setProjectUuid(projectUuid);
37+
this.__includeChildren = includeChildren;
3738
},
3839

3940
properties: {
@@ -50,9 +51,11 @@ qx.Class.define("osparc.jobs.SubRunsTableModel", {
5051
},
5152

5253
members: {
54+
__includeChildren: null,
55+
5356
// overridden
5457
_loadRowCount() {
55-
osparc.store.Jobs.getInstance().fetchSubJobs(this.getProjectUuid())
58+
osparc.store.Jobs.getInstance().fetchSubJobs(this.getProjectUuid(), this.__includeChildren)
5659
.then(subJobs => {
5760
this._onRowCountLoaded(subJobs.length)
5861
})
@@ -68,7 +71,7 @@ qx.Class.define("osparc.jobs.SubRunsTableModel", {
6871
const lastRow = Math.min(qxLastRow, this._rowCount - 1);
6972
// Returns a request promise with given offset and limit
7073
const getFetchPromise = () => {
71-
return osparc.store.Jobs.getInstance().fetchSubJobs(this.getProjectUuid())
74+
return osparc.store.Jobs.getInstance().fetchSubJobs(this.getProjectUuid(), this.__includeChildren)
7275
.then(subJobs => {
7376
const data = [];
7477
const subJobsCols = osparc.jobs.SubRunsTable.COLS;

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ qx.Class.define("osparc.store.Jobs", {
5656
const options = {
5757
resolveWResponse: true
5858
};
59-
return osparc.data.Resources.fetch("jobs", "getPageLatestActive", params, options)
59+
return osparc.data.Resources.fetch("runs", "getPageLatestActive", params, options)
6060
.then(jobsResp => {
6161
this.fireDataEvent("changeJobsActive", jobsResp["_meta"]["total"]);
6262
const jobsActive = [];
@@ -75,6 +75,7 @@ qx.Class.define("osparc.store.Jobs", {
7575

7676
fetchJobsHistory: function(
7777
studyId,
78+
includeChildren = false,
7879
offset = 0,
7980
limit = this.self().SERVER_MAX_LIMIT,
8081
orderBy = {
@@ -86,6 +87,7 @@ qx.Class.define("osparc.store.Jobs", {
8687
const params = {
8788
url: {
8889
studyId,
90+
includeChildren,
8991
offset,
9092
limit,
9193
orderBy: JSON.stringify(orderBy),
@@ -94,7 +96,7 @@ qx.Class.define("osparc.store.Jobs", {
9496
const options = {
9597
resolveWResponse: true
9698
};
97-
return osparc.data.Resources.fetch("jobs", "getPageHistory", params, options)
99+
return osparc.data.Resources.fetch("runs", "getPageHistory", params, options)
98100
.then(jobsResp => {
99101
if (resolveWResponse) {
100102
return jobsResp;
@@ -111,13 +113,14 @@ qx.Class.define("osparc.store.Jobs", {
111113
.catch(err => console.error(err));
112114
},
113115

114-
fetchSubJobs: function(projectUuid) {
116+
fetchSubJobs: function(projectUuid, includeChildren = false) {
115117
const params = {
116118
url: {
117119
studyId: projectUuid,
120+
includeChildren,
118121
}
119122
};
120-
return osparc.data.Resources.getInstance().getAllPages("subJobs", params, "getPageLatest")
123+
return osparc.data.Resources.getInstance().getAllPages("subRuns", params, "getPageLatest")
121124
.then(subJobsData => {
122125
const subJobs = [];
123126
subJobsData.forEach(subJobData => {

0 commit comments

Comments
 (0)