diff --git a/services/static-webserver/client/source/class/osparc/data/Job.js b/services/static-webserver/client/source/class/osparc/data/Job.js index e6eb948c521..0572c4df956 100644 --- a/services/static-webserver/client/source/class/osparc/data/Job.js +++ b/services/static-webserver/client/source/class/osparc/data/Job.js @@ -22,27 +22,33 @@ qx.Class.define("osparc.data.Job", { this.base(arguments); this.set({ - projectUuid: jobData["projectUuid"], - projectName: jobData["rootProjectName"] || "", + collectionRunId: jobData["collectionRunId"], + projectIds: jobData["projectIds"], + name: jobData["name"] || "", state: jobData["state"] || "UNKNOWN", submittedAt: jobData["submittedAt"] ? new Date(jobData["submittedAt"]) : null, startedAt: jobData["startedAt"] ? new Date(jobData["startedAt"]) : null, endedAt: jobData["endedAt"] ? new Date(jobData["endedAt"]) : null, info: jobData["info"] || null, - customMetadata: jobData["projectCustomMetadata"] || null, }); this.__subJobs = []; }, properties: { - projectUuid: { + collectionRunId: { check: "String", nullable: false, init: null, }, - projectName: { + projectIds: { + check: "Array", + nullable: false, + init: null, + }, + + name: { check: "String", nullable: false, init: null, @@ -77,12 +83,6 @@ qx.Class.define("osparc.data.Job", { nullable: true, init: null, }, - - customMetadata: { - check: "Object", - nullable: true, - init: null, - }, }, statics: { @@ -104,14 +104,14 @@ qx.Class.define("osparc.data.Job", { members: { __subJobs: null, - addSubJob: function(subJobData) { + addSubJob: function(collectionRunId, subJobData) { const subJobFound = this.__subJobs.find(subJb => subJb.getNodeId() === subJobData["nodeId"]); if (subJobFound) { subJobFound.updateSubJob(subJobData); return subJobFound; } - const subJob = new osparc.data.SubJob(subJobData); + const subJob = new osparc.data.SubJob(collectionRunId, subJobData); this.__subJobs.push(subJob); return subJob; }, diff --git a/services/static-webserver/client/source/class/osparc/data/Resources.js b/services/static-webserver/client/source/class/osparc/data/Resources.js index 781f672fece..df605b8fd16 100644 --- a/services/static-webserver/client/source/class/osparc/data/Resources.js +++ b/services/static-webserver/client/source/class/osparc/data/Resources.js @@ -368,11 +368,13 @@ qx.Class.define("osparc.data.Resources", { endpoints: { getPageLatest: { method: "GET", - url: statics.API + "/computations/-/iterations/latest?offset={offset}&limit={limit}&order_by={orderBy}&filter_only_running={runningOnly}&filters={filters}" + // uncomment this when the backend supports filtering by runningOnly #8055 + // url: statics.API + "/computation-collection-runs?offset={offset}&limit={limit}&order_by={orderBy}&filter_only_running={runningOnly}" + url: statics.API + "/computation-collection-runs?offset={offset}&limit={limit}&order_by={orderBy}&filter_only_running=false" }, getPageHistory: { method: "GET", - url: statics.API + "/computations/{studyId}/iterations?offset={offset}&limit={limit}&order_by={orderBy}&include_children={includeChildren}" + url: statics.API + "/computation-collection-runs?offset={offset}&limit={limit}&order_by={orderBy}&filter_by_root_project_id={projectId}" }, } }, @@ -381,7 +383,7 @@ qx.Class.define("osparc.data.Resources", { endpoints: { getPageLatest: { method: "GET", - url: statics.API + "/computations/{studyId}/iterations/latest/tasks?offset={offset}&limit={limit}&order_by={orderBy}&include_children={includeChildren}" + url: statics.API + "/computation-collection-runs/{collectionRunId}/tasks?offset={offset}&limit={limit}&order_by={orderBy}" }, } }, diff --git a/services/static-webserver/client/source/class/osparc/data/SubJob.js b/services/static-webserver/client/source/class/osparc/data/SubJob.js index 9ee1f017463..862a89280a5 100644 --- a/services/static-webserver/client/source/class/osparc/data/SubJob.js +++ b/services/static-webserver/client/source/class/osparc/data/SubJob.js @@ -18,10 +18,11 @@ qx.Class.define("osparc.data.SubJob", { extend: qx.core.Object, - construct: function(subJobData) { + construct: function(collectionRunId, subJobData) { this.base(arguments); this.set({ + collectionRunId, projectUuid: subJobData["projectUuid"], nodeId: subJobData["nodeId"], }); @@ -30,6 +31,12 @@ qx.Class.define("osparc.data.SubJob", { }, properties: { + collectionRunId: { + check: "String", + nullable: false, + init: null, + }, + projectUuid: { check: "String", nullable: false, @@ -42,7 +49,7 @@ qx.Class.define("osparc.data.SubJob", { init: null, }, - nodeName: { + name: { check: "String", nullable: false, init: null, @@ -94,7 +101,7 @@ qx.Class.define("osparc.data.SubJob", { members: { updateSubJob: function(subJobData) { this.set({ - nodeName: subJobData["nodeName"], + name: subJobData["name"], state: subJobData["state"], progress: subJobData["progress"], startedAt: subJobData["startedAt"] ? new Date(subJobData["startedAt"]) : null, diff --git a/services/static-webserver/client/source/class/osparc/jobs/ActivityCenterWindow.js b/services/static-webserver/client/source/class/osparc/jobs/ActivityCenterWindow.js index d374a28f99b..ec1e3c85b71 100644 --- a/services/static-webserver/client/source/class/osparc/jobs/ActivityCenterWindow.js +++ b/services/static-webserver/client/source/class/osparc/jobs/ActivityCenterWindow.js @@ -59,8 +59,8 @@ qx.Class.define("osparc.jobs.ActivityCenterWindow", { runsBrowser.addListener("runSelected", e => { const data = e.getData(); - const project = data["rowData"]; - subRunsBrowser.setProject(project); + const collectionRunData = data["rowData"]; + subRunsBrowser.setCollectionRun(collectionRunData); this.getChildControl("title").setValue(this.tr("Tasks")); stack.setSelection([subRunsBrowser]); }); diff --git a/services/static-webserver/client/source/class/osparc/jobs/ActivityOverview.js b/services/static-webserver/client/source/class/osparc/jobs/ActivityOverview.js index 15681a8265b..a7253b0c66a 100644 --- a/services/static-webserver/client/source/class/osparc/jobs/ActivityOverview.js +++ b/services/static-webserver/client/source/class/osparc/jobs/ActivityOverview.js @@ -56,12 +56,12 @@ qx.Class.define("osparc.jobs.ActivityOverview", { this.__runsTable.addListener("runSelected", e => { const data = e.getData(); - const project = data["rowData"]; - const projectUuid = project["projectUuid"]; + const collectionRunData = data["rowData"]; + const collectionRunId = collectionRunData["collectionRunId"]; // Hacky-hacky for (let i=0; i i) { + if (rowData["collectionRunId"] === collectionRunId && data["rowIdx"] > i) { const msg = this.tr("Only the latest run's tasks are available"); osparc.FlashMessenger.logAs(msg, "WARNING"); return; @@ -72,7 +72,7 @@ qx.Class.define("osparc.jobs.ActivityOverview", { tasksLayout.remove(this.__subRunsTable); this.__subRunsTable = null; } - const subRunsTable = this.__subRunsTable = new osparc.jobs.SubRunsTable(project["projectUuid"]); + const subRunsTable = this.__subRunsTable = new osparc.jobs.SubRunsTable(collectionRunData["collectionRunId"]); tasksLayout.add(subRunsTable, { flex: 1 }); @@ -106,12 +106,11 @@ qx.Class.define("osparc.jobs.ActivityOverview", { runsHistoryLayout.add(introText); const projectUuid = projectData["uuid"]; - const includeChildren = true; const runningOnly = false; - const runsTable = this.__runsTable = new osparc.jobs.RunsTable(projectUuid, includeChildren, runningOnly); + const runsTable = this.__runsTable = new osparc.jobs.RunsTable(projectUuid, runningOnly); const columnModel = runsTable.getTableColumnModel(); // Hide project name column - columnModel.setColumnVisible(osparc.jobs.RunsTable.COLS.PROJECT_NAME.column, false); + columnModel.setColumnVisible(osparc.jobs.RunsTable.COLS.NAME.column, false); // Hide cancel column columnModel.setColumnVisible(osparc.jobs.RunsTable.COLS.ACTION_CANCEL.column, false); runsHistoryLayout.add(runsTable, { diff --git a/services/static-webserver/client/source/class/osparc/jobs/RunsBrowser.js b/services/static-webserver/client/source/class/osparc/jobs/RunsBrowser.js index 2636961004d..5e0bf883067 100644 --- a/services/static-webserver/client/source/class/osparc/jobs/RunsBrowser.js +++ b/services/static-webserver/client/source/class/osparc/jobs/RunsBrowser.js @@ -85,9 +85,8 @@ qx.Class.define("osparc.jobs.RunsBrowser", { break; case "runs-table": { const projectUuid = null; - const includeChildren = false; const runningOnly = true; - control = new osparc.jobs.RunsTable(projectUuid, includeChildren, runningOnly); + control = new osparc.jobs.RunsTable(projectUuid, runningOnly); control.addListener("runSelected", e => this.fireDataEvent("runSelected", e.getData())); this._add(control); break; diff --git a/services/static-webserver/client/source/class/osparc/jobs/RunsTable.js b/services/static-webserver/client/source/class/osparc/jobs/RunsTable.js index 78a5743bf94..2d0e5598071 100644 --- a/services/static-webserver/client/source/class/osparc/jobs/RunsTable.js +++ b/services/static-webserver/client/source/class/osparc/jobs/RunsTable.js @@ -19,16 +19,16 @@ qx.Class.define("osparc.jobs.RunsTable", { extend: qx.ui.table.Table, - construct: function(projectUuid = null, includeChildren = false, runningOnly = true) { + construct: function(projectId = null, runningOnly = true) { this.base(arguments); this.set({ - projectUuid, + projectId, runningOnly, }); - const model = new osparc.jobs.RunsTableModel(projectUuid, includeChildren); - this.bind("projectUuid", model, "projectUuid"); + const model = new osparc.jobs.RunsTableModel(projectId); + this.bind("projectId", model, "projectId"); this.bind("runningOnly", model, "runningOnly"); this.setTableModel(model); @@ -39,27 +39,47 @@ qx.Class.define("osparc.jobs.RunsTable", { }); const columnModel = this.getTableColumnModel(); - columnModel.setColumnVisible(this.self().COLS.PROJECT_UUID.column, false); + columnModel.setColumnVisible(this.self().COLS.COLLECTION_RUN_ID.column, false); + columnModel.setColumnVisible(this.self().COLS.PROJECT_IDS.column, false); Object.values(this.self().COLS).forEach(col => columnModel.setColumnWidth(col.column, col.width)); const iconPathStop = "osparc/icons/circle-xmark-text.svg"; - const fontButtonRendererStop = new osparc.ui.table.cellrenderer.ImageButtonRenderer("cancel", iconPathStop); + const shouldShowCancel = cellInfo => { + if (cellInfo && cellInfo.rowData && cellInfo.rowData["state"]) { + return [ + "Running", + ].includes(cellInfo.rowData["state"]); + } + return false; + } + const fontButtonRendererStop = new osparc.ui.table.cellrenderer.ImageButtonRenderer("cancel", iconPathStop, shouldShowCancel); columnModel.setDataCellRenderer(this.self().COLS.ACTION_CANCEL.column, fontButtonRendererStop); const iconPathInfo = "osparc/icons/circle-info-text.svg"; - const fontButtonRendererInfo = new osparc.ui.table.cellrenderer.ImageButtonRenderer("info", iconPathInfo); + const jobsStore =osparc.store.Jobs.getInstance(); + const shouldShowInfo = cellInfo => { + if (cellInfo && cellInfo.rowData && cellInfo.rowData["collectionRunId"]) { + const job = jobsStore.getJob(cellInfo.rowData["collectionRunId"]); + if (!job) { + return false; + } + return Object.keys(job.getInfo()).length > 0; + } + return false; + } + const fontButtonRendererInfo = new osparc.ui.table.cellrenderer.ImageButtonRenderer("info", iconPathInfo, shouldShowInfo); columnModel.setDataCellRenderer(this.self().COLS.ACTION_INFO.column, fontButtonRendererInfo); this.__attachHandlers(); }, properties: { - projectUuid: { + projectId: { check: "String", init: null, nullable: true, - event: "changeProjectUuid", + event: "changeProjectId", }, runningOnly: { @@ -76,54 +96,60 @@ qx.Class.define("osparc.jobs.RunsTable", { statics: { COLS: { - PROJECT_UUID: { - id: "projectUuid", + COLLECTION_RUN_ID: { + id: "collectionRunId", column: 0, - label: qx.locale.Manager.tr("Project Id"), + label: qx.locale.Manager.tr("Collection Run Id"), width: 200 }, - PROJECT_NAME: { - id: "projectName", + PROJECT_IDS: { + id: "projectIds", column: 1, - label: qx.locale.Manager.tr("Project"), + label: qx.locale.Manager.tr("Project Ids"), + width: 200 + }, + NAME: { + id: "name", + column: 2, + label: qx.locale.Manager.tr("Name"), width: 150, }, STATE: { id: "state", - column: 2, + column: 3, label: qx.locale.Manager.tr("Status"), width: 150, }, SUBMIT: { id: "submit", - column: 3, + column: 4, label: qx.locale.Manager.tr("Queued"), width: 130, sortableMap: "submitted_at", }, START: { id: "start", - column: 4, + column: 5, label: qx.locale.Manager.tr("Started"), width: 130, sortableMap: "started_at", }, END: { id: "end", - column: 5, + column: 6, label: qx.locale.Manager.tr("Ended"), width: 130, sortableMap: "ended_at", }, ACTION_CANCEL: { id: "action_cancel", - column: 6, + column: 7, label: qx.locale.Manager.tr("Cancel"), width: 50 }, ACTION_INFO: { id: "action_info", - column: 7, + column: 8, label: qx.locale.Manager.tr("Info"), width: 50 }, @@ -163,21 +189,18 @@ qx.Class.define("osparc.jobs.RunsTable", { const rowData = this.getTableModel().getRowData(row); switch (action) { case "info": { - const job = osparc.store.Jobs.getInstance().getJob(rowData["projectUuid"]); + const job = osparc.store.Jobs.getInstance().getJob(rowData["collectionRunId"]); if (!job) { return; } - const allInfo = { - "image": job.getInfo() ? osparc.utils.Utils.deepCloneObject(job.getInfo()) : {}, - "customMetadata": job.getCustomMetadata() ? osparc.utils.Utils.deepCloneObject(job.getCustomMetadata()) : {}, - } - const runInfo = new osparc.jobs.Info(allInfo); + const info = job.getInfo() ? osparc.utils.Utils.deepCloneObject(job.getInfo()) : {} + const runInfo = new osparc.jobs.Info(info); const win = osparc.jobs.Info.popUpInWindow(runInfo); - win.setCaption(rowData["projectName"]); + win.setCaption(rowData["name"]); break; } case "cancel": { - this.__cancelRun(rowData); + this.__cancelRunCollection(rowData); break; } default: @@ -185,8 +208,8 @@ qx.Class.define("osparc.jobs.RunsTable", { } }, - __cancelRun: function(rowData) { - const msg = this.tr("Are you sure you want to cancel") + " " + rowData["projectName"] + "?"; + __cancelRunCollection: function(rowData) { + const msg = this.tr("Are you sure you want to cancel") + " " + rowData["name"] + "?"; const confirmationWin = new osparc.ui.window.Confirmation(msg).set({ caption: this.tr("Cancel Run"), confirmText: this.tr("Cancel"), @@ -199,13 +222,17 @@ qx.Class.define("osparc.jobs.RunsTable", { confirmationWin.open(); confirmationWin.addListener("close", () => { if (confirmationWin.getConfirmed()) { - const params = { - url: { - "studyId": rowData["projectUuid"], - }, - }; - osparc.data.Resources.fetch("runPipeline", "stopPipeline", params) - .then(() => osparc.FlashMessenger.logAs(this.tr("Stopping pipeline"), "INFO")) + const promises = []; + rowData["projectIds"].forEach(projectId => { + const params = { + url: { + "studyId": projectId, + }, + }; + promises.push(osparc.data.Resources.fetch("runPipeline", "stopPipeline", params)) + }); + Promise.all(promises) + .then(() => osparc.FlashMessenger.logAs(this.tr("Stopping Run"), "INFO")) .catch(err => osparc.FlashMessenger.logError(err)); } }, this); diff --git a/services/static-webserver/client/source/class/osparc/jobs/RunsTableModel.js b/services/static-webserver/client/source/class/osparc/jobs/RunsTableModel.js index 1e620708b1b..8c260286360 100644 --- a/services/static-webserver/client/source/class/osparc/jobs/RunsTableModel.js +++ b/services/static-webserver/client/source/class/osparc/jobs/RunsTableModel.js @@ -19,13 +19,11 @@ qx.Class.define("osparc.jobs.RunsTableModel", { extend: qx.ui.table.model.Remote, - construct: function(projectUuid = null, includeChildren = false) { + construct: function(projectId = null) { this.base(arguments); - this.__includeChildren = includeChildren; - this.set({ - projectUuid, + projectId, }); const jobsCols = osparc.jobs.RunsTable.COLS; @@ -41,11 +39,11 @@ qx.Class.define("osparc.jobs.RunsTableModel", { }, properties: { - projectUuid: { + projectId: { check: "String", init: null, nullable: true, - event: "changeProjectUuid", + event: "changeProjectId", apply: "reloadData", }, @@ -80,8 +78,6 @@ qx.Class.define("osparc.jobs.RunsTableModel", { }, members: { - __includeChildren: null, - // overridden sortByColumn(columnIndex, ascending) { const jobsCols = osparc.jobs.RunsTable.COLS; @@ -100,8 +96,8 @@ qx.Class.define("osparc.jobs.RunsTableModel", { const orderBy = this.getOrderBy(); const resolveWResponse = true; let promise; - if (this.getProjectUuid()) { - promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.getProjectUuid(), this.__includeChildren, offset, limit, orderBy, resolveWResponse); + if (this.getProjectId()) { + promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.getProjectId(), offset, limit, orderBy, resolveWResponse); } else { const filters = this.getFilterString() ? { text: this.getFilterString() } : null; promise = osparc.store.Jobs.getInstance().fetchJobsLatest(this.getRunningOnly(), offset, limit, orderBy, filters, resolveWResponse); @@ -124,8 +120,8 @@ qx.Class.define("osparc.jobs.RunsTableModel", { const getFetchPromise = (offset, limit) => { const orderBy = this.getOrderBy(); let promise; - if (this.getProjectUuid()) { - promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.getProjectUuid(), this.__includeChildren, offset, limit, orderBy); + if (this.getProjectId()) { + promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.getProjectId(), offset, limit, orderBy); } else { const filters = this.getFilterString() ? { text: this.getFilterString() } : null; promise = osparc.store.Jobs.getInstance().fetchJobsLatest(this.getRunningOnly(), offset, limit, orderBy, filters); @@ -136,8 +132,9 @@ qx.Class.define("osparc.jobs.RunsTableModel", { const jobsCols = osparc.jobs.RunsTable.COLS; jobs.forEach(job => { data.push({ - [jobsCols.PROJECT_UUID.id]: job.getProjectUuid(), - [jobsCols.PROJECT_NAME.id]: job.getProjectName(), + [jobsCols.COLLECTION_RUN_ID.id]: job.getCollectionRunId(), + [jobsCols.PROJECT_IDS.id]: job.getProjectIds(), + [jobsCols.NAME.id]: job.getName(), [jobsCols.STATE.id]: osparc.data.Job.STATUS_LABELS[job.getState()] || job.getState(), [jobsCols.SUBMIT.id]: job.getSubmittedAt() ? osparc.utils.Utils.formatDateAndTime(job.getSubmittedAt()) : "-", [jobsCols.START.id]: job.getStartedAt() ? osparc.utils.Utils.formatDateAndTime(job.getStartedAt()) : "-", diff --git a/services/static-webserver/client/source/class/osparc/jobs/SubRunsBrowser.js b/services/static-webserver/client/source/class/osparc/jobs/SubRunsBrowser.js index 3a899d335ad..2fc4700524e 100644 --- a/services/static-webserver/client/source/class/osparc/jobs/SubRunsBrowser.js +++ b/services/static-webserver/client/source/class/osparc/jobs/SubRunsBrowser.js @@ -66,15 +66,15 @@ qx.Class.define("osparc.jobs.SubRunsBrowser", { return titleLayout; }, - setProject: function(project) { + setCollectionRun: function(collectionRunData) { if (this.__subRunsTable) { this._remove(this.__subRunsTable); this.__subRunsTable = null; } - this.__titleLabel.setValue(project["projectName"]) + this.__titleLabel.setValue(collectionRunData["name"]) - const subRunsTable = this.__subRunsTable = new osparc.jobs.SubRunsTable(project["projectUuid"]); + const subRunsTable = this.__subRunsTable = new osparc.jobs.SubRunsTable(collectionRunData["collectionRunId"]); this._add(subRunsTable, { flex: 1 }); diff --git a/services/static-webserver/client/source/class/osparc/jobs/SubRunsTable.js b/services/static-webserver/client/source/class/osparc/jobs/SubRunsTable.js index aabc10d4771..a461892a685 100644 --- a/services/static-webserver/client/source/class/osparc/jobs/SubRunsTable.js +++ b/services/static-webserver/client/source/class/osparc/jobs/SubRunsTable.js @@ -19,10 +19,10 @@ qx.Class.define("osparc.jobs.SubRunsTable", { extend: qx.ui.table.Table, - construct: function(projectUuid) { + construct: function(collectionRunId) { this.base(arguments); - const model = new osparc.jobs.SubRunsTableModel(projectUuid); + const model = new osparc.jobs.SubRunsTableModel(collectionRunId); this.setTableModel(model); this.set({ @@ -32,7 +32,7 @@ qx.Class.define("osparc.jobs.SubRunsTable", { }); const columnModel = this.getTableColumnModel(); - columnModel.setColumnVisible(this.self().COLS.PROJECT_UUID.column, false); + columnModel.setColumnVisible(this.self().COLS.COLLECTION_RUN_ID.column, false); columnModel.setColumnVisible(this.self().COLS.NODE_ID.column, false); Object.values(this.self().COLS).forEach(col => columnModel.setColumnWidth(col.column, col.width)); @@ -50,10 +50,10 @@ qx.Class.define("osparc.jobs.SubRunsTable", { statics: { COLS: { - PROJECT_UUID: { - id: "projectUuid", + COLLECTION_RUN_ID: { + id: "collectionRunId", column: 0, - label: qx.locale.Manager.tr("Project Id"), + label: qx.locale.Manager.tr("Collection Run Id"), width: 200 }, NODE_ID: { @@ -62,10 +62,10 @@ qx.Class.define("osparc.jobs.SubRunsTable", { label: qx.locale.Manager.tr("Node Id"), width: 200 }, - NODE_NAME: { - id: "nodeName", + NAME: { + id: "name", column: 2, - label: qx.locale.Manager.tr("Node"), + label: qx.locale.Manager.tr("Name"), width: 100 }, APP: { @@ -152,7 +152,7 @@ qx.Class.define("osparc.jobs.SubRunsTable", { const rowData = this.getTableModel().getRowData(row); switch (action) { case "info": { - const job = osparc.store.Jobs.getInstance().getJob(rowData["projectUuid"]); + const job = osparc.store.Jobs.getInstance().getJob(rowData["collectionRunId"]); if (!job) { return; } @@ -162,11 +162,11 @@ qx.Class.define("osparc.jobs.SubRunsTable", { } const jobInfo = new osparc.jobs.Info(subJob.getImage()); const win = osparc.jobs.Info.popUpInWindow(jobInfo); - win.setCaption(rowData["nodeName"]); + win.setCaption(rowData["name"]); break; } case "logs": { - const job = osparc.store.Jobs.getInstance().getJob(rowData["projectUuid"]); + const job = osparc.store.Jobs.getInstance().getJob(rowData["collectionRunId"]); if (!job) { return; } @@ -176,7 +176,7 @@ qx.Class.define("osparc.jobs.SubRunsTable", { } const logDownloadLink = subJob.getLogDownloadLink() if (logDownloadLink) { - osparc.utils.Utils.downloadLink(logDownloadLink, "GET", rowData["nodeName"] + ".zip"); + osparc.utils.Utils.downloadLink(logDownloadLink, "GET", rowData["name"] + ".zip"); } else { osparc.FlashMessenger.logAs(this.tr("No logs available"), "WARNING"); } diff --git a/services/static-webserver/client/source/class/osparc/jobs/SubRunsTableModel.js b/services/static-webserver/client/source/class/osparc/jobs/SubRunsTableModel.js index 58ad6040cfb..56ec069ff28 100644 --- a/services/static-webserver/client/source/class/osparc/jobs/SubRunsTableModel.js +++ b/services/static-webserver/client/source/class/osparc/jobs/SubRunsTableModel.js @@ -19,7 +19,7 @@ qx.Class.define("osparc.jobs.SubRunsTableModel", { extend: qx.ui.table.model.Remote, - construct: function(projectUuid) { + construct: function(collectionRunId) { this.base(arguments); const subJobsCols = osparc.jobs.SubRunsTable.COLS; @@ -33,11 +33,11 @@ qx.Class.define("osparc.jobs.SubRunsTableModel", { this.setColumnSortable(col.column, Boolean(col.sortableMap)); }); - this.setProjectUuid(projectUuid); + this.setCollectionRunId(collectionRunId); }, properties: { - projectUuid: { + collectionRunId: { check: "String", nullable: true, }, @@ -71,7 +71,7 @@ qx.Class.define("osparc.jobs.SubRunsTableModel", { // overridden _loadRowCount() { - osparc.store.Jobs.getInstance().fetchSubJobs(this.getProjectUuid(), this.getOrderBy()) + osparc.store.Jobs.getInstance().fetchSubJobs(this.getCollectionRunId(), this.getOrderBy()) .then(subJobs => { this._onRowCountLoaded(subJobs.length) }) @@ -87,7 +87,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(), this.getOrderBy()) + return osparc.store.Jobs.getInstance().fetchSubJobs(this.getCollectionRunId(), this.getOrderBy()) .then(subJobs => { const data = []; const subJobsCols = osparc.jobs.SubRunsTable.COLS; @@ -111,9 +111,9 @@ qx.Class.define("osparc.jobs.SubRunsTableModel", { duration = `${String(diffHours).padStart(2, "0")}:${String(diffMinutes).padStart(2, "0")}:${String(diffSeconds).padStart(2, "0")}`; } data.push({ - [subJobsCols.PROJECT_UUID.id]: subJob.getProjectUuid(), + [subJobsCols.COLLECTION_RUN_ID.id]: subJob.getCollectionRunId(), [subJobsCols.NODE_ID.id]: subJob.getNodeId(), - [subJobsCols.NODE_NAME.id]: subJob.getNodeName(), + [subJobsCols.NAME.id]: subJob.getName(), [subJobsCols.APP.id]: appName + ":" + displayVersion, [subJobsCols.STATE.id]: osparc.data.Job.STATUS_LABELS[subJob.getState()] || subJob.getState(), [subJobsCols.PROGRESS.id]: subJob.getProgress() * 100 + "%", diff --git a/services/static-webserver/client/source/class/osparc/store/Jobs.js b/services/static-webserver/client/source/class/osparc/store/Jobs.js index a6fc8d0b752..b3c88476c53 100644 --- a/services/static-webserver/client/source/class/osparc/store/Jobs.js +++ b/services/static-webserver/client/source/class/osparc/store/Jobs.js @@ -73,8 +73,7 @@ qx.Class.define("osparc.store.Jobs", { }, fetchJobsHistory: function( - studyId, - includeChildren = false, + projectId, offset = 0, limit = this.self().SERVER_MAX_LIMIT, orderBy = { @@ -85,8 +84,7 @@ qx.Class.define("osparc.store.Jobs", { ) { const params = { url: { - studyId, - includeChildren, + projectId, offset, limit, orderBy: JSON.stringify(orderBy), @@ -113,7 +111,7 @@ qx.Class.define("osparc.store.Jobs", { }, fetchSubJobs: function( - projectUuid, + collectionRunId, orderBy = { field: "started_at", direction: "desc" @@ -121,16 +119,15 @@ qx.Class.define("osparc.store.Jobs", { ) { const params = { url: { - studyId: projectUuid, + collectionRunId, orderBy: JSON.stringify(orderBy), - includeChildren: false, } }; return osparc.data.Resources.getInstance().getAllPages("subRuns", params, "getPageLatest") .then(subJobsData => { const subJobs = []; subJobsData.forEach(subJobData => { - subJobs.push(this.addSubJob(subJobData)); + subJobs.push(this.addSubJob(collectionRunId, subJobData)); }); return subJobs; }) @@ -139,7 +136,7 @@ qx.Class.define("osparc.store.Jobs", { __addJob: function(jobData) { const jobs = this.getJobs(); - const jobFound = jobs.find(job => job.getProjectUuid() === jobData["projectUuid"]); + const jobFound = jobs.find(job => job.getCollectionRunId() === jobData["collectionRunId"]); if (jobFound) { jobFound.updateJob(jobData); return jobFound; @@ -149,22 +146,22 @@ qx.Class.define("osparc.store.Jobs", { return job; }, - addSubJob: function(subJobData) { - let job = this.getJob(subJobData["projectUuid"]); + addSubJob: function(collectionRunId, subJobData) { + let job = this.getJob(collectionRunId); if (!job) { const jobs = this.getJobs(); job = new osparc.data.Job({ - "projectUuid": subJobData["projectUuid"], + collectionRunId, }); jobs.push(job); } - const subJob = job.addSubJob(subJobData); + const subJob = job.addSubJob(collectionRunId, subJobData); return subJob; }, - getJob: function(projectUuid) { + getJob: function(collectionRunId) { const jobs = this.getJobs(); - return jobs.find(job => job.getProjectUuid() === projectUuid); + return jobs.find(job => job.getCollectionRunId() === collectionRunId); }, } }); diff --git a/services/static-webserver/client/source/class/osparc/ui/table/cellrenderer/ImageButtonRenderer.js b/services/static-webserver/client/source/class/osparc/ui/table/cellrenderer/ImageButtonRenderer.js index 43cfd6b8b05..640709ad724 100644 --- a/services/static-webserver/client/source/class/osparc/ui/table/cellrenderer/ImageButtonRenderer.js +++ b/services/static-webserver/client/source/class/osparc/ui/table/cellrenderer/ImageButtonRenderer.js @@ -18,10 +18,11 @@ qx.Class.define("osparc.ui.table.cellrenderer.ImageButtonRenderer", { extend: osparc.ui.table.cellrenderer.ButtonRenderer, - construct: function(clickAction, iconPath) { + construct: function(clickAction, iconPath, shouldShowFn = null) { this.base(arguments, clickAction); this.__imageCache = {}; + this.__shouldShowFn = shouldShowFn; this.setIconPath(iconPath); }, @@ -37,6 +38,20 @@ qx.Class.define("osparc.ui.table.cellrenderer.ImageButtonRenderer", { members: { __imageCache: null, + __shouldShowFn: null, + + // overridden to play with it's visibility + createDataCellHtml: function(cellInfo, htmlArr) { + const shouldShow = this.__shouldShowFn + ? + this.__shouldShowFn(cellInfo) + : + true; + if (!shouldShow) { + return ""; // Hide button + } + return this.base(arguments, cellInfo, htmlArr); + }, __applyIconPath: function(iconPath) { const resMgr = qx.util.ResourceManager.getInstance();