From 23304f4f16f30d9d756c289ace2d5d523d14ed80 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 11:11:30 +0200 Subject: [PATCH 01/16] sorting values added --- .../source/class/osparc/utils/Services.js | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/services/web/client/source/class/osparc/utils/Services.js b/services/web/client/source/class/osparc/utils/Services.js index 879d998061d..f467a02310f 100644 --- a/services/web/client/source/class/osparc/utils/Services.js +++ b/services/web/client/source/class/osparc/utils/Services.js @@ -33,21 +33,25 @@ qx.Class.define("osparc.utils.Services", { statics: { TYPES: { - computational: { - label: "Computational", - icon: "@FontAwesome5Solid/cogs/" - }, - dynamic: { - label: "Interactive", - icon: "@FontAwesome5Solid/mouse-pointer/" - }, parameter: { label: "", - icon: "@FontAwesome5Solid/sliders-h/" + icon: "@FontAwesome5Solid/sliders-h/", + sorting: 0 }, file: { label: "", - icon: "@FontAwesome5Solid/file/" + icon: "@FontAwesome5Solid/file/", + sorting: 1 + }, + computational: { + label: "Computational", + icon: "@FontAwesome5Solid/cogs/", + sorting: 2 + }, + dynamic: { + label: "Interactive", + icon: "@FontAwesome5Solid/mouse-pointer/", + sorting: 3 } }, @@ -79,6 +83,14 @@ qx.Class.define("osparc.utils.Services", { return typeInfo[""]; }, + getSorting(type) { + const typeInfo = this.getType(type); + if (typeInfo) { + return typeInfo["sorting"]; + } + return 0; + }, + convertArrayToObject: function(servicesArray) { let services = {}; for (let i = 0; i < servicesArray.length; i++) { From c951159346f0070f17039b7128783922b4e31338 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 11:12:53 +0200 Subject: [PATCH 02/16] [skip ci] sort nodes --- .../osparc/component/widget/NodesTree.js | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesTree.js b/services/web/client/source/class/osparc/component/widget/NodesTree.js index 0e602e768e2..4bdf355ba0b 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -65,21 +65,29 @@ qx.Class.define("osparc.component.widget.NodesTree", { }, statics: { + getSortingValue: function(node) { + if (node.isFilePicker()) { + return osparc.utils.Services.getSorting("file"); + } else if (node.isParameter()) { + return osparc.utils.Services.getSorting("parameter"); + } + return osparc.utils.Services.getSorting(node.getMetaData().type); + }, + convertModel: function(nodes) { - let children = []; + const children = []; for (let nodeId in nodes) { const node = nodes[nodeId]; - let nodeInTree = { - label: "", - nodeId: node.getNodeId() + const nodeInTree = { + label: node.getLabel(), + children: node.isContainer() ? this.convertModel(node.getInnerNodes()) : [], + isContainer: node.isContainer(), + nodeId: node.getNodeId(), + sortingValue: this.self().getSortingValue(node) }; - nodeInTree.label = node.getLabel(); - nodeInTree.isContainer = node.isContainer(); - if (node.isContainer()) { - nodeInTree.children = this.convertModel(node.getInnerNodes()); - } children.push(nodeInTree); } + children.sort((firstEl, secondEl) => firstEl.sortingValue - secondEl.sortingValue); return children; } }, @@ -111,11 +119,12 @@ qx.Class.define("osparc.component.widget.NodesTree", { populateTree: function() { const study = this.getStudy(); const topLevelNodes = study.getWorkbench().getNodes(); - let data = { + const data = { label: study.getName(), children: this.self().convertModel(topLevelNodes), + isContainer: true, nodeId: study.getUuid(), - isContainer: true + sortingValue: 0 }; let newModel = qx.data.marshal.Json.createModel(data, true); let oldModel = this.getModel(); From 9dffbccee32601180634d2557aa6c73d05dc11db Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 11:26:50 +0200 Subject: [PATCH 03/16] refactoring --- .../osparc/component/workbench/WorkbenchUI.js | 56 ++++++++----------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js b/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js index 0a98c3b9d75..93e9a96ee47 100644 --- a/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js +++ b/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js @@ -314,13 +314,29 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", { return inputOutputNodesLayout; }, - __createServiceCatalog: function(winPos) { + createServiceCatalog: function(winPos, nodePos) { const srvCat = new osparc.component.workbench.ServiceCatalog(); const maxLeft = this.getBounds().width - osparc.component.workbench.ServiceCatalog.Width; const maxHeight = this.getBounds().height - osparc.component.workbench.ServiceCatalog.Height; const posX = Math.min(winPos.x, maxLeft); const posY = Math.min(winPos.y, maxHeight); srvCat.moveTo(posX + this.__getLeftOffset(), posY + this.__getTopOffset()); + srvCat.addListener("addService", e => { + const { + service, + nodeLeftId, + nodeRightId + } = e.getData(); + const newNodeUI = this.__addNode(service, nodePos); + if (nodeLeftId !== null || nodeRightId !== null) { + const newNodeId = newNodeUI.getNodeId(); + this._createEdgeBetweenNodes({ + nodeId: nodeLeftId ? nodeLeftId : newNodeId + }, { + nodeId: nodeRightId ? nodeRightId : newNodeId + }); + } + }, this); return srvCat; }, @@ -681,31 +697,9 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", { if (this.__tempEdgeNodeId === dragNodeId) { const winPos = this.__unscaleCoordinates(this.__pointerPos.x, this.__pointerPos.y); - const srvCat = this.__createServiceCatalog(winPos); - if (this.__tempEdgeIsInput === true) { - srvCat.setContext(null, dragNodeId); - } else { - srvCat.setContext(dragNodeId, null); - } - srvCat.addListener("addService", ev => { - const { - service, - nodeLeftId, - nodeRightId - } = ev.getData(); - const newNodeUI = this.__addNode(service, this.__pointerPos); - if (nodeLeftId !== null || nodeRightId !== null) { - const newNodeId = newNodeUI.getNodeId(); - this._createEdgeBetweenNodes({ - nodeId: nodeLeftId ? nodeLeftId : newNodeId - }, { - nodeId: nodeRightId ? nodeRightId : newNodeId - }); - } - }, this); - srvCat.addListener("close", () => { - this.__removeTempEdge(); - }, this); + const srvCat = this.createServiceCatalog(winPos, this.__pointerPos); + this.__tempEdgeIsInput === true ? srvCat.setContext(null, dragNodeId) : srvCat.setContext(dragNodeId, null); + srvCat.addListener("close", () => this.__removeTempEdge(), this); srvCat.open(); } qx.bom.Element.removeListener( @@ -1315,14 +1309,8 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", { return; } const winPos = this.__pointerEventToWorkbenchPos(pointerEvent, false); - const scaledPos = this.__pointerEventToWorkbenchPos(pointerEvent, true); - const srvCat = this.__createServiceCatalog(winPos); - srvCat.addListener("addService", e => { - const { - service - } = e.getData(); - this.__addNode(service, scaledPos); - }, this); + const nodePos = this.__pointerEventToWorkbenchPos(pointerEvent, true); + const srvCat = this.createServiceCatalog(winPos, nodePos); srvCat.open(); }, this); From f09a4d999fc1319dd8234f2ce7f5d1bd2bb08cc7 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 11:40:01 +0200 Subject: [PATCH 04/16] [skip ci] addNewNodeBtn --- .../osparc/component/workbench/WorkbenchUI.js | 21 ++++++++++--------- .../class/osparc/desktop/WorkbenchView.js | 18 +++++++++++----- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js b/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js index 93e9a96ee47..021f7965cdd 100644 --- a/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js +++ b/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js @@ -314,12 +314,12 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", { return inputOutputNodesLayout; }, - createServiceCatalog: function(winPos, nodePos) { + openServiceCatalog: function(winPos, nodePos) { const srvCat = new osparc.component.workbench.ServiceCatalog(); const maxLeft = this.getBounds().width - osparc.component.workbench.ServiceCatalog.Width; const maxHeight = this.getBounds().height - osparc.component.workbench.ServiceCatalog.Height; - const posX = Math.min(winPos.x, maxLeft); - const posY = Math.min(winPos.y, maxHeight); + const posX = winPos ? Math.min(winPos.x, maxLeft) : 100; + const posY = winPos ? Math.min(winPos.y, maxHeight) : 100; srvCat.moveTo(posX + this.__getLeftOffset(), posY + this.__getTopOffset()); srvCat.addListener("addService", e => { const { @@ -337,6 +337,7 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", { }); } }, this); + srvCat.open(); return srvCat; }, @@ -388,9 +389,11 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", { }, _addNodeUIToWorkbench: function(nodeUI, position) { - if (!("x" in position) || isNaN(position["x"]) || position["x"] < 0) { - console.error("not a valid position"); - return; + if (position === undefined || !("x" in position) || isNaN(position["x"]) || position["x"] < 0) { + position = { + x: 10, + y: 10 + }; } this.__updateWorkbenchLayoutSize(position); @@ -697,10 +700,9 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", { if (this.__tempEdgeNodeId === dragNodeId) { const winPos = this.__unscaleCoordinates(this.__pointerPos.x, this.__pointerPos.y); - const srvCat = this.createServiceCatalog(winPos, this.__pointerPos); + const srvCat = this.openServiceCatalog(winPos, this.__pointerPos); this.__tempEdgeIsInput === true ? srvCat.setContext(null, dragNodeId) : srvCat.setContext(dragNodeId, null); srvCat.addListener("close", () => this.__removeTempEdge(), this); - srvCat.open(); } qx.bom.Element.removeListener( this.__desktop, @@ -1310,8 +1312,7 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", { } const winPos = this.__pointerEventToWorkbenchPos(pointerEvent, false); const nodePos = this.__pointerEventToWorkbenchPos(pointerEvent, true); - const srvCat = this.createServiceCatalog(winPos, nodePos); - srvCat.open(); + this.openServiceCatalog(winPos, nodePos); }, this); this.__workbenchLayout.addListener("resize", () => this.__updateHint(), this); diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index eec20ab0544..6ba3ea013f6 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -260,7 +260,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", { const topBar = tabViewPrimary.getChildControl("bar"); this.__addTopBarSpacer(topBar); - const homeAndNodesTree = new qx.ui.container.Composite(new qx.ui.layout.VBox(0)).set({ + const homeAndNodesTree = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)).set({ backgroundColor: primaryColumnBGColor }); @@ -268,8 +268,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", { alignY: "middle", minHeight: 32, maxHeight: 32, - backgroundColor: primaryColumnBGColor, - marginBottom: 5 + backgroundColor: primaryColumnBGColor }); studyTreeItem.setStudy(study); homeAndNodesTree.add(studyTreeItem); @@ -279,9 +278,18 @@ qx.Class.define("osparc.desktop.WorkbenchView", { hideRoot: true }); nodesTree.setStudy(study); - homeAndNodesTree.add(nodesTree, { - flex: 1 + homeAndNodesTree.add(nodesTree); + + const addNewNodeBtn = new qx.ui.form.Button().set({ + label: this.tr("Add new node"), + icon: "@FontAwesome5Solid/plus/14", + allowGrowX: false, + alignX: "left", + marginLeft: 10 }); + addNewNodeBtn.addListener("execute", () => this.__workbenchUI.openServiceCatalog()); + homeAndNodesTree.add(addNewNodeBtn); + const nodesPage = this.__createTabPage("@FontAwesome5Solid/list", this.tr("Nodes"), homeAndNodesTree, primaryColumnBGColor); tabViewPrimary.add(nodesPage); From 5372ab245f8122ed4c506a774d21b0bf4fe60b77 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 15:50:40 +0200 Subject: [PATCH 05/16] [skip ci] minor --- .../web/client/source/class/osparc/desktop/WorkbenchView.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index 6ba3ea013f6..c8f93a0332b 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -278,7 +278,9 @@ qx.Class.define("osparc.desktop.WorkbenchView", { hideRoot: true }); nodesTree.setStudy(study); - homeAndNodesTree.add(nodesTree); + homeAndNodesTree.add(nodesTree, { + flex: 1 + }); const addNewNodeBtn = new qx.ui.form.Button().set({ label: this.tr("Add new node"), From ab40f9b0a0df44e5c686ed52e6e7d2b6cb387a9b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 15:55:49 +0200 Subject: [PATCH 06/16] [skip ci] Bind node's running state to its icon color --- .../source/class/osparc/component/widget/NodesTree.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesTree.js b/services/web/client/source/class/osparc/component/widget/NodesTree.js index 4bdf355ba0b..021d7a67207 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -153,9 +153,6 @@ qx.Class.define("osparc.component.widget.NodesTree", { item.getChildControl("options-delete-button").exclude(); } if (node) { - if (node.isDynamic()) { - item.getChildControl("fullscreen-button").show(); - } if (node.isFilePicker()) { const icon = osparc.utils.Services.getIcon("file"); item.setIcon(icon+"14"); @@ -163,10 +160,16 @@ qx.Class.define("osparc.component.widget.NodesTree", { const icon = osparc.utils.Services.getIcon("parameter"); item.setIcon(icon+"14"); } else { + if (node.isDynamic()) { + item.getChildControl("fullscreen-button").show(); + } const icon = osparc.utils.Services.getIcon(node.getMetaData().type); if (icon) { item.setIcon(icon+"14"); } + node.getStatus().bind("running", item.getChildControl("icon"), "textColor", { + converter: output => osparc.utils.StatusUI.getColor(output) + }, this); } } }, From 3249ef77549610a4afec4e8360bb695224f27fef Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 17:19:21 +0200 Subject: [PATCH 07/16] coloring nodes --- .../source/class/osparc/component/widget/NodesTree.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesTree.js b/services/web/client/source/class/osparc/component/widget/NodesTree.js index 021d7a67207..c22585fe514 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -162,14 +162,18 @@ qx.Class.define("osparc.component.widget.NodesTree", { } else { if (node.isDynamic()) { item.getChildControl("fullscreen-button").show(); + node.getStatus().bind("interactive", item.getChildControl("icon"), "textColor", { + converter: output => osparc.utils.StatusUI.getColor(output) + }, this); + } else if (node.isComputational()) {{ + node.getStatus().bind("running", item.getChildControl("icon"), "textColor", { + converter: output => osparc.utils.StatusUI.getColor(output) + }, this); } const icon = osparc.utils.Services.getIcon(node.getMetaData().type); if (icon) { item.setIcon(icon+"14"); } - node.getStatus().bind("running", item.getChildControl("icon"), "textColor", { - converter: output => osparc.utils.StatusUI.getColor(output) - }, this); } } }, From b39c2a0693823559f7d0c1c2dce72d88f02ff128 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 17:19:51 +0200 Subject: [PATCH 08/16] decorating slider --- .../class/osparc/desktop/WorkbenchView.js | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index c8f93a0332b..27567b49101 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -27,6 +27,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", { this.setOffset(2); osparc.desktop.WorkbenchView.decorateSplitter(this.getChildControl("splitter")); + osparc.desktop.WorkbenchView.decorateSlider(this.getChildControl("slider")); this.__sidePanels = this.getChildControl("side-panels"); this.getChildControl("main-panel-tabs"); @@ -40,14 +41,24 @@ qx.Class.define("osparc.desktop.WorkbenchView", { TAB_BUTTON_HEIGHT: 50, decorateSplitter: function(splitter) { - splitter.setWidth(2); const colorManager = qx.theme.manager.Color.getInstance(); const binaryColor = osparc.utils.Utils.getRoundedBinaryColor(colorManager.resolve("background-main")); - splitter.setBackgroundColor(binaryColor); + splitter.set({ + width: 2, + backgroundColor: binaryColor + }); colorManager.addListener("changeTheme", () => { const newBinaryColor = osparc.utils.Utils.getRoundedBinaryColor(colorManager.resolve("background-main")); splitter.setBackgroundColor(newBinaryColor); }, this); + }, + + decorateSlider: function(slider) { + slider.set({ + width: 2, + backgroundColor: "#007fd4", // Visual Studio blue + opacity: 1 + }); } }, @@ -88,6 +99,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", { width: Math.min(parseInt(window.innerWidth * (0.16+0.24)), 550) }); osparc.desktop.WorkbenchView.decorateSplitter(control.getChildControl("splitter")); + osparc.desktop.WorkbenchView.decorateSlider(control.getChildControl("slider")); this.add(control, 0); // flex 0 break; } @@ -314,6 +326,10 @@ qx.Class.define("osparc.desktop.WorkbenchView", { const topBar = tabViewSecondary.getChildControl("bar"); this.__addTopBarSpacer(topBar); + const studyOptionsPage = this.__studyOptionsPage = this.__createTabPage("@FontAwesome5Solid/book", this.tr("Study options")); + studyOptionsPage.exclude(); + tabViewSecondary.add(studyOptionsPage); + const infoPage = this.__infoPage = this.__createTabPage("@FontAwesome5Solid/info", this.tr("Information")); infoPage.exclude(); tabViewSecondary.add(infoPage); @@ -690,12 +706,15 @@ qx.Class.define("osparc.desktop.WorkbenchView", { }, __populateSecondPanel: function(node) { - this.__infoPage.removeAll(); - this.__settingsPage.removeAll(); - this.__outputsPage.removeAll(); - this.__infoPage.getChildControl("button").exclude(); - this.__settingsPage.getChildControl("button").exclude(); - this.__outputsPage.getChildControl("button").exclude(); + [ + this.__studyOptionsPage, + this.__infoPage, + this.__settingsPage, + this.__outputsPage + ].forEach(page => { + page.removeAll(); + page.getChildControl("button").exclude(); + }); if (node instanceof osparc.data.model.Study) { this.__populateSecondPanelStudy(node); @@ -709,10 +728,10 @@ qx.Class.define("osparc.desktop.WorkbenchView", { }, __populateSecondPanelStudy: function(study) { - this.__infoPage.getChildControl("button").show(); - this.getChildControl("side-panel-right-tabs").setSelection([this.__infoPage]); + this.__studyOptionsPage.getChildControl("button").show(); + this.getChildControl("side-panel-right-tabs").setSelection([this.__studyOptionsPage]); - this.__infoPage.add(new osparc.studycard.Medium(study), { + this.__studyOptionsPage.add(new osparc.studycard.Medium(study), { flex: 1 }); }, From 93ec1c2aafe1d3a9ae591e55911e160262ef6022 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 17:33:40 +0200 Subject: [PATCH 09/16] [skip ci] minor --- .../client/source/class/osparc/component/widget/NodesTree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesTree.js b/services/web/client/source/class/osparc/component/widget/NodesTree.js index c22585fe514..b8c14767fa4 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -165,7 +165,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { node.getStatus().bind("interactive", item.getChildControl("icon"), "textColor", { converter: output => osparc.utils.StatusUI.getColor(output) }, this); - } else if (node.isComputational()) {{ + } else if (node.isComputational()) { node.getStatus().bind("running", item.getChildControl("icon"), "textColor", { converter: output => osparc.utils.StatusUI.getColor(output) }, this); From 4c06c19cba0bce52f2563317a218a7542bfe3af6 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 17:37:19 +0200 Subject: [PATCH 10/16] [skip ci] cleanup --- .../osparc/component/widget/NodesTree.js | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesTree.js b/services/web/client/source/class/osparc/component/widget/NodesTree.js index b8c14767fa4..496dbe79fef 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -143,16 +143,15 @@ qx.Class.define("osparc.component.widget.NodesTree", { bindItem: (c, item, id) => { c.bindDefaultProperties(item, id); c.bindProperty("nodeId", "nodeId", null, item, id); - const node = study.getWorkbench().getNode(item.getModel().getNodeId()); - if (node) { - node.bind("label", item.getModel(), "label"); - } c.bindProperty("label", "label", null, item, id); + const node = study.getWorkbench().getNode(item.getModel().getNodeId()); if (item.getModel().getNodeId() === study.getUuid()) { item.setIcon("@FontAwesome5Solid/home/14"); item.getChildControl("options-delete-button").exclude(); - } - if (node) { + } else if (node) { + node.bind("label", item.getModel(), "label"); + + // set icon if (node.isFilePicker()) { const icon = osparc.utils.Services.getIcon("file"); item.setIcon(icon+"14"); @@ -160,21 +159,28 @@ qx.Class.define("osparc.component.widget.NodesTree", { const icon = osparc.utils.Services.getIcon("parameter"); item.setIcon(icon+"14"); } else { - if (node.isDynamic()) { - item.getChildControl("fullscreen-button").show(); - node.getStatus().bind("interactive", item.getChildControl("icon"), "textColor", { - converter: output => osparc.utils.StatusUI.getColor(output) - }, this); - } else if (node.isComputational()) { - node.getStatus().bind("running", item.getChildControl("icon"), "textColor", { - converter: output => osparc.utils.StatusUI.getColor(output) - }, this); - } const icon = osparc.utils.Services.getIcon(node.getMetaData().type); if (icon) { item.setIcon(icon+"14"); } } + + // bind running/interactive status to icon color + if (node.isDynamic()) { + item.getChildControl("fullscreen-button").show(); + node.getStatus().bind("interactive", item.getChildControl("icon"), "textColor", { + converter: output => osparc.utils.StatusUI.getColor(output) + }, this); + } else if (node.isComputational()) { + node.getStatus().bind("running", item.getChildControl("icon"), "textColor", { + converter: output => osparc.utils.StatusUI.getColor(output) + }, this); + } + + // add fullscreen + if (node.isDynamic()) { + item.getChildControl("fullscreen-button").show(); + } } }, configureItem: item => { From be99d749fff1657ae115e785c6b0555360aebec3 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 18:07:03 +0200 Subject: [PATCH 11/16] last cosmetics --- .../class/osparc/component/widget/NodesTree.js | 1 + .../source/class/osparc/desktop/WorkbenchView.js | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesTree.js b/services/web/client/source/class/osparc/component/widget/NodesTree.js index 496dbe79fef..21203ebef25 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -190,6 +190,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { }, this); } }); + this.setHeight(newModel.getChildren().length*21 + 5); } }, diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index 27567b49101..2b916e4ac15 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -272,7 +272,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", { const topBar = tabViewPrimary.getChildControl("bar"); this.__addTopBarSpacer(topBar); - const homeAndNodesTree = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)).set({ + const homeAndNodesTree = new qx.ui.container.Composite(new qx.ui.layout.VBox(15)).set({ backgroundColor: primaryColumnBGColor }); @@ -287,19 +287,19 @@ qx.Class.define("osparc.desktop.WorkbenchView", { const nodesTree = this.__nodesTree = new osparc.component.widget.NodesTree().set({ backgroundColor: primaryColumnBGColor, - hideRoot: true + hideRoot: true, + allowGrowY: true, + minHeight: 5 }); nodesTree.setStudy(study); - homeAndNodesTree.add(nodesTree, { - flex: 1 - }); + homeAndNodesTree.add(nodesTree); const addNewNodeBtn = new qx.ui.form.Button().set({ label: this.tr("Add new node"), icon: "@FontAwesome5Solid/plus/14", allowGrowX: false, alignX: "left", - marginLeft: 10 + marginLeft: 14 }); addNewNodeBtn.addListener("execute", () => this.__workbenchUI.openServiceCatalog()); homeAndNodesTree.add(addNewNodeBtn); From 2c0fd5a51245de7b55c9b40ccbcf08ae7b7a227c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 27 Oct 2021 19:09:08 +0200 Subject: [PATCH 12/16] minor --- .../client/source/class/osparc/component/widget/NodesTree.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesTree.js b/services/web/client/source/class/osparc/component/widget/NodesTree.js index 21203ebef25..28ca338636c 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -167,13 +167,12 @@ qx.Class.define("osparc.component.widget.NodesTree", { // bind running/interactive status to icon color if (node.isDynamic()) { - item.getChildControl("fullscreen-button").show(); node.getStatus().bind("interactive", item.getChildControl("icon"), "textColor", { - converter: output => osparc.utils.StatusUI.getColor(output) + converter: status => osparc.utils.StatusUI.getColor(status) }, this); } else if (node.isComputational()) { node.getStatus().bind("running", item.getChildControl("icon"), "textColor", { - converter: output => osparc.utils.StatusUI.getColor(output) + converter: status => osparc.utils.StatusUI.getColor(status) }, this); } From 1facd80fae9515d44e7e4d186b16a9ae635c754d Mon Sep 17 00:00:00 2001 From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com> Date: Wed, 27 Oct 2021 19:13:20 +0200 Subject: [PATCH 13/16] try catch _to_datetime --- .../director/src/simcore_service_director/producer.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/director/src/simcore_service_director/producer.py b/services/director/src/simcore_service_director/producer.py index e6d586c1f2e..b3ae459e8b1 100644 --- a/services/director/src/simcore_service_director/producer.py +++ b/services/director/src/simcore_service_director/producer.py @@ -542,8 +542,15 @@ def _to_datetime(datetime_str: str) -> datetime: datetime_str = datetime_str[:N] return datetime.strptime(datetime_str, "%Y-%m-%dT%H:%M:%S.%f") - task_state_update_time = _to_datetime(last_task["Status"]["Timestamp"]) - log.debug("%s %s: time %s", service["ID"], task_state, task_state_update_time) + try: + task_state_update_time = _to_datetime(last_task["Status"]["Timestamp"]) + log.debug("%s %s: time %s", service["ID"], task_state, task_state_update_time) + except: + log.exception( + "This could be 'unconverted data remains: Z'", + last_task["Status"]["Timestamp"], + ) + raise last_task_state = ServiceState.STARTING # default last_task_error_msg = ( From ead1b1ea2a1a1cf492149f3cf4dccc25f476aedb Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 28 Oct 2021 10:42:08 +0200 Subject: [PATCH 14/16] Revert "try catch _to_datetime" This reverts commit 1facd80fae9515d44e7e4d186b16a9ae635c754d. --- .../director/src/simcore_service_director/producer.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/services/director/src/simcore_service_director/producer.py b/services/director/src/simcore_service_director/producer.py index b3ae459e8b1..e6d586c1f2e 100644 --- a/services/director/src/simcore_service_director/producer.py +++ b/services/director/src/simcore_service_director/producer.py @@ -542,15 +542,8 @@ def _to_datetime(datetime_str: str) -> datetime: datetime_str = datetime_str[:N] return datetime.strptime(datetime_str, "%Y-%m-%dT%H:%M:%S.%f") - try: - task_state_update_time = _to_datetime(last_task["Status"]["Timestamp"]) - log.debug("%s %s: time %s", service["ID"], task_state, task_state_update_time) - except: - log.exception( - "This could be 'unconverted data remains: Z'", - last_task["Status"]["Timestamp"], - ) - raise + task_state_update_time = _to_datetime(last_task["Status"]["Timestamp"]) + log.debug("%s %s: time %s", service["ID"], task_state, task_state_update_time) last_task_state = ServiceState.STARTING # default last_task_error_msg = ( From 0b5ce88194b91836cddca855c0a88545c6685131 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 28 Oct 2021 13:42:18 +0200 Subject: [PATCH 15/16] minor --- .../source/class/osparc/component/widget/NodesTree.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesTree.js b/services/web/client/source/class/osparc/component/widget/NodesTree.js index 28ca338636c..761990019a3 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -87,7 +87,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { }; children.push(nodeInTree); } - children.sort((firstEl, secondEl) => firstEl.sortingValue - secondEl.sortingValue); + // children.sort((firstEl, secondEl) => firstEl.sortingValue - secondEl.sortingValue); return children; } }, @@ -187,9 +187,12 @@ qx.Class.define("osparc.component.widget.NodesTree", { this.__openItem(item.getModel().getNodeId()); this.nodeSelected(item.getModel().getNodeId()); }, this); - } + }, + sorter: (itemA, itemB) => itemA.getSortingValue() - itemB.getSortingValue() }); - this.setHeight(newModel.getChildren().length*21 + 5); + const nChildren = newModel.getChildren().length; + console.log(nChildren); + this.setHeight(nChildren*21 + 12); } }, From a5e29c97f35c621313af8811830f87de7daa5589 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 28 Oct 2021 13:49:12 +0200 Subject: [PATCH 16/16] minor fix --- .../web/client/source/class/osparc/desktop/WorkbenchView.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index 2b916e4ac15..ba3aea4071e 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -895,9 +895,6 @@ qx.Class.define("osparc.desktop.WorkbenchView", { }, __attachEventHandlers: function() { - // const blocker = this.getBlocker(); - // blocker.addListener("tap", this.getChildControl("side-panels").toggleCollapsed.bind(this.getChildControl("side-panels"))); - const maximizeIframeCb = msg => { this.__maximizeIframe(msg.getData()); }; @@ -993,6 +990,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", { return; } } + this.__maximizeIframe(false); this.nodeSelected(this.getStudy().getUuid()); } }