Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ qx.Class.define("osparc.data.Resources", {
},
}
},
"jobs": {
"runs": {
useCache: false, // handled in osparc.store.Jobs
endpoints: {
getPageLatestActive: {
Expand All @@ -356,16 +356,16 @@ qx.Class.define("osparc.data.Resources", {
},
getPageHistory: {
method: "GET",
url: statics.API + "/computations/{studyId}/iterations?offset={offset}&limit={limit}&order_by=%7B%22field%22:%22submitted_at%22,%22direction%22:%22desc%22%7D"
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}"
},
}
},
"subJobs": {
"subRuns": {
useCache: false, // handled in osparc.store.Jobs
endpoints: {
getPageLatest: {
method: "GET",
url: statics.API + "/computations/{studyId}/iterations/latest/tasks?offset={offset}&limit={limit}"
url: statics.API + "/computations/{studyId}/iterations/latest/tasks?offset={offset}&limit={limit}&include_children={includeChildren}"
},
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ qx.Class.define("osparc.jobs.ActivityOverview", {
runsHistoryTitleLayout.add(runsHistoryTitleHelper);
this._add(runsHistoryTitleLayout);

const latestOnly = false;
const projectUuid = projectData["uuid"];
const runsTable = new osparc.jobs.RunsTable(latestOnly, projectUuid);
const includeChildren = true;
const runsTable = new osparc.jobs.RunsTable(projectUuid, includeChildren);
const columnModel = runsTable.getTableColumnModel();
// Hide project name column
columnModel.setColumnVisible(osparc.jobs.RunsTable.COLS.PROJECT_NAME.column, false);
Expand All @@ -82,7 +82,7 @@ qx.Class.define("osparc.jobs.ActivityOverview", {
latestTasksTitleLayout.add(latestTasksTitleHelper);
this._add(latestTasksTitleLayout);

const subRunsTable = new osparc.jobs.SubRunsTable(projectData["uuid"]);
const subRunsTable = new osparc.jobs.SubRunsTable(projectUuid, includeChildren);
subRunsTable.set({
maxHeight: 250,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ qx.Class.define("osparc.jobs.RunsBrowser", {
});
break;
case "runs-table": {
const latestOnly = true;
const projectUuid = null;
control = new osparc.jobs.RunsTable(latestOnly, projectUuid);
const includeChildren = false;
control = new osparc.jobs.RunsTable(projectUuid, includeChildren);
control.addListener("runSelected", e => this.fireDataEvent("runSelected", e.getData()));
this._add(control);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
qx.Class.define("osparc.jobs.RunsTable", {
extend: qx.ui.table.Table,

construct: function(latestOnly = true, projectUuid = null) {
construct: function(projectUuid = null, includeChildren = false) {
this.base(arguments);

const model = new osparc.jobs.RunsTableModel(latestOnly, projectUuid);
const model = new osparc.jobs.RunsTableModel(projectUuid, includeChildren);
this.setTableModel(model);

this.set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
qx.Class.define("osparc.jobs.RunsTableModel", {
extend: qx.ui.table.model.Remote,

construct: function(latestOnly = true, projectUuid = null) {
construct: function(projectUuid = null, includeChildren = false) {
this.base(arguments);

this.__latestOnly = latestOnly;
this.__projectUuid = projectUuid;
this.__includeChildren = includeChildren;

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

members: {
__projectUuid: null,
__includeChildren: false,

// overridden
_loadRowCount() {
const offset = 0;
const limit = 1;
const resolveWResponse = true;
let promise;
if (this.__latestOnly && this.__projectUuid === null) {
promise = osparc.store.Jobs.getInstance().fetchJobsActive(offset, limit, JSON.stringify(this.getOrderBy()), resolveWResponse);
if (this.__projectUuid) {
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.__projectUuid, this.__includeChildren, offset, limit, JSON.stringify(this.getOrderBy()), resolveWResponse);
} else {
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.__projectUuid, offset, limit, JSON.stringify(this.getOrderBy()), resolveWResponse);
promise = osparc.store.Jobs.getInstance().fetchJobsActive(offset, limit, JSON.stringify(this.getOrderBy()), resolveWResponse);
}
promise
.then(resp => {
Expand All @@ -86,10 +89,10 @@ qx.Class.define("osparc.jobs.RunsTableModel", {
// Returns a request promise with given offset and limit
const getFetchPromise = (offset, limit) => {
let promise;
if (this.__latestOnly && this.__projectUuid === null) {
promise = osparc.store.Jobs.getInstance().fetchJobsActive(offset, limit, JSON.stringify(this.getOrderBy()));
if (this.__projectUuid) {
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.__projectUuid, this.__includeChildren, offset, limit, JSON.stringify(this.getOrderBy()));
} else {
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.__projectUuid, offset, limit, JSON.stringify(this.getOrderBy()));
promise = osparc.store.Jobs.getInstance().fetchJobsActive(offset, limit, JSON.stringify(this.getOrderBy()));
}
return promise
.then(jobs => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ qx.Class.define("osparc.jobs.SubRunsBrowser", {

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

const subRunsTable = this.__subRunsTable = new osparc.jobs.SubRunsTable(project["projectUuid"]);
const includeChildren = false;
const subRunsTable = this.__subRunsTable = new osparc.jobs.SubRunsTable(project["projectUuid"], includeChildren);
this._add(subRunsTable, {
flex: 1
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
qx.Class.define("osparc.jobs.SubRunsTable", {
extend: qx.ui.table.Table,

construct: function(projectUuid) {
construct: function(projectUuid, includeChildren = false) {
this.base(arguments);

const model = new osparc.jobs.SubRunsTableModel(projectUuid);
const model = new osparc.jobs.SubRunsTableModel(projectUuid, includeChildren);
this.setTableModel(model);

this.set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
qx.Class.define("osparc.jobs.SubRunsTableModel", {
extend: qx.ui.table.model.Remote,

construct: function(projectUuid) {
construct: function(projectUuid, includeChildren = false) {
this.base(arguments);

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

this.setProjectUuid(projectUuid);
this.__includeChildren = includeChildren;
},

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

members: {
__includeChildren: null,

// overridden
_loadRowCount() {
osparc.store.Jobs.getInstance().fetchSubJobs(this.getProjectUuid())
osparc.store.Jobs.getInstance().fetchSubJobs(this.getProjectUuid(), this.__includeChildren)
.then(subJobs => {
this._onRowCountLoaded(subJobs.length)
})
Expand All @@ -68,7 +71,7 @@ qx.Class.define("osparc.jobs.SubRunsTableModel", {
const lastRow = Math.min(qxLastRow, this._rowCount - 1);
// Returns a request promise with given offset and limit
const getFetchPromise = () => {
return osparc.store.Jobs.getInstance().fetchSubJobs(this.getProjectUuid())
return osparc.store.Jobs.getInstance().fetchSubJobs(this.getProjectUuid(), this.__includeChildren)
.then(subJobs => {
const data = [];
const subJobsCols = osparc.jobs.SubRunsTable.COLS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ qx.Class.define("osparc.store.Jobs", {
const options = {
resolveWResponse: true
};
return osparc.data.Resources.fetch("jobs", "getPageLatestActive", params, options)
return osparc.data.Resources.fetch("runs", "getPageLatestActive", params, options)
.then(jobsResp => {
this.fireDataEvent("changeJobsActive", jobsResp["_meta"]["total"]);
const jobsActive = [];
Expand All @@ -75,6 +75,7 @@ qx.Class.define("osparc.store.Jobs", {

fetchJobsHistory: function(
studyId,
includeChildren = false,
offset = 0,
limit = this.self().SERVER_MAX_LIMIT,
orderBy = {
Expand All @@ -86,6 +87,7 @@ qx.Class.define("osparc.store.Jobs", {
const params = {
url: {
studyId,
includeChildren,
offset,
limit,
orderBy: JSON.stringify(orderBy),
Expand All @@ -94,7 +96,7 @@ qx.Class.define("osparc.store.Jobs", {
const options = {
resolveWResponse: true
};
return osparc.data.Resources.fetch("jobs", "getPageHistory", params, options)
return osparc.data.Resources.fetch("runs", "getPageHistory", params, options)
.then(jobsResp => {
if (resolveWResponse) {
return jobsResp;
Expand All @@ -111,13 +113,14 @@ qx.Class.define("osparc.store.Jobs", {
.catch(err => console.error(err));
},

fetchSubJobs: function(projectUuid) {
fetchSubJobs: function(projectUuid, includeChildren = false) {
const params = {
url: {
studyId: projectUuid,
includeChildren,
}
};
return osparc.data.Resources.getInstance().getAllPages("subJobs", params, "getPageLatest")
return osparc.data.Resources.getInstance().getAllPages("subRuns", params, "getPageLatest")
.then(subJobsData => {
const subJobs = [];
subJobsData.forEach(subJobData => {
Expand Down
Loading