Skip to content

Commit 59a9c79

Browse files
committed
sort runs
1 parent a6417a3 commit 59a9c79

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,11 @@ qx.Class.define("osparc.data.Resources", {
352352
endpoints: {
353353
getPageLatest: {
354354
method: "GET",
355-
url: statics.API + "/computations/-/iterations/latest?offset={offset}&limit={limit}&order_by=%7B%22field%22:%22submitted_at%22,%22direction%22:%22desc%22%7D&filter_only_running={runningOnly}&filters={filters}"
355+
url: statics.API + "/computations/-/iterations/latest?offset={offset}&limit={limit}&order_by={orderBy}&filter_only_running={runningOnly}&filters={filters}"
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&include_children={includeChildren}"
359+
url: statics.API + "/computations/{studyId}/iterations?offset={offset}&limit={limit}&order_by={orderBy}&include_children={includeChildren}"
360360
},
361361
}
362362
},
@@ -365,7 +365,7 @@ qx.Class.define("osparc.data.Resources", {
365365
endpoints: {
366366
getPageLatest: {
367367
method: "GET",
368-
url: statics.API + "/computations/{studyId}/iterations/latest/tasks?offset={offset}&limit={limit}&order_by=%7B%22field%22:%22started_at%22,%22direction%22:%22desc%22%7D&include_children={includeChildren}"
368+
url: statics.API + "/computations/{studyId}/iterations/latest/tasks?offset={offset}&limit={limit}&order_by={orderBy}&include_children={includeChildren}"
369369
},
370370
}
371371
},

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,34 +87,33 @@ qx.Class.define("osparc.jobs.RunsTable", {
8787
column: 1,
8888
label: qx.locale.Manager.tr("Project"),
8989
width: 150,
90-
sortable: true
9190
},
9291
STATE: {
9392
id: "state",
9493
column: 2,
9594
label: qx.locale.Manager.tr("Status"),
96-
width: 150
95+
width: 150,
9796
},
9897
SUBMIT: {
9998
id: "submit",
10099
column: 3,
101100
label: qx.locale.Manager.tr("Queued"),
102101
width: 130,
103-
sortable: true
102+
sortableMap: "submitted_at",
104103
},
105104
START: {
106105
id: "start",
107106
column: 4,
108107
label: qx.locale.Manager.tr("Started"),
109108
width: 130,
110-
sortable: true
109+
sortableMap: "started_at",
111110
},
112111
END: {
113112
id: "end",
114113
column: 5,
115114
label: qx.locale.Manager.tr("Ended"),
116115
width: 130,
117-
sortable: true
116+
sortableMap: "ended_at",
118117
},
119118
ACTION_CANCEL: {
120119
id: "action_cancel",

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ qx.Class.define("osparc.jobs.RunsTableModel", {
3636
this.setSortColumnIndexWithoutSortingData(jobsCols.SUBMIT.column);
3737
this.setSortAscendingWithoutSortingData(false);
3838
Object.values(jobsCols).forEach(col => {
39-
this.setColumnSortable(col.column, Boolean(col.sortable));
39+
this.setColumnSortable(col.column, Boolean(col.sortableMap));
4040
});
4141
},
4242

@@ -66,7 +66,7 @@ qx.Class.define("osparc.jobs.RunsTableModel", {
6666
orderBy: {
6767
check: "Object",
6868
init: {
69-
field: "submitted_at", // ended_at|started_at|state|submitted_at
69+
field: "submitted_at", // state|submitted_at|started_at|ended_at
7070
direction: "desc"
7171
}
7272
},
@@ -86,6 +86,17 @@ qx.Class.define("osparc.jobs.RunsTableModel", {
8686
members: {
8787
__includeChildren: false,
8888

89+
// overridden
90+
sortByColumn(columnIndex, ascending) {
91+
const jobsCols = osparc.jobs.RunsTable.COLS;
92+
const colInfo = Object.values(jobsCols).find(col => col.column === columnIndex);
93+
this.setOrderBy({
94+
field: colInfo.sortableMap,
95+
direction: ascending ? "asc" : "desc"
96+
})
97+
this.base(arguments, columnIndex, ascending)
98+
},
99+
89100
// overridden
90101
_loadRowCount() {
91102
const offset = 0;

0 commit comments

Comments
 (0)