From 959f684ce98a8ee90ca68b9df1144ec2067b2486 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 7 Oct 2020 15:25:03 +0200 Subject: [PATCH 001/110] 'dummy' state property added --- .../web/client/source/class/osparc/data/model/Study.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/data/model/Study.js b/services/web/client/source/class/osparc/data/model/Study.js index d84a52b4692..c0310140a03 100644 --- a/services/web/client/source/class/osparc/data/model/Study.js +++ b/services/web/client/source/class/osparc/data/model/Study.js @@ -135,7 +135,9 @@ qx.Class.define("osparc.data.model.Study", { sweeper: { check: "osparc.data.model.Sweeper", nullable: false - } + }, + + state: {} }, statics: { @@ -231,6 +233,9 @@ qx.Class.define("osparc.data.model.Study", { const propertyKeys = this.self().getProperties(); propertyKeys.forEach(key => { // TODO OM: Hacky + if (key === "state") { + return; + } if (key === "sweeper") { jsonObject["dev"] = {}; jsonObject["dev"]["sweeper"] = this.getSweeper().serializeSweeper(); From f5aa9fcefdc126d75dd61187dc93cc049dbfa2a8 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 7 Oct 2020 18:06:29 +0200 Subject: [PATCH 002/110] refactoring --- .../class/osparc/component/widget/NodesTree.js | 14 ++++++++------ .../source/class/osparc/desktop/StudyEditor.js | 1 + 2 files changed, 9 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 6116107aa41..bd14cf1a128 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -42,12 +42,6 @@ qx.Class.define("osparc.component.widget.NodesTree", { this.base(arguments); this._setLayout(new qx.ui.layout.VBox()); - - this.__toolBar = this._createChildControlImpl("toolbar"); - this.__tree = this._createChildControlImpl("tree"); - this.populateTree(); - - this.__attachEventHandlers(); }, events: { @@ -66,6 +60,14 @@ qx.Class.define("osparc.component.widget.NodesTree", { __currentNodeId: null, __toolbarInitMinWidth: null, + buildLayout: function() { + this.__toolBar = this._createChildControlImpl("toolbar"); + this.__tree = this._createChildControlImpl("tree"); + this.populateTree(); + + this.__attachEventHandlers(); + }, + _createChildControlImpl: function(id) { let control; switch (id) { diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 1de4fc1ba27..ce2c1d17d99 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -169,6 +169,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { const study = this.getStudy(); const nodesTree = this.__nodesTree = new osparc.component.widget.NodesTree(study); + nodesTree.buildLayout(); nodesTree.addListener("removeNode", e => { const nodeId = e.getData(); this.__removeNode(nodeId); From a4256cf39b8853ff1e13dff9121e487e52d820fd Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 7 Oct 2020 18:08:10 +0200 Subject: [PATCH 003/110] make populateTree reusable --- .../class/osparc/component/widget/NodesTree.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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 bd14cf1a128..ca3f74ec174 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -178,7 +178,11 @@ qx.Class.define("osparc.component.widget.NodesTree", { return tree; }, - populateTree: function() { + populateTree: function(tree) { + if (tree === undefined) { + tree = this.__tree; + } + const study = osparc.store.Store.getInstance().getCurrentStudy(); const topLevelNodes = study.getWorkbench().getNodes(); let data = { @@ -188,11 +192,11 @@ qx.Class.define("osparc.component.widget.NodesTree", { isContainer: true }; let newModel = qx.data.marshal.Json.createModel(data, true); - let oldModel = this.__tree.getModel(); + let oldModel = tree.getModel(); if (JSON.stringify(newModel) !== JSON.stringify(oldModel)) { study.bind("name", newModel, "label"); - this.__tree.setModel(newModel); - this.__tree.setDelegate({ + tree.setModel(newModel); + tree.setDelegate({ createItem: () => new osparc.component.widget.NodeTreeItem(), bindItem: (c, item, id) => { c.bindDefaultProperties(item, id); From d6a3126bb58713a0831fa87cbbaeccaf0fa66903 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 7 Oct 2020 18:24:24 +0200 Subject: [PATCH 004/110] open NodesSlidesTree --- .../component/widget/NodesSlidesTree.js | 42 +++++++++++++++++++ .../osparc/component/widget/NodesTree.js | 8 +++- .../class/osparc/desktop/ControlsBar.js | 15 +++++-- .../class/osparc/desktop/StudyEditor.js | 11 +++++ 4 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js new file mode 100644 index 00000000000..89982eb601e --- /dev/null +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -0,0 +1,42 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2020 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +/** + * + */ + +qx.Class.define("osparc.component.widget.NodesSlidesTree", { + extend: osparc.component.widget.NodesTree, + + construct: function() { + this.base(arguments); + + this.__buildLayout(); + }, + + members: { + __slidesTree: null, + + __buildLayout: function() { + // this.__slidesTree = this._createChildControlImpl("tree"); + // this.populateTree(this.__slidesTree); + + this.__tree = this._createChildControlImpl("tree"); + this.populateTree(this.__tree); + } + } +}); 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 ca3f74ec174..552f2c9b4e1 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -338,8 +338,12 @@ qx.Class.define("osparc.component.widget.NodesTree", { if (this.__exportButton) { this.__exportButton.setEnabled(studyId !== nodeId && item.getIsContainer()); } - this.__deleteButton.setEnabled(studyId !== nodeId && this.__currentNodeId !== nodeId); - this.__openButton.setEnabled(this.__currentNodeId !== nodeId); + if (this.__deleteButton) { + this.__deleteButton.setEnabled(studyId !== nodeId && this.__currentNodeId !== nodeId); + } + if (this.__openButton) { + this.__openButton.setEnabled(this.__currentNodeId !== nodeId); + } } }, diff --git a/services/web/client/source/class/osparc/desktop/ControlsBar.js b/services/web/client/source/class/osparc/desktop/ControlsBar.js index 97f2c16fc72..7cc5a8eaad7 100644 --- a/services/web/client/source/class/osparc/desktop/ControlsBar.js +++ b/services/web/client/source/class/osparc/desktop/ControlsBar.js @@ -107,15 +107,17 @@ qx.Class.define("osparc.desktop.ControlsBar", { this.add(groupCtrls); } - const iterationCtrls = new qx.ui.toolbar.Part(); - const sweeperButton = this.__createShowSweeperButton(); - iterationCtrls.add(sweeperButton); + const moreCtrls = new qx.ui.toolbar.Part(); + const editSlidesButton = this.__createShowEditSlidesButton(); + moreCtrls.add(editSlidesButton); osparc.data.model.Sweeper.isSweeperEnabled() .then(isSweeperEnabled => { if (isSweeperEnabled) { - this.add(iterationCtrls); + const sweeperButton = this.__createShowSweeperButton(); + moreCtrls.add(sweeperButton); } }); + this.add(moreCtrls); const simCtrls = new qx.ui.toolbar.Part(); const startButton = this.__createStartButton(); @@ -123,6 +125,11 @@ qx.Class.define("osparc.desktop.ControlsBar", { this.add(simCtrls); }, + __createShowEditSlidesButton: function() { + const editSlidesButton = this.__createButton(this.tr("Edit slides"), "paw", "showEditSlidesButton", "showEditSlides"); + return editSlidesButton; + }, + __createShowSweeperButton: function() { const parametersButton = this.__createButton(this.tr("Sweeper"), "paw", "showSweeperButton", "showSweeper"); return parametersButton; diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index ce2c1d17d99..279a9ced290 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -446,6 +446,16 @@ qx.Class.define("osparc.desktop.StudyEditor", { } }, + __showEditSlides: function() { + const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(); + const title = this.tr("Edit Slides"); + const win = osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 400, 700); + win.set({ + modal: false, + clickAwayClose: false + }); + }, + __showSweeper: function() { const study = this.getStudy(); const sweeper = new osparc.component.sweeper.Sweeper(study); @@ -703,6 +713,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, this); const controlsBar = this.__mainPanel.getControls(); + controlsBar.addListener("showEditSlides", this.__showEditSlides, this); controlsBar.addListener("showSweeper", this.__showSweeper, this); controlsBar.addListener("showWorkbench", this.__showWorkbenchUI, this); controlsBar.addListener("showSettings", this.__showSettings, this); From a0a9b49022fc2ed89c807b0668e1a151f28f32f6 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 11:15:41 +0200 Subject: [PATCH 005/110] minor --- services/web/client/source/class/osparc/desktop/ControlsBar.js | 1 + services/web/client/source/class/osparc/desktop/StudyEditor.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/desktop/ControlsBar.js b/services/web/client/source/class/osparc/desktop/ControlsBar.js index 7cc5a8eaad7..50f23c53eb7 100644 --- a/services/web/client/source/class/osparc/desktop/ControlsBar.js +++ b/services/web/client/source/class/osparc/desktop/ControlsBar.js @@ -42,6 +42,7 @@ qx.Class.define("osparc.desktop.ControlsBar", { }, events: { + "showEditSlides": "qx.event.type.Event", "showSweeper": "qx.event.type.Event", "showWorkbench": "qx.event.type.Event", "showSettings": "qx.event.type.Event", diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 279a9ced290..1d4b61b16c1 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -449,7 +449,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { __showEditSlides: function() { const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(); const title = this.tr("Edit Slides"); - const win = osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 400, 700); + const win = osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 600, 500); win.set({ modal: false, clickAwayClose: false From 0c8766c0966ce3d3ddaa19ef2995b6575cd88674 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 11:26:27 +0200 Subject: [PATCH 006/110] refactoring --- .../osparc/component/widget/NodesTree.js | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 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 552f2c9b4e1..dbe6077914b 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -51,6 +51,26 @@ qx.Class.define("osparc.component.widget.NodesTree", { "changeSelectedNode": "qx.event.type.Data" }, + statics: { + convertModel: function(nodes) { + let children = []; + for (let nodeId in nodes) { + const node = nodes[nodeId]; + let nodeInTree = { + label: "", + nodeId: node.getNodeId() + }; + nodeInTree.label = node.getLabel(); + nodeInTree.isContainer = node.isContainer(); + if (node.isContainer()) { + nodeInTree.children = this.convertModel(node.getInnerNodes()); + } + children.push(nodeInTree); + } + return children; + } + }, + members: { __toolBar: null, __tree: null, @@ -187,7 +207,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { const topLevelNodes = study.getWorkbench().getNodes(); let data = { label: study.getName(), - children: this.__convertModel(topLevelNodes), + children: this.self().convertModel(topLevelNodes), nodeId: study.getUuid(), isContainer: true }; @@ -221,24 +241,6 @@ qx.Class.define("osparc.component.widget.NodesTree", { } }, - __convertModel: function(nodes) { - let children = []; - for (let nodeId in nodes) { - const node = nodes[nodeId]; - let nodeInTree = { - label: "", - nodeId: node.getNodeId() - }; - nodeInTree.label = node.getLabel(); - nodeInTree.isContainer = node.isContainer(); - if (node.isContainer()) { - nodeInTree.children = this.__convertModel(node.getInnerNodes()); - } - children.push(nodeInTree); - } - return children; - }, - __getNodeInTree: function(model, nodeId) { if (model.getNodeId() === nodeId) { return model; From dbb7810405b714b2a31d178d0f5d2d25ab12a653 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 11:37:24 +0200 Subject: [PATCH 007/110] 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 dbe6077914b..0199bd3d653 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -232,7 +232,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { this.__openItem(item.getModel().getNodeId()); this.__selectedItem(item); }, this); - item.addListener("tap", e => { + item.addListener("tap", () => { this.__selectedItem(item); this.nodeSelected(item.getModel().getNodeId()); }, this); From 70da8406dd9e355a310e3ef57a6db1b936f58146 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 11:38:21 +0200 Subject: [PATCH 008/110] back to private --- .../class/osparc/component/widget/NodesTree.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 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 0199bd3d653..b3c6a06ac10 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -83,7 +83,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { buildLayout: function() { this.__toolBar = this._createChildControlImpl("toolbar"); this.__tree = this._createChildControlImpl("tree"); - this.populateTree(); + this.__populateTree(); this.__attachEventHandlers(); }, @@ -198,11 +198,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { return tree; }, - populateTree: function(tree) { - if (tree === undefined) { - tree = this.__tree; - } - + __populateTree: function() { const study = osparc.store.Store.getInstance().getCurrentStudy(); const topLevelNodes = study.getWorkbench().getNodes(); let data = { @@ -212,11 +208,11 @@ qx.Class.define("osparc.component.widget.NodesTree", { isContainer: true }; let newModel = qx.data.marshal.Json.createModel(data, true); - let oldModel = tree.getModel(); + let oldModel = this.__tree.getModel(); if (JSON.stringify(newModel) !== JSON.stringify(oldModel)) { study.bind("name", newModel, "label"); - tree.setModel(newModel); - tree.setDelegate({ + this.__tree.setModel(newModel); + this.__tree.setDelegate({ createItem: () => new osparc.component.widget.NodeTreeItem(), bindItem: (c, item, id) => { c.bindDefaultProperties(item, id); @@ -381,7 +377,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { }, this); qx.event.message.Bus.getInstance().subscribe("updateStudy", () => { - this.populateTree(); + this.__populateTree(); }, this); } } From 3e02019061efa43b5e3d896910e883a46777f9f2 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 11:40:34 +0200 Subject: [PATCH 009/110] reverting --- .../class/osparc/component/widget/NodesTree.js | 14 ++++++-------- .../source/class/osparc/desktop/StudyEditor.js | 1 - 2 files changed, 6 insertions(+), 9 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 b3c6a06ac10..2b8b1f8fa4b 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -42,6 +42,12 @@ qx.Class.define("osparc.component.widget.NodesTree", { this.base(arguments); this._setLayout(new qx.ui.layout.VBox()); + + this.__toolBar = this._createChildControlImpl("toolbar"); + this.__tree = this._createChildControlImpl("tree"); + this.__populateTree(); + + this.__attachEventHandlers(); }, events: { @@ -80,14 +86,6 @@ qx.Class.define("osparc.component.widget.NodesTree", { __currentNodeId: null, __toolbarInitMinWidth: null, - buildLayout: function() { - this.__toolBar = this._createChildControlImpl("toolbar"); - this.__tree = this._createChildControlImpl("tree"); - this.__populateTree(); - - this.__attachEventHandlers(); - }, - _createChildControlImpl: function(id) { let control; switch (id) { diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 1d4b61b16c1..2bdef4e0989 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -169,7 +169,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { const study = this.getStudy(); const nodesTree = this.__nodesTree = new osparc.component.widget.NodesTree(study); - nodesTree.buildLayout(); nodesTree.addListener("removeNode", e => { const nodeId = e.getData(); this.__removeNode(nodeId); From 2669ab75cffe3ae60e2000949262ee12fcf4dad8 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 11:59:56 +0200 Subject: [PATCH 010/110] minor --- .../source/class/osparc/component/widget/NodesTree.js | 6 +++--- 1 file changed, 3 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 2b8b1f8fa4b..449bca4f6fa 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -45,7 +45,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { this.__toolBar = this._createChildControlImpl("toolbar"); this.__tree = this._createChildControlImpl("tree"); - this.__populateTree(); + this.populateTree(); this.__attachEventHandlers(); }, @@ -196,7 +196,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { return tree; }, - __populateTree: function() { + populateTree: function() { const study = osparc.store.Store.getInstance().getCurrentStudy(); const topLevelNodes = study.getWorkbench().getNodes(); let data = { @@ -375,7 +375,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { }, this); qx.event.message.Bus.getInstance().subscribe("updateStudy", () => { - this.__populateTree(); + this.populateTree(); }, this); } } From ff6197856f42cdd47b1efda84396e3ef96306060 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 13:26:03 +0200 Subject: [PATCH 011/110] Move up & down working --- .../component/widget/NodeSlideTreeItem.js | 96 +++++++++++++++ .../component/widget/NodesSlidesTree.js | 109 ++++++++++++++++-- 2 files changed, 197 insertions(+), 8 deletions(-) create mode 100644 services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js diff --git a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js new file mode 100644 index 00000000000..98ad89955e2 --- /dev/null +++ b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js @@ -0,0 +1,96 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2020 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +/** + * + */ + +qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { + extend: osparc.component.widget.NodeTreeItem, + + properties: { + position: { + check: "Number", + event: "changePosition", + nullable: true + }, + + visible: { + check: "Boolean", + event: "changeVisible", + nullable: true + } + }, + + events: { + "moveUp": "qx.event.type.Event", + "moveDown": "qx.event.type.Event" + }, + + members: { + // overriden + _addWidgets: function() { + this.addSpacer(); + this.addOpenButton(); + this.addIcon(); + this.addLabel(); + + this.addWidget(new qx.ui.core.Spacer(), { + flex: 1 + }); + + if (this.isPropertyInitialized("position")) { + const posLbl = new qx.ui.basic.Label(); + this.bind("position", posLbl, "value", { + converter: val => val+1 + }); + this.addWidget(posLbl); + } + + if (this.isPropertyInitialized("visible")) { + if (this.isVisible()) { + const hideBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye-slash/10"); + hideBtn.addListener("execute", () => this.setVisible(false), this); + this.addWidget(hideBtn); + } else { + const showBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye/10"); + showBtn.addListener("execute", () => this.setVisible(true), this); + this.addWidget(showBtn); + } + } + + const moveUpBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/arrow-up/10"); + moveUpBtn.addListener("execute", () => this.fireEvent("moveUp"), this); + this.addWidget(moveUpBtn); + + const moveDownBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/arrow-down/10"); + moveDownBtn.addListener("execute", () => this.fireEvent("moveDown"), this); + this.addWidget(moveDownBtn); + + if (this.isPropertyInitialized("nodeId") && osparc.data.Permissions.getInstance().canDo("study.nodestree.uuid.read")) { + this.addWidget(new qx.ui.core.Spacer(), { + flex: 1 + }); + + const nodeIdWidget = new qx.ui.basic.Label(); + this.bind("nodeId", nodeIdWidget, "value"); + nodeIdWidget.setMaxWidth(250); + this.addWidget(nodeIdWidget); + } + } + } +}); diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 89982eb601e..beb8b1f8f2d 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -20,23 +20,116 @@ */ qx.Class.define("osparc.component.widget.NodesSlidesTree", { - extend: osparc.component.widget.NodesTree, + extend: qx.ui.core.Widget, construct: function() { this.base(arguments); - this.__buildLayout(); + this._setLayout(new qx.ui.layout.VBox()); + + this.__tree = this._createChildControlImpl("tree"); + + this.__populateTree(); + }, + + statics: { + moveElement: function(input, from, to) { + let numberOfDeletedElm = 1; + const elm = input.splice(from, numberOfDeletedElm)[0]; + numberOfDeletedElm = 0; + input.splice(to, numberOfDeletedElm, elm); + } }, members: { - __slidesTree: null, + __tree: null, + + _createChildControlImpl: function(id) { + let control; + switch (id) { + case "tree": + control = this.__buildTree(); + this._add(control, { + flex: 1 + }); + break; + } + + return control || this.base(arguments, id); + }, - __buildLayout: function() { - // this.__slidesTree = this._createChildControlImpl("tree"); - // this.populateTree(this.__slidesTree); + __buildTree: function() { + const tree = new qx.ui.tree.VirtualTree(null, "label", "children").set({ + decorator: "service-tree", + openMode: "none", + contentPadding: 0, + padding: 0 + }); + return tree; + }, - this.__tree = this._createChildControlImpl("tree"); - this.populateTree(this.__tree); + __populateTree: function() { + const study = osparc.store.Store.getInstance().getCurrentStudy(); + const topLevelNodes = study.getWorkbench().getNodes(); + let data = { + label: study.getName(), + children: osparc.component.widget.NodesTree.convertModel(topLevelNodes), + nodeId: study.getUuid(), + isContainer: true + }; + let newModel = qx.data.marshal.Json.createModel(data, true); + let oldModel = this.__tree.getModel(); + if (JSON.stringify(newModel) !== JSON.stringify(oldModel)) { + study.bind("name", newModel, "label"); + this.__tree.setModel(newModel); + let i = 0; + this.__tree.setDelegate({ + createItem: () => { + const nodeSlideTreeItem = new osparc.component.widget.NodeSlideTreeItem(); + nodeSlideTreeItem.set({ + visible: true, + position: i + }); + i++; + return nodeSlideTreeItem; + }, + 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); + }, + configureItem: item => { + item.addListener("moveUp", () => { + const nodeId = item.getModel().getNodeId(); + const parent = this.__tree.getParent(item.getModel()); + if (parent) { + const children = parent.getChildren().toArray(); + const idx = children.findIndex(elem => elem.getNodeId() === nodeId); + if (idx > 0) { + this.self().moveElement(children, idx, idx-1); + this.__tree.refresh(); + } + } + }, this); + item.addListener("moveDown", () => { + const nodeId = item.getModel().getNodeId(); + const parent = this.__tree.getParent(item.getModel()); + if (parent) { + const children = parent.getChildren().toArray(); + const idx = children.findIndex(elem => elem.getNodeId() === nodeId); + if (idx < children.length-1) { + this.self().moveElement(children, idx, idx+1); + this.__tree.refresh(); + } + } + }, this); + } + }); + } } } }); From 88296ee35a8743f94304a1f24f5a03a8f0602f93 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 13:58:09 +0200 Subject: [PATCH 012/110] showing all buttons --- .../component/widget/NodeSlideTreeItem.js | 62 +++++++++++++------ .../component/widget/NodesSlidesTree.js | 2 + .../class/osparc/desktop/StudyEditor.js | 3 +- 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js index 98ad89955e2..d18ab9a4c79 100644 --- a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js +++ b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js @@ -53,25 +53,49 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { flex: 1 }); - if (this.isPropertyInitialized("position")) { - const posLbl = new qx.ui.basic.Label(); - this.bind("position", posLbl, "value", { - converter: val => val+1 - }); - this.addWidget(posLbl); - } - - if (this.isPropertyInitialized("visible")) { - if (this.isVisible()) { - const hideBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye-slash/10"); - hideBtn.addListener("execute", () => this.setVisible(false), this); - this.addWidget(hideBtn); - } else { - const showBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye/10"); - showBtn.addListener("execute", () => this.setVisible(true), this); - this.addWidget(showBtn); + const posLbl = new qx.ui.basic.Label(); + this.bind("position", posLbl, "value", { + converter: val => { + if (val === null) { + return ""; + } + return toString(val+1); } - } + }); + this.bind("visible", posLbl, "visibility", { + converter: val => val ? "visible" : "excluded" + }); + this.addWidget(posLbl); + + const hideBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye-slash/10"); + hideBtn.addListener("execute", () => this.setVisible(false), this); + this.bind("visible", hideBtn, "visibility", { + converter: val => { + if (val === null) { + return "excluded"; + } + if (val === true) { + return "visible"; + } + return "excluded"; + } + }); + this.addWidget(hideBtn); + + const showBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye/10"); + showBtn.addListener("execute", () => this.setVisible(true), this); + this.bind("visible", showBtn, "visibility", { + converter: val => { + if (val === null) { + return "excluded"; + } + if (val === false) { + return "visible"; + } + return "excluded"; + } + }); + this.addWidget(showBtn); const moveUpBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/arrow-up/10"); moveUpBtn.addListener("execute", () => this.fireEvent("moveUp"), this); @@ -81,7 +105,7 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { moveDownBtn.addListener("execute", () => this.fireEvent("moveDown"), this); this.addWidget(moveDownBtn); - if (this.isPropertyInitialized("nodeId") && osparc.data.Permissions.getInstance().canDo("study.nodestree.uuid.read")) { + if (false && osparc.data.Permissions.getInstance().canDo("study.nodestree.uuid.read")) { this.addWidget(new qx.ui.core.Spacer(), { flex: 1 }); diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index beb8b1f8f2d..c5bdec8803d 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -111,6 +111,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { const idx = children.findIndex(elem => elem.getNodeId() === nodeId); if (idx > 0) { this.self().moveElement(children, idx, idx-1); + item.setPosition(idx-1); this.__tree.refresh(); } } @@ -123,6 +124,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { const idx = children.findIndex(elem => elem.getNodeId() === nodeId); if (idx < children.length-1) { this.self().moveElement(children, idx, idx+1); + item.setPosition(idx+1); this.__tree.refresh(); } } diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 2bdef4e0989..b67b362b863 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -448,8 +448,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { __showEditSlides: function() { const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(); const title = this.tr("Edit Slides"); - const win = osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 600, 500); - win.set({ + osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 600, 500).set({ modal: false, clickAwayClose: false }); From 3f9a06a92c3962150433dcb17b9afe46dc3368d6 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 14:24:41 +0200 Subject: [PATCH 013/110] cleanup --- .../component/widget/NodeSlideTreeItem.js | 44 ++++--- .../component/widget/NodesSlidesTree.js | 112 +++++++++--------- 2 files changed, 85 insertions(+), 71 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js index d18ab9a4c79..6e688253566 100644 --- a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js +++ b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js @@ -26,12 +26,14 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { position: { check: "Number", event: "changePosition", + apply: "_applyPosition", nullable: true }, - visible: { + skipNode: { check: "Boolean", - event: "changeVisible", + event: "changeSkipNode", + apply: "_applySkipNode", nullable: true } }, @@ -59,40 +61,40 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { if (val === null) { return ""; } - return toString(val+1); + return (val+1).toString(); } }); - this.bind("visible", posLbl, "visibility", { - converter: val => val ? "visible" : "excluded" + this.bind("skipNode", posLbl, "visibility", { + converter: val => val ? "excluded" : "visible" }); this.addWidget(posLbl); const hideBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye-slash/10"); - hideBtn.addListener("execute", () => this.setVisible(false), this); - this.bind("visible", hideBtn, "visibility", { + hideBtn.addListener("execute", () => this.setSkipNode(true), this); + this.bind("skipNode", hideBtn, "visibility", { converter: val => { if (val === null) { return "excluded"; } if (val === true) { - return "visible"; + return "excluded"; } - return "excluded"; + return "visible"; } }); this.addWidget(hideBtn); const showBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye/10"); - showBtn.addListener("execute", () => this.setVisible(true), this); - this.bind("visible", showBtn, "visibility", { + showBtn.addListener("execute", () => this.setSkipNode(false), this); + this.bind("skipNode", showBtn, "visibility", { converter: val => { if (val === null) { return "excluded"; } if (val === false) { - return "visible"; + return "excluded"; } - return "excluded"; + return "visible"; } }); this.addWidget(showBtn); @@ -106,15 +108,23 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { this.addWidget(moveDownBtn); if (false && osparc.data.Permissions.getInstance().canDo("study.nodestree.uuid.read")) { - this.addWidget(new qx.ui.core.Spacer(), { - flex: 1 - }); - const nodeIdWidget = new qx.ui.basic.Label(); this.bind("nodeId", nodeIdWidget, "value"); nodeIdWidget.setMaxWidth(250); this.addWidget(nodeIdWidget); } + }, + + _applyPosition: function(val) { + if (val === null) { + return; + } + }, + + _applySkipNode: function(val) { + if (val === null) { + return; + } } } }); diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index c5bdec8803d..42e4807b28d 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -29,6 +29,9 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { this.__tree = this._createChildControlImpl("tree"); + const model = this.__initTree(); + this.__tree.setModel(model); + this.__populateTree(); }, @@ -68,7 +71,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { return tree; }, - __populateTree: function() { + __initTree: function() { const study = osparc.store.Store.getInstance().getCurrentStudy(); const topLevelNodes = study.getWorkbench().getNodes(); let data = { @@ -77,61 +80,62 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { nodeId: study.getUuid(), isContainer: true }; - let newModel = qx.data.marshal.Json.createModel(data, true); - let oldModel = this.__tree.getModel(); - if (JSON.stringify(newModel) !== JSON.stringify(oldModel)) { - study.bind("name", newModel, "label"); - this.__tree.setModel(newModel); - let i = 0; - this.__tree.setDelegate({ - createItem: () => { - const nodeSlideTreeItem = new osparc.component.widget.NodeSlideTreeItem(); - nodeSlideTreeItem.set({ - visible: true, - position: i - }); - i++; - return nodeSlideTreeItem; - }, - 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); - }, - configureItem: item => { - item.addListener("moveUp", () => { - const nodeId = item.getModel().getNodeId(); - const parent = this.__tree.getParent(item.getModel()); - if (parent) { - const children = parent.getChildren().toArray(); - const idx = children.findIndex(elem => elem.getNodeId() === nodeId); - if (idx > 0) { - this.self().moveElement(children, idx, idx-1); - item.setPosition(idx-1); - this.__tree.refresh(); - } + let model = qx.data.marshal.Json.createModel(data, true); + return model; + }, + + __populateTree: function() { + const study = osparc.store.Store.getInstance().getCurrentStudy(); + + let i = 0; + this.__tree.setDelegate({ + createItem: () => { + const nodeSlideTreeItem = new osparc.component.widget.NodeSlideTreeItem(); + nodeSlideTreeItem.set({ + skipNode: false, + position: i + }); + i++; + return nodeSlideTreeItem; + }, + 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); + }, + configureItem: item => { + item.addListener("moveUp", () => { + const nodeId = item.getModel().getNodeId(); + const parent = this.__tree.getParent(item.getModel()); + if (parent) { + const children = parent.getChildren().toArray(); + const idx = children.findIndex(elem => elem.getNodeId() === nodeId); + if (idx > 0) { + this.self().moveElement(children, idx, idx-1); + item.setPosition(idx-1); + this.__tree.refresh(); } - }, this); - item.addListener("moveDown", () => { - const nodeId = item.getModel().getNodeId(); - const parent = this.__tree.getParent(item.getModel()); - if (parent) { - const children = parent.getChildren().toArray(); - const idx = children.findIndex(elem => elem.getNodeId() === nodeId); - if (idx < children.length-1) { - this.self().moveElement(children, idx, idx+1); - item.setPosition(idx+1); - this.__tree.refresh(); - } + } + }, this); + item.addListener("moveDown", () => { + const nodeId = item.getModel().getNodeId(); + const parent = this.__tree.getParent(item.getModel()); + if (parent) { + const children = parent.getChildren().toArray(); + const idx = children.findIndex(elem => elem.getNodeId() === nodeId); + if (idx < children.length-1) { + this.self().moveElement(children, idx, idx+1); + item.setPosition(idx+1); + this.__tree.refresh(); } - }, this); - } - }); - } + } + }, this); + } + }); } } }); From fa96d8a2a4f0c7e5f2488a67fe2d58fa3c4128c8 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 14:30:38 +0200 Subject: [PATCH 014/110] minor --- .../source/class/osparc/component/widget/NodesSlidesTree.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 42e4807b28d..96d30d776d8 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -77,8 +77,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { let data = { label: study.getName(), children: osparc.component.widget.NodesTree.convertModel(topLevelNodes), - nodeId: study.getUuid(), - isContainer: true + nodeId: study.getUuid() }; let model = qx.data.marshal.Json.createModel(data, true); return model; From 6cbbfcdef8bf3f4dbb240f047d39c7abd8f457dd Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 15:01:25 +0200 Subject: [PATCH 015/110] refactoring --- .../component/widget/NodeSlideTreeItem.js | 11 +- .../component/widget/NodesSlidesTree.js | 100 +++++++++++++----- 2 files changed, 85 insertions(+), 26 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js index 6e688253566..d5956ef71ae 100644 --- a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js +++ b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js @@ -34,11 +34,14 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { check: "Boolean", event: "changeSkipNode", apply: "_applySkipNode", + init: false, nullable: true } }, events: { + "showNode": "qx.event.type.Event", + "hideNode": "qx.event.type.Event", "moveUp": "qx.event.type.Event", "moveDown": "qx.event.type.Event" }, @@ -70,7 +73,9 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { this.addWidget(posLbl); const hideBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye-slash/10"); - hideBtn.addListener("execute", () => this.setSkipNode(true), this); + hideBtn.addListener("execute", () => { + this.fireEvent("showNode"); + }, this); this.bind("skipNode", hideBtn, "visibility", { converter: val => { if (val === null) { @@ -85,7 +90,9 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { this.addWidget(hideBtn); const showBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye/10"); - showBtn.addListener("execute", () => this.setSkipNode(false), this); + showBtn.addListener("execute", () => { + this.fireEvent("hideNode"); + }, this); this.bind("skipNode", showBtn, "visibility", { converter: val => { if (val === null) { diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 96d30d776d8..015712d0cf3 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -36,6 +36,28 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { }, statics: { + + convertModel: function(nodes) { + let children = []; + let i=0; + for (let nodeId in nodes) { + const node = nodes[nodeId]; + let nodeInTree = { + label: "", + nodeId: node.getNodeId(), + skipNode: false, + position: i+1 + }; + nodeInTree.label = node.getLabel(); + if (node.isContainer()) { + nodeInTree.children = this.convertModel(node.getInnerNodes()); + } + children.push(nodeInTree); + i++; + } + return children; + }, + moveElement: function(input, from, to) { let numberOfDeletedElm = 1; const elm = input.splice(from, numberOfDeletedElm)[0]; @@ -76,8 +98,10 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { const topLevelNodes = study.getWorkbench().getNodes(); let data = { label: study.getName(), - children: osparc.component.widget.NodesTree.convertModel(topLevelNodes), - nodeId: study.getUuid() + children: this.self().convertModel(topLevelNodes), + nodeId: study.getUuid(), + skipNode: false, + position: 0 }; let model = qx.data.marshal.Json.createModel(data, true); return model; @@ -105,36 +129,64 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { node.bind("label", item.getModel(), "label"); } c.bindProperty("label", "label", null, item, id); + c.bindProperty("position", "position", null, item, id); + c.bindProperty("skipNode", "skipNode", null, item, id); }, configureItem: item => { + item.addListener("showNode", () => { + this.__show(item.getModel()); + }, this); + item.addListener("hideNode", () => { + this.__hide(item.getModel()); + }, this); item.addListener("moveUp", () => { - const nodeId = item.getModel().getNodeId(); - const parent = this.__tree.getParent(item.getModel()); - if (parent) { - const children = parent.getChildren().toArray(); - const idx = children.findIndex(elem => elem.getNodeId() === nodeId); - if (idx > 0) { - this.self().moveElement(children, idx, idx-1); - item.setPosition(idx-1); - this.__tree.refresh(); - } - } + this.__moveUp(item.getModel()); }, this); item.addListener("moveDown", () => { - const nodeId = item.getModel().getNodeId(); - const parent = this.__tree.getParent(item.getModel()); - if (parent) { - const children = parent.getChildren().toArray(); - const idx = children.findIndex(elem => elem.getNodeId() === nodeId); - if (idx < children.length-1) { - this.self().moveElement(children, idx, idx+1); - item.setPosition(idx+1); - this.__tree.refresh(); - } - } + this.__moveDown(item.getModel()); }, this); } }); + }, + + __show: function(itemMdl) { + itemMdl.set({ + skipNode: true + }); + }, + + __hide: function(itemMdl) { + itemMdl.set({ + skipNode: false + }); + }, + + __moveUp: function(itemMdl) { + const nodeId = itemMdl.getNodeId(); + const parentMdl = this.__tree.getParent(itemMdl); + if (parentMdl) { + const children = parentMdl.getChildren().toArray(); + const idx = children.findIndex(elem => elem.getNodeId() === nodeId); + if (idx > 0) { + this.self().moveElement(children, idx, idx-1); + itemMdl.setPosition(idx-1); + this.__tree.refresh(); + } + } + }, + + __moveDown: function(itemMdl) { + const nodeId = itemMdl.getNodeId(); + const parentMdl = this.__tree.getParent(itemMdl); + if (parentMdl) { + const children = parentMdl.getChildren().toArray(); + const idx = children.findIndex(elem => elem.getNodeId() === nodeId); + if (idx < children.length-1) { + this.self().moveElement(children, idx, idx+1); + itemMdl.setPosition(idx+1); + this.__tree.refresh(); + } + } } } }); From 13bb052d48ed804620952214cda40761c00c73a0 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 15:08:49 +0200 Subject: [PATCH 016/110] Save button added --- .../osparc/component/widget/NodesSlidesTree.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 015712d0cf3..f4b8c515e4f 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -28,6 +28,8 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { this._setLayout(new qx.ui.layout.VBox()); this.__tree = this._createChildControlImpl("tree"); + const save = this._createChildControlImpl("save-button"); + save.addListener("execute", () => this.__saveSlides, this); const model = this.__initTree(); this.__tree.setModel(model); @@ -36,7 +38,6 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { }, statics: { - convertModel: function(nodes) { let children = []; let i=0; @@ -78,6 +79,13 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { flex: 1 }); break; + case "save-button": + control = new qx.ui.form.Button(this.tr("Save")).set({ + allowGrowX: false, + alignX: "right" + }); + this._add(control); + break; } return control || this.base(arguments, id); @@ -187,6 +195,10 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { this.__tree.refresh(); } } + }, + + __saveSlides: function() { + console.log("Serialize me", this.__tree.getModel()); } } }); From 7801fca6d4e5458c78b9dca6b273b459389323a0 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 8 Oct 2020 16:57:40 +0200 Subject: [PATCH 017/110] looking better --- .../component/widget/NodeSlideTreeItem.js | 42 ++++++++++++++++--- .../component/widget/NodesSlidesTree.js | 8 ++-- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js index d5956ef71ae..996ca13dda1 100644 --- a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js +++ b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js @@ -20,13 +20,20 @@ */ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { - extend: osparc.component.widget.NodeTreeItem, + extend: qx.ui.tree.VirtualTreeItem, properties: { + nodeId : { + check : "String", + event: "changeNodeId", + nullable : true + }, + position: { check: "Number", event: "changePosition", apply: "_applyPosition", + init: -1, nullable: true }, @@ -107,17 +114,40 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { this.addWidget(showBtn); const moveUpBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/arrow-up/10"); - moveUpBtn.addListener("execute", () => this.fireEvent("moveUp"), this); + moveUpBtn.addListener("execute", () => { + this.fireEvent("moveUp"); + }, this); + this.bind("position", moveUpBtn, "visibility", { + converter: val => { + if (val === null) { + return "excluded"; + } + return "visible"; + } + }); this.addWidget(moveUpBtn); const moveDownBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/arrow-down/10"); - moveDownBtn.addListener("execute", () => this.fireEvent("moveDown"), this); + moveDownBtn.addListener("execute", () => { + this.fireEvent("moveDown"); + }, this); + this.bind("position", moveDownBtn, "visibility", { + converter: val => { + if (val === null) { + return "excluded"; + } + return "visible"; + } + }); this.addWidget(moveDownBtn); - if (false && osparc.data.Permissions.getInstance().canDo("study.nodestree.uuid.read")) { - const nodeIdWidget = new qx.ui.basic.Label(); + if (osparc.data.Permissions.getInstance().canDo("study.nodestree.uuid.read")) { + const nodeIdWidget = new qx.ui.basic.Label().set({ + alignX: "right", + minWidth: 260, + maxWidth: 260 + }); this.bind("nodeId", nodeIdWidget, "value"); - nodeIdWidget.setMaxWidth(250); this.addWidget(nodeIdWidget); } }, diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index f4b8c515e4f..556685b293f 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -25,7 +25,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { construct: function() { this.base(arguments); - this._setLayout(new qx.ui.layout.VBox()); + this._setLayout(new qx.ui.layout.VBox(10)); this.__tree = this._createChildControlImpl("tree"); const save = this._createChildControlImpl("save-button"); @@ -47,7 +47,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { label: "", nodeId: node.getNodeId(), skipNode: false, - position: i+1 + position: i }; nodeInTree.label = node.getLabel(); if (node.isContainer()) { @@ -108,8 +108,8 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { label: study.getName(), children: this.self().convertModel(topLevelNodes), nodeId: study.getUuid(), - skipNode: false, - position: 0 + skipNode: null, + position: null }; let model = qx.data.marshal.Json.createModel(data, true); return model; From 5238cdd886644585a059b996cf3867f3e5201595 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 9 Oct 2020 10:43:45 +0200 Subject: [PATCH 018/110] postion calculated --- .../component/widget/NodesSlidesTree.js | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 556685b293f..e7664c4f04f 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -143,15 +143,19 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { configureItem: item => { item.addListener("showNode", () => { this.__show(item.getModel()); + this.__recalculatePositions(); }, this); item.addListener("hideNode", () => { this.__hide(item.getModel()); + this.__recalculatePositions(); }, this); item.addListener("moveUp", () => { this.__moveUp(item.getModel()); + this.__recalculatePositions(); }, this); item.addListener("moveDown", () => { this.__moveDown(item.getModel()); + this.__recalculatePositions(); }, this); } }); @@ -177,8 +181,6 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { const idx = children.findIndex(elem => elem.getNodeId() === nodeId); if (idx > 0) { this.self().moveElement(children, idx, idx-1); - itemMdl.setPosition(idx-1); - this.__tree.refresh(); } } }, @@ -191,12 +193,24 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { const idx = children.findIndex(elem => elem.getNodeId() === nodeId); if (idx < children.length-1) { this.self().moveElement(children, idx, idx+1); - itemMdl.setPosition(idx+1); - this.__tree.refresh(); } } }, + __recalculatePositions: function() { + const treeMdl = this.__tree.getModel(); + const children = treeMdl.getChildren().toArray(); + let pos = 0; + for (let i=0; i Date: Fri, 9 Oct 2020 13:24:37 +0200 Subject: [PATCH 019/110] migration script added --- .../27c6a30d7c24_add_ui_in_projects_table.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 packages/postgres-database/src/simcore_postgres_database/migration/versions/27c6a30d7c24_add_ui_in_projects_table.py diff --git a/packages/postgres-database/src/simcore_postgres_database/migration/versions/27c6a30d7c24_add_ui_in_projects_table.py b/packages/postgres-database/src/simcore_postgres_database/migration/versions/27c6a30d7c24_add_ui_in_projects_table.py new file mode 100644 index 00000000000..fcbf018d815 --- /dev/null +++ b/packages/postgres-database/src/simcore_postgres_database/migration/versions/27c6a30d7c24_add_ui_in_projects_table.py @@ -0,0 +1,28 @@ +"""add ui in projects table + +Revision ID: 27c6a30d7c24 +Revises: 350103a7efbd +Create Date: 2020-10-09 09:46:27.364227+00:00 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = '27c6a30d7c24' +down_revision = '350103a7efbd' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('projects', sa.Column('ui', postgresql.JSONB(astext_type=sa.Text()), server_default=sa.text("'{}'::jsonb"), nullable=False)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('projects', 'ui') + # ### end Alembic commands ### From 197d8cc212aa9c51c3122663433329202566705a Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 9 Oct 2020 13:25:19 +0200 Subject: [PATCH 020/110] project model and schemas updated --- .../schemas/project-v0.0.1-converted.yaml | 34 ++ api/specs/common/schemas/project-v0.0.1.json | 48 +++ .../src/models_library/projects.py | 17 + .../api/v0/schemas/project-v0.0.1.json | 48 +++ .../api/v0/openapi.yaml | 136 +++++++ .../api/v0/schemas/project-v0.0.1.json | 48 +++ .../api/v0/openapi.yaml | 340 ++++++++++++++++++ .../api/v0/schemas/project-v0.0.1.json | 48 +++ 8 files changed, 719 insertions(+) diff --git a/api/specs/common/schemas/project-v0.0.1-converted.yaml b/api/specs/common/schemas/project-v0.0.1-converted.yaml index c716b0ad6e3..a9867336604 100644 --- a/api/specs/common/schemas/project-v0.0.1-converted.yaml +++ b/api/specs/common/schemas/project-v0.0.1-converted.yaml @@ -231,6 +231,40 @@ properties: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 17c3f83d1c4..742e1bbbf2c 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -327,6 +327,54 @@ } } }, + "ui": { + "type": "object", + "patternProperties": { + "^\\S+$": { + "type": "object", + "additionalProperties": false, + "properties": { + "position": { + "type": "object", + "additionalProperties": false, + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "integer" + }, + "y": { + "type": "integer" + } + } + }, + "slideshow": { + "type": "object", + "additionalProperties": false, + "properties": { + "slideType": { + "type": "string", + "description": "Type of slide", + "examples": [ + "slide" + ] + }, + "position": { + "type": "number", + "description": "Slide's position", + "examples": [ + "0", + "2" + ] + } + } + } + } + } + } + }, "tags": { "type": "array", "items": { diff --git a/packages/models-library/src/models_library/projects.py b/packages/models-library/src/models_library/projects.py index de5a92f0381..60cb53fa6c3 100644 --- a/packages/models-library/src/models_library/projects.py +++ b/packages/models-library/src/models_library/projects.py @@ -82,6 +82,14 @@ class Config: extra = Extra.forbid +class Slideshow(BaseModel): + slideType: Optional[str] = Field(..., description="Type of slide", example=["slide"]) + position: Optional[int] = Field(..., description="Slide's position", example=["0", "2"]) + + class Config: + extra = Extra.forbid + + InputTypes = Union[int, bool, str, float, PortLink, SimCoreFileLink, DatCoreFileLink] OutputTypes = Union[int, bool, str, float, SimCoreFileLink, DatCoreFileLink] InputID = constr(regex=PROPERTY_KEY_RE) @@ -147,6 +155,14 @@ class Config: extra = Extra.forbid +class NodeUI(BaseModel): + position: Optional[Position] = Field(...) + slideshow: Optional[Slideshow] = Field(...) + + class Config: + extra = Extra.forbid + + class AccessRights(BaseModel): read: bool = Field(..., description="gives read access") write: bool = Field(..., description="gives write access") @@ -202,6 +218,7 @@ class Project(BaseModel): example=["https://placeimg.com/171/96/tech/grayscale/?0.jpg"], ) workbench: Dict[NodeID, Node] + ui: Optional[Dict[NodeID, NodeUI]] tags: Optional[List[int]] = Field(None) classifiers: Optional[List[ClassifierID]] = Field( None, diff --git a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json index 17c3f83d1c4..742e1bbbf2c 100644 --- a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json +++ b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json @@ -327,6 +327,54 @@ } } }, + "ui": { + "type": "object", + "patternProperties": { + "^\\S+$": { + "type": "object", + "additionalProperties": false, + "properties": { + "position": { + "type": "object", + "additionalProperties": false, + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "integer" + }, + "y": { + "type": "integer" + } + } + }, + "slideshow": { + "type": "object", + "additionalProperties": false, + "properties": { + "slideType": { + "type": "string", + "description": "Type of slide", + "examples": [ + "slide" + ] + }, + "position": { + "type": "number", + "description": "Slide's position", + "examples": [ + "0", + "2" + ] + } + } + } + } + } + } + }, "tags": { "type": "array", "items": { diff --git a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml index 546781b8832..1eb063f5c6a 100644 --- a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml +++ b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml @@ -1957,6 +1957,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -2198,6 +2232,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -2449,6 +2517,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -2800,6 +2902,40 @@ components: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: diff --git a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json index 17c3f83d1c4..742e1bbbf2c 100644 --- a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json +++ b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json @@ -327,6 +327,54 @@ } } }, + "ui": { + "type": "object", + "patternProperties": { + "^\\S+$": { + "type": "object", + "additionalProperties": false, + "properties": { + "position": { + "type": "object", + "additionalProperties": false, + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "integer" + }, + "y": { + "type": "integer" + } + } + }, + "slideshow": { + "type": "object", + "additionalProperties": false, + "properties": { + "slideType": { + "type": "string", + "description": "Type of slide", + "examples": [ + "slide" + ] + }, + "position": { + "type": "number", + "description": "Slide's position", + "examples": [ + "0", + "2" + ] + } + } + } + } + } + } + }, "tags": { "type": "array", "items": { diff --git a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml index 8d7cb7008ea..254c9bbb04b 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml +++ b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml @@ -6000,6 +6000,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -6372,6 +6406,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -6624,6 +6692,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -6994,6 +7096,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -7370,6 +7506,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -7737,6 +7907,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -7989,6 +8193,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -8381,6 +8619,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -9585,6 +9857,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: @@ -9954,6 +10260,40 @@ paths: 'y': type: integer additionalProperties: true + ui: + type: object + x-patternProperties: + ^\S+$: + type: object + additionalProperties: false + properties: + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer + slideshow: + type: object + additionalProperties: false + properties: + slideType: + type: string + description: Type of slide + example: + - slide + position: + type: number + description: Slide's position + example: + - '0' + - '2' + additionalProperties: true tags: type: array items: diff --git a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json index 17c3f83d1c4..742e1bbbf2c 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json +++ b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json @@ -327,6 +327,54 @@ } } }, + "ui": { + "type": "object", + "patternProperties": { + "^\\S+$": { + "type": "object", + "additionalProperties": false, + "properties": { + "position": { + "type": "object", + "additionalProperties": false, + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "integer" + }, + "y": { + "type": "integer" + } + } + }, + "slideshow": { + "type": "object", + "additionalProperties": false, + "properties": { + "slideType": { + "type": "string", + "description": "Type of slide", + "examples": [ + "slide" + ] + }, + "position": { + "type": "number", + "description": "Slide's position", + "examples": [ + "0", + "2" + ] + } + } + } + } + } + } + }, "tags": { "type": "array", "items": { From f597dc1dd89616aa6876c41002dc637b152db8df Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 9 Oct 2020 14:03:01 +0200 Subject: [PATCH 021/110] project and schemas updated --- .../schemas/project-v0.0.1-converted.yaml | 20 +- api/specs/common/schemas/project-v0.0.1.json | 26 ++- .../src/models_library/projects.py | 11 +- .../api/v0/schemas/project-v0.0.1.json | 26 ++- .../api/v0/openapi.yaml | 80 ++++--- .../api/v0/schemas/project-v0.0.1.json | 26 ++- .../api/v0/openapi.yaml | 200 +++++++++++------- .../api/v0/schemas/project-v0.0.1.json | 26 ++- 8 files changed, 253 insertions(+), 162 deletions(-) diff --git a/api/specs/common/schemas/project-v0.0.1-converted.yaml b/api/specs/common/schemas/project-v0.0.1-converted.yaml index a9867336604..662b269d058 100644 --- a/api/specs/common/schemas/project-v0.0.1-converted.yaml +++ b/api/specs/common/schemas/project-v0.0.1-converted.yaml @@ -238,17 +238,21 @@ properties: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 742e1bbbf2c..4ba148fa6f8 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -334,19 +334,25 @@ "type": "object", "additionalProperties": false, "properties": { - "position": { + "workbench": { "type": "object", "additionalProperties": false, - "required": [ - "x", - "y" - ], "properties": { - "x": { - "type": "integer" - }, - "y": { - "type": "integer" + "position": { + "type": "object", + "additionalProperties": false, + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "integer" + }, + "y": { + "type": "integer" + } + } } } }, diff --git a/packages/models-library/src/models_library/projects.py b/packages/models-library/src/models_library/projects.py index 60cb53fa6c3..7da834edeed 100644 --- a/packages/models-library/src/models_library/projects.py +++ b/packages/models-library/src/models_library/projects.py @@ -82,6 +82,13 @@ class Config: extra = Extra.forbid +class WorkbenchUI(BaseModel): + position: Optional[Position] = Field(...) + + class Config: + extra = Extra.forbid + + class Slideshow(BaseModel): slideType: Optional[str] = Field(..., description="Type of slide", example=["slide"]) position: Optional[int] = Field(..., description="Slide's position", example=["0", "2"]) @@ -149,14 +156,14 @@ class Node(BaseModel): example=["nodeUUid1", "nodeUuid2"], ) - position: Position = Field(...) + position: Optional[Position] = Field(...) class Config: extra = Extra.forbid class NodeUI(BaseModel): - position: Optional[Position] = Field(...) + workbench: Optional[WorkbenchUI] = Field(...) slideshow: Optional[Slideshow] = Field(...) class Config: diff --git a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json index 742e1bbbf2c..4ba148fa6f8 100644 --- a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json +++ b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json @@ -334,19 +334,25 @@ "type": "object", "additionalProperties": false, "properties": { - "position": { + "workbench": { "type": "object", "additionalProperties": false, - "required": [ - "x", - "y" - ], "properties": { - "x": { - "type": "integer" - }, - "y": { - "type": "integer" + "position": { + "type": "object", + "additionalProperties": false, + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "integer" + }, + "y": { + "type": "integer" + } + } } } }, diff --git a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml index 1eb063f5c6a..de1cbbaab0e 100644 --- a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml +++ b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml @@ -1964,17 +1964,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -2239,17 +2243,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -2524,17 +2532,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -2909,17 +2921,21 @@ components: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false diff --git a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json index 742e1bbbf2c..4ba148fa6f8 100644 --- a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json +++ b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json @@ -334,19 +334,25 @@ "type": "object", "additionalProperties": false, "properties": { - "position": { + "workbench": { "type": "object", "additionalProperties": false, - "required": [ - "x", - "y" - ], "properties": { - "x": { - "type": "integer" - }, - "y": { - "type": "integer" + "position": { + "type": "object", + "additionalProperties": false, + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "integer" + }, + "y": { + "type": "integer" + } + } } } }, diff --git a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml index 254c9bbb04b..1c995cde333 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml +++ b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml @@ -6007,17 +6007,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -6413,17 +6417,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -6699,17 +6707,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -7103,17 +7115,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -7513,17 +7529,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -7914,17 +7934,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -8200,17 +8224,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -8626,17 +8654,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -9864,17 +9896,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false @@ -10267,17 +10303,21 @@ paths: type: object additionalProperties: false properties: - position: + workbench: type: object additionalProperties: false - required: - - x - - 'y' properties: - x: - type: integer - 'y': - type: integer + position: + type: object + additionalProperties: false + required: + - x + - 'y' + properties: + x: + type: integer + 'y': + type: integer slideshow: type: object additionalProperties: false diff --git a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json index 742e1bbbf2c..4ba148fa6f8 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json +++ b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json @@ -334,19 +334,25 @@ "type": "object", "additionalProperties": false, "properties": { - "position": { + "workbench": { "type": "object", "additionalProperties": false, - "required": [ - "x", - "y" - ], "properties": { - "x": { - "type": "integer" - }, - "y": { - "type": "integer" + "position": { + "type": "object", + "additionalProperties": false, + "required": [ + "x", + "y" + ], + "properties": { + "x": { + "type": "integer" + }, + "y": { + "type": "integer" + } + } } } }, From b39e278d3df40d304853461ddce37354dd75c387 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 9 Oct 2020 15:14:58 +0200 Subject: [PATCH 022/110] project and schemas updated --- .../schemas/project-v0.0.1-converted.yaml | 18 +- api/specs/common/schemas/project-v0.0.1.json | 19 +- .../src/models_library/projects.py | 8 +- .../api/v0/schemas/project-v0.0.1.json | 19 +- .../api/v0/openapi.yaml | 72 ++++--- .../api/v0/schemas/project-v0.0.1.json | 19 +- .../api/v0/openapi.yaml | 180 +++++++++++------- .../api/v0/schemas/project-v0.0.1.json | 19 +- 8 files changed, 217 insertions(+), 137 deletions(-) diff --git a/api/specs/common/schemas/project-v0.0.1-converted.yaml b/api/specs/common/schemas/project-v0.0.1-converted.yaml index 662b269d058..4d674ce8582 100644 --- a/api/specs/common/schemas/project-v0.0.1-converted.yaml +++ b/api/specs/common/schemas/project-v0.0.1-converted.yaml @@ -233,12 +233,12 @@ properties: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -253,7 +253,11 @@ properties: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -268,7 +272,7 @@ properties: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 4ba148fa6f8..0601f7e530b 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -329,12 +329,12 @@ }, "ui": { "type": "object", - "patternProperties": { - "^\\S+$": { + "additionalProperties": false, + "properties": { + "workbench": { "type": "object", - "additionalProperties": false, - "properties": { - "workbench": { + "patternProperties": { + "^\\S+$": { "type": "object", "additionalProperties": false, "properties": { @@ -355,8 +355,13 @@ } } } - }, - "slideshow": { + } + } + }, + "slideshow": { + "type": "object", + "patternProperties": { + "^\\S+$": { "type": "object", "additionalProperties": false, "properties": { diff --git a/packages/models-library/src/models_library/projects.py b/packages/models-library/src/models_library/projects.py index 7da834edeed..ef24f72edb7 100644 --- a/packages/models-library/src/models_library/projects.py +++ b/packages/models-library/src/models_library/projects.py @@ -162,9 +162,9 @@ class Config: extra = Extra.forbid -class NodeUI(BaseModel): - workbench: Optional[WorkbenchUI] = Field(...) - slideshow: Optional[Slideshow] = Field(...) +class StudyUI(BaseModel): + workbench: Optional[Dict[NodeID, WorkbenchUI]] = Field(...) + slideshow: Optional[Dict[NodeID, Slideshow]] = Field(...) class Config: extra = Extra.forbid @@ -225,7 +225,7 @@ class Project(BaseModel): example=["https://placeimg.com/171/96/tech/grayscale/?0.jpg"], ) workbench: Dict[NodeID, Node] - ui: Optional[Dict[NodeID, NodeUI]] + ui: Optional[StudyUI] tags: Optional[List[int]] = Field(None) classifiers: Optional[List[ClassifierID]] = Field( None, diff --git a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json index 4ba148fa6f8..0601f7e530b 100644 --- a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json +++ b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json @@ -329,12 +329,12 @@ }, "ui": { "type": "object", - "patternProperties": { - "^\\S+$": { + "additionalProperties": false, + "properties": { + "workbench": { "type": "object", - "additionalProperties": false, - "properties": { - "workbench": { + "patternProperties": { + "^\\S+$": { "type": "object", "additionalProperties": false, "properties": { @@ -355,8 +355,13 @@ } } } - }, - "slideshow": { + } + } + }, + "slideshow": { + "type": "object", + "patternProperties": { + "^\\S+$": { "type": "object", "additionalProperties": false, "properties": { diff --git a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml index de1cbbaab0e..f8cc60e6fd3 100644 --- a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml +++ b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml @@ -1959,12 +1959,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -1979,7 +1979,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -1994,7 +1998,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -2238,12 +2242,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -2258,7 +2262,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -2273,7 +2281,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -2527,12 +2535,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -2547,7 +2555,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -2562,7 +2574,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -2916,12 +2928,12 @@ components: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -2936,7 +2948,11 @@ components: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -2951,7 +2967,7 @@ components: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: diff --git a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json index 4ba148fa6f8..0601f7e530b 100644 --- a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json +++ b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json @@ -329,12 +329,12 @@ }, "ui": { "type": "object", - "patternProperties": { - "^\\S+$": { + "additionalProperties": false, + "properties": { + "workbench": { "type": "object", - "additionalProperties": false, - "properties": { - "workbench": { + "patternProperties": { + "^\\S+$": { "type": "object", "additionalProperties": false, "properties": { @@ -355,8 +355,13 @@ } } } - }, - "slideshow": { + } + } + }, + "slideshow": { + "type": "object", + "patternProperties": { + "^\\S+$": { "type": "object", "additionalProperties": false, "properties": { diff --git a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml index 1c995cde333..c79de9df2e0 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml +++ b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml @@ -6002,12 +6002,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -6022,7 +6022,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -6037,7 +6041,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -6412,12 +6416,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -6432,7 +6436,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -6447,7 +6455,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -6702,12 +6710,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -6722,7 +6730,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -6737,7 +6749,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -7110,12 +7122,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -7130,7 +7142,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -7145,7 +7161,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -7524,12 +7540,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -7544,7 +7560,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -7559,7 +7579,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -7929,12 +7949,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -7949,7 +7969,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -7964,7 +7988,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -8219,12 +8243,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -8239,7 +8263,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -8254,7 +8282,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -8649,12 +8677,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -8669,7 +8697,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -8684,7 +8716,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -9891,12 +9923,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -9911,7 +9943,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -9926,7 +9962,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: @@ -10298,12 +10334,12 @@ paths: additionalProperties: true ui: type: object - x-patternProperties: - ^\S+$: + additionalProperties: false + properties: + workbench: type: object - additionalProperties: false - properties: - workbench: + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -10318,7 +10354,11 @@ paths: type: integer 'y': type: integer - slideshow: + additionalProperties: true + slideshow: + type: object + x-patternProperties: + ^\S+$: type: object additionalProperties: false properties: @@ -10333,7 +10373,7 @@ paths: example: - '0' - '2' - additionalProperties: true + additionalProperties: true tags: type: array items: diff --git a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json index 4ba148fa6f8..0601f7e530b 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json +++ b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json @@ -329,12 +329,12 @@ }, "ui": { "type": "object", - "patternProperties": { - "^\\S+$": { + "additionalProperties": false, + "properties": { + "workbench": { "type": "object", - "additionalProperties": false, - "properties": { - "workbench": { + "patternProperties": { + "^\\S+$": { "type": "object", "additionalProperties": false, "properties": { @@ -355,8 +355,13 @@ } } } - }, - "slideshow": { + } + } + }, + "slideshow": { + "type": "object", + "patternProperties": { + "^\\S+$": { "type": "object", "additionalProperties": false, "properties": { From 4e61330f29d04d8a64010c03cc24d4bf808ed838 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 9 Oct 2020 15:15:05 +0200 Subject: [PATCH 023/110] serialize/desirialize node position --- .../source/class/osparc/data/model/Node.js | 18 +++++++---------- .../source/class/osparc/data/model/Study.js | 20 ++++++++++++++++++- .../class/osparc/data/model/Workbench.js | 20 ++++++++++++------- .../class/osparc/desktop/StudyEditor.js | 3 +-- 4 files changed, 40 insertions(+), 21 deletions(-) diff --git a/services/web/client/source/class/osparc/data/model/Node.js b/services/web/client/source/class/osparc/data/model/Node.js index 76ba679dbbe..d36764fc300 100644 --- a/services/web/client/source/class/osparc/data/model/Node.js +++ b/services/web/client/source/class/osparc/data/model/Node.js @@ -347,10 +347,6 @@ qx.Class.define("osparc.data.model.Node", { this.populateInputOutputData(nodeData); - if (nodeData.position) { - this.setPosition(nodeData.position.x, nodeData.position.y); - } - if (nodeData.progress) { this.getStatus().setProgress(nodeData.progress); } @@ -373,6 +369,13 @@ qx.Class.define("osparc.data.model.Node", { } }, + populateNodeUIData: function(nodeUIData) { + if ("workbench" in nodeUIData && nodeUIData.workbench.position) { + const pos = nodeUIData.workbench.position; + this.setPosition(pos.x, pos.y); + } + }, + populateInputOutputData: function(nodeData) { this.setInputData(nodeData.inputs); this.setInputDataAccess(nodeData.inputAccess); @@ -1151,13 +1154,6 @@ qx.Class.define("osparc.data.model.Node", { nodeEntry.outputs = this.getOutputValues(); nodeEntry.progress = this.getStatus().getProgress(); } - - if (savePosition) { - nodeEntry.position = { - x: this.getPosition().x ? this.getPosition().x : 0, - y: this.getPosition().y ? this.getPosition().y : 0 - }; - } // remove null entries from the payload let filteredNodeEntry = {}; for (const key in nodeEntry) { diff --git a/services/web/client/source/class/osparc/data/model/Study.js b/services/web/client/source/class/osparc/data/model/Study.js index a39e98bc569..42168a59c56 100644 --- a/services/web/client/source/class/osparc/data/model/Study.js +++ b/services/web/client/source/class/osparc/data/model/Study.js @@ -56,7 +56,8 @@ qx.Class.define("osparc.data.model.Study", { }); const wbData = studyData.workbench === undefined ? {} : studyData.workbench; - this.setWorkbench(new osparc.data.model.Workbench(wbData)); + this.setWorkbench(new osparc.data.model.Workbench(wbData, studyData.ui)); + this.setUi(studyData.ui); this.setSweeper(new osparc.data.model.Sweeper(studyData)); }, @@ -122,6 +123,10 @@ qx.Class.define("osparc.data.model.Study", { nullable: false }, + ui: { + check: "Object" + }, + classifiers: { check: "Array", init: [] @@ -254,6 +259,19 @@ qx.Class.define("osparc.data.model.Study", { jsonObject["dev"]["sweeper"] = this.getSweeper().serializeSweeper(); return; } + if (key === "ui") { + jsonObject["ui"] = {}; + jsonObject["ui"]["workbench"] = {}; + const nodes = this.getWorkbench().getNodes(true); + for (const nodeUuid in nodes) { + jsonObject["ui"][nodeUuid] = {}; + jsonObject["ui"][nodeUuid]["workbench"] = {}; + } + for (const nodeUuid in nodes) { + const node = nodes[nodeUuid]; + jsonObject["ui"][nodeUuid]["workbench"]["position"] = node.getPosition(); + } + } let value = key === "workbench" ? this.getWorkbench().serializeWorkbench() : this.get(key); if (value !== null) { // only put the value in the payload if there is a value diff --git a/services/web/client/source/class/osparc/data/model/Workbench.js b/services/web/client/source/class/osparc/data/model/Workbench.js index f29e22afbdc..4620b22bd31 100644 --- a/services/web/client/source/class/osparc/data/model/Workbench.js +++ b/services/web/client/source/class/osparc/data/model/Workbench.js @@ -41,10 +41,11 @@ qx.Class.define("osparc.data.model.Workbench", { /** * @param workbenchData {Object} Object containing the workbench raw data */ - construct: function(workbenchData) { + construct: function(workbenchData, workbenchUIData) { this.base(arguments); this.__workbenchInitData = workbenchData; + this.__workbenchUIInitData = workbenchUIData; }, events: { @@ -55,14 +56,16 @@ qx.Class.define("osparc.data.model.Workbench", { members: { __workbenchInitData: null, + __workbenchUIInitData: null, __rootNodes: null, __edges: null, buildWorkbench: function() { this.__rootNodes = {}; this.__edges = {}; - this.__deserializeWorkbench(this.__workbenchInitData); + this.__deserializeWorkbench(this.__workbenchInitData, this.__workbenchUIInitData); this.__workbenchInitData = null; + this.__workbenchUIInitData = null; }, initWorkbench: function() { @@ -340,12 +343,12 @@ qx.Class.define("osparc.data.model.Workbench", { } }, - __deserializeWorkbench: function(workbenchData) { - this.__deserializeNodes(workbenchData); + __deserializeWorkbench: function(workbenchData, workbenchUIData) { + this.__deserializeNodes(workbenchData, workbenchUIData); this.__deserializeEdges(workbenchData); }, - __deserializeNodes: function(workbenchData) { + __deserializeNodes: function(workbenchData, workbenchUIData = {}) { let keys = Object.keys(workbenchData); // Create first all the nodes for (let i=0; i Date: Fri, 9 Oct 2020 15:38:14 +0200 Subject: [PATCH 024/110] Update projects.py --- packages/models-library/src/models_library/projects.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/models-library/src/models_library/projects.py b/packages/models-library/src/models_library/projects.py index ef24f72edb7..f88bb5f8eda 100644 --- a/packages/models-library/src/models_library/projects.py +++ b/packages/models-library/src/models_library/projects.py @@ -11,6 +11,10 @@ DATE_RE = r"\d{4}-(12|11|10|0?[1-9])-(31|30|[0-2]?\d)T(2[0-3]|1\d|0?[0-9])(:(\d|[0-5]\d)){2}(\.\d{3})?Z" +GroupID = constr(regex=r"^\d+$") +NodeID = constr(regex=r"^\d+$") +ClassifierID = str + class PortLink(BaseModel): nodeUuid: UUID4 = Field( @@ -179,11 +183,6 @@ class Config: extra = Extra.forbid -GroupID = constr(regex=r"^\d+$") -NodeID = constr(regex=r"^\d+$") -ClassifierID = str - - class Project(BaseModel): uuid: UUID4 = Field( ..., From 42775fef915c1cf86814e1133083595a15a65da1 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 10:30:55 +0200 Subject: [PATCH 025/110] position is not required anymore --- api/specs/common/schemas/project-v0.0.1-converted.yaml | 1 - api/specs/common/schemas/project-v0.0.1.json | 3 +-- .../api/v0/schemas/project-v0.0.1.json | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/api/specs/common/schemas/project-v0.0.1-converted.yaml b/api/specs/common/schemas/project-v0.0.1-converted.yaml index 4d674ce8582..e2e227ac9c3 100644 --- a/api/specs/common/schemas/project-v0.0.1-converted.yaml +++ b/api/specs/common/schemas/project-v0.0.1-converted.yaml @@ -80,7 +80,6 @@ properties: - key - version - label - - position properties: key: type: string diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 0601f7e530b..8e31f5edb24 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -107,8 +107,7 @@ "required": [ "key", "version", - "label", - "position" + "label" ], "properties": { "key": { diff --git a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json index 0601f7e530b..8e31f5edb24 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json +++ b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json @@ -107,8 +107,7 @@ "required": [ "key", "version", - "label", - "position" + "label" ], "properties": { "key": { From 7e562d5dd142222e3bfb1367d4bdd991b9cfefa8 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 10:31:07 +0200 Subject: [PATCH 026/110] position is not required anymore II --- .../api/v0/schemas/project-v0.0.1.json | 3 +-- .../src/simcore_service_storage/api/v0/openapi.yaml | 4 ---- .../api/v0/schemas/project-v0.0.1.json | 3 +-- .../src/simcore_service_webserver/api/v0/openapi.yaml | 10 ---------- 4 files changed, 2 insertions(+), 18 deletions(-) diff --git a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json index 0601f7e530b..8e31f5edb24 100644 --- a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json +++ b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json @@ -107,8 +107,7 @@ "required": [ "key", "version", - "label", - "position" + "label" ], "properties": { "key": { diff --git a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml index f8cc60e6fd3..3710ef98827 100644 --- a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml +++ b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml @@ -1808,7 +1808,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -2091,7 +2090,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -2384,7 +2382,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -2777,7 +2774,6 @@ components: - key - version - label - - position properties: key: type: string diff --git a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json index 0601f7e530b..8e31f5edb24 100644 --- a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json +++ b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json @@ -107,8 +107,7 @@ "required": [ "key", "version", - "label", - "position" + "label" ], "properties": { "key": { diff --git a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml index c79de9df2e0..4db3d2dc6f2 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml +++ b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml @@ -5851,7 +5851,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -6265,7 +6264,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -6559,7 +6557,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -6971,7 +6968,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -7389,7 +7385,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -7798,7 +7793,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -8092,7 +8086,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -8526,7 +8519,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -9772,7 +9764,6 @@ paths: - key - version - label - - position properties: key: type: string @@ -10183,7 +10174,6 @@ paths: - key - version - label - - position properties: key: type: string From ecae08c31afd943a407ae1c05a2bd5af29699bac Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 11:14:17 +0200 Subject: [PATCH 027/110] deserialize position --- .../src/simcore_postgres_database/models/projects.py | 1 + .../web/client/source/class/osparc/data/model/Node.js | 4 ++-- .../web/client/source/class/osparc/data/model/Study.js | 8 +++----- .../client/source/class/osparc/data/model/Workbench.js | 5 ++++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/postgres-database/src/simcore_postgres_database/models/projects.py b/packages/postgres-database/src/simcore_postgres_database/models/projects.py index 8373b06098a..557d86e4ed6 100644 --- a/packages/postgres-database/src/simcore_postgres_database/models/projects.py +++ b/packages/postgres-database/src/simcore_postgres_database/models/projects.py @@ -61,6 +61,7 @@ class ProjectType(enum.Enum): "access_rights", JSONB, nullable=False, server_default=sa.text("'{}'::jsonb") ), sa.Column("workbench", sa.JSON, nullable=False), + sa.Column("ui", JSONB, nullable=False, server_default=sa.text("'{}'::jsonb")), sa.Column( "classifiers", ARRAY(sa.String, dimensions=1), diff --git a/services/web/client/source/class/osparc/data/model/Node.js b/services/web/client/source/class/osparc/data/model/Node.js index d36764fc300..b704da92689 100644 --- a/services/web/client/source/class/osparc/data/model/Node.js +++ b/services/web/client/source/class/osparc/data/model/Node.js @@ -370,8 +370,8 @@ qx.Class.define("osparc.data.model.Node", { }, populateNodeUIData: function(nodeUIData) { - if ("workbench" in nodeUIData && nodeUIData.workbench.position) { - const pos = nodeUIData.workbench.position; + if ("position" in nodeUIData) { + const pos = nodeUIData.position; this.setPosition(pos.x, pos.y); } }, diff --git a/services/web/client/source/class/osparc/data/model/Study.js b/services/web/client/source/class/osparc/data/model/Study.js index 42168a59c56..2df89ccf071 100644 --- a/services/web/client/source/class/osparc/data/model/Study.js +++ b/services/web/client/source/class/osparc/data/model/Study.js @@ -263,14 +263,12 @@ qx.Class.define("osparc.data.model.Study", { jsonObject["ui"] = {}; jsonObject["ui"]["workbench"] = {}; const nodes = this.getWorkbench().getNodes(true); - for (const nodeUuid in nodes) { - jsonObject["ui"][nodeUuid] = {}; - jsonObject["ui"][nodeUuid]["workbench"] = {}; - } for (const nodeUuid in nodes) { const node = nodes[nodeUuid]; - jsonObject["ui"][nodeUuid]["workbench"]["position"] = node.getPosition(); + jsonObject["ui"]["workbench"][nodeUuid] = {}; + jsonObject["ui"]["workbench"][nodeUuid]["position"] = node.getPosition(); } + return; } let value = key === "workbench" ? this.getWorkbench().serializeWorkbench() : this.get(key); if (value !== null) { diff --git a/services/web/client/source/class/osparc/data/model/Workbench.js b/services/web/client/source/class/osparc/data/model/Workbench.js index 4620b22bd31..26d7d24a180 100644 --- a/services/web/client/source/class/osparc/data/model/Workbench.js +++ b/services/web/client/source/class/osparc/data/model/Workbench.js @@ -384,9 +384,12 @@ qx.Class.define("osparc.data.model.Workbench", { const nodeId = keys[i]; const nodeData = workbenchData[nodeId]; this.getNode(nodeId).populateNodeData(nodeData); - if (nodeId in workbenchUIData) { + if ("position" in nodeData) { this.getNode(nodeId).populateNodeUIData(nodeData); } + if ("workbench" in workbenchUIData && nodeId in workbenchUIData.workbench) { + this.getNode(nodeId).populateNodeUIData(workbenchUIData.workbench[nodeId]); + } } for (let i=0; i Date: Mon, 12 Oct 2020 11:45:17 +0200 Subject: [PATCH 028/110] position required for ui.workbench and ui.slideShow --- .../schemas/project-v0.0.1-converted.yaml | 4 ++ api/specs/common/schemas/project-v0.0.1.json | 6 +++ .../api/v0/schemas/project-v0.0.1.json | 6 +++ .../api/v0/openapi.yaml | 16 ++++++++ .../api/v0/schemas/project-v0.0.1.json | 6 +++ .../api/v0/openapi.yaml | 40 +++++++++++++++++++ .../api/v0/schemas/project-v0.0.1.json | 6 +++ 7 files changed, 84 insertions(+) diff --git a/api/specs/common/schemas/project-v0.0.1-converted.yaml b/api/specs/common/schemas/project-v0.0.1-converted.yaml index e2e227ac9c3..f7dbe20a819 100644 --- a/api/specs/common/schemas/project-v0.0.1-converted.yaml +++ b/api/specs/common/schemas/project-v0.0.1-converted.yaml @@ -240,6 +240,8 @@ properties: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -259,6 +261,8 @@ properties: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 8e31f5edb24..87e76fcc86d 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -336,6 +336,9 @@ "^\\S+$": { "type": "object", "additionalProperties": false, + "required": [ + "position" + ], "properties": { "position": { "type": "object", @@ -363,6 +366,9 @@ "^\\S+$": { "type": "object", "additionalProperties": false, + "required": [ + "position" + ], "properties": { "slideType": { "type": "string", diff --git a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json index 8e31f5edb24..87e76fcc86d 100644 --- a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json +++ b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json @@ -336,6 +336,9 @@ "^\\S+$": { "type": "object", "additionalProperties": false, + "required": [ + "position" + ], "properties": { "position": { "type": "object", @@ -363,6 +366,9 @@ "^\\S+$": { "type": "object", "additionalProperties": false, + "required": [ + "position" + ], "properties": { "slideType": { "type": "string", diff --git a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml index 3710ef98827..684b046a85b 100644 --- a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml +++ b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml @@ -1966,6 +1966,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -1985,6 +1987,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -2248,6 +2252,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -2267,6 +2273,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -2540,6 +2548,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -2559,6 +2569,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -2932,6 +2944,8 @@ components: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -2951,6 +2965,8 @@ components: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string diff --git a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json index 8e31f5edb24..87e76fcc86d 100644 --- a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json +++ b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json @@ -336,6 +336,9 @@ "^\\S+$": { "type": "object", "additionalProperties": false, + "required": [ + "position" + ], "properties": { "position": { "type": "object", @@ -363,6 +366,9 @@ "^\\S+$": { "type": "object", "additionalProperties": false, + "required": [ + "position" + ], "properties": { "slideType": { "type": "string", diff --git a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml index 4db3d2dc6f2..b8b8a0949a8 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml +++ b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml @@ -6009,6 +6009,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -6028,6 +6030,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -6422,6 +6426,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -6441,6 +6447,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -6715,6 +6723,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -6734,6 +6744,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -7126,6 +7138,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -7145,6 +7159,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -7543,6 +7559,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -7562,6 +7580,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -7951,6 +7971,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -7970,6 +7992,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -8244,6 +8268,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -8263,6 +8289,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -8677,6 +8705,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -8696,6 +8726,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -9922,6 +9954,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -9941,6 +9975,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string @@ -10332,6 +10368,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: position: type: object @@ -10351,6 +10389,8 @@ paths: ^\S+$: type: object additionalProperties: false + required: + - position properties: slideType: type: string diff --git a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json index 8e31f5edb24..87e76fcc86d 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json +++ b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json @@ -336,6 +336,9 @@ "^\\S+$": { "type": "object", "additionalProperties": false, + "required": [ + "position" + ], "properties": { "position": { "type": "object", @@ -363,6 +366,9 @@ "^\\S+$": { "type": "object", "additionalProperties": false, + "required": [ + "position" + ], "properties": { "slideType": { "type": "string", From f5184893627d8eab0ca20aa293875e0cc66f3a34 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 11:58:11 +0200 Subject: [PATCH 029/110] Serialize slideshow --- .../osparc/component/widget/NodesSlidesTree.js | 18 ++++++++++++++++-- .../source/class/osparc/data/model/Study.js | 6 ++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index e7664c4f04f..4c7f6e4e374 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -29,7 +29,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { this.__tree = this._createChildControlImpl("tree"); const save = this._createChildControlImpl("save-button"); - save.addListener("execute", () => this.__saveSlides, this); + save.addListener("execute", () => this.__saveSlides(), this); const model = this.__initTree(); this.__tree.setModel(model); @@ -212,7 +212,21 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { }, __saveSlides: function() { - console.log("Serialize me", this.__tree.getModel()); + let slideShow = {}; + const model = this.__tree.getModel(); + const children = model.getChildren().toArray(); + children.forEach(child => { + if (child.getSkipNode() === false) { + slideShow[child.getNodeId()] = { + "slideType": "slide", + "position": child.getPosition() + }; + } + }); + console.log("Serialize me", slideShow); + const study = osparc.store.Store.getInstance().getCurrentStudy(); + const studyUI = study.getUi(); + studyUI["slideShow"] = slideShow; } } }); diff --git a/services/web/client/source/class/osparc/data/model/Study.js b/services/web/client/source/class/osparc/data/model/Study.js index 2df89ccf071..3fe6e99c7e5 100644 --- a/services/web/client/source/class/osparc/data/model/Study.js +++ b/services/web/client/source/class/osparc/data/model/Study.js @@ -260,8 +260,10 @@ qx.Class.define("osparc.data.model.Study", { return; } if (key === "ui") { - jsonObject["ui"] = {}; - jsonObject["ui"]["workbench"] = {}; + jsonObject["ui"] = this.getUi(); + if (!("workbench" in jsonObject["ui"])) { + jsonObject["ui"]["workbench"] = {}; + } const nodes = this.getWorkbench().getNodes(true); for (const nodeUuid in nodes) { const node = nodes[nodeUuid]; From 9ca6fe95681704441c1c4c0eadba5694ff5804f2 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 11:58:27 +0200 Subject: [PATCH 030/110] Slide's position is int --- .../schemas/project-v0.0.1-converted.yaml | 6 +- api/specs/common/schemas/project-v0.0.1.json | 6 +- .../api/v0/schemas/project-v0.0.1.json | 6 +- .../api/v0/openapi.yaml | 24 ++++---- .../api/v0/schemas/project-v0.0.1.json | 6 +- .../api/v0/openapi.yaml | 60 +++++++++---------- .../api/v0/schemas/project-v0.0.1.json | 6 +- 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/api/specs/common/schemas/project-v0.0.1-converted.yaml b/api/specs/common/schemas/project-v0.0.1-converted.yaml index f7dbe20a819..0b7c6bfb20a 100644 --- a/api/specs/common/schemas/project-v0.0.1-converted.yaml +++ b/api/specs/common/schemas/project-v0.0.1-converted.yaml @@ -270,11 +270,11 @@ properties: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 87e76fcc86d..f6423f0c82f 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -378,11 +378,11 @@ ] }, "position": { - "type": "number", + "type": "integer", "description": "Slide's position", "examples": [ - "0", - "2" + 0, + 2 ] } } diff --git a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json index 87e76fcc86d..f6423f0c82f 100644 --- a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json +++ b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json @@ -378,11 +378,11 @@ ] }, "position": { - "type": "number", + "type": "integer", "description": "Slide's position", "examples": [ - "0", - "2" + 0, + 2 ] } } diff --git a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml index 684b046a85b..27f13367b1a 100644 --- a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml +++ b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml @@ -1996,11 +1996,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -2282,11 +2282,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -2578,11 +2578,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -2974,11 +2974,11 @@ components: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array diff --git a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json index 87e76fcc86d..f6423f0c82f 100644 --- a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json +++ b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json @@ -378,11 +378,11 @@ ] }, "position": { - "type": "number", + "type": "integer", "description": "Slide's position", "examples": [ - "0", - "2" + 0, + 2 ] } } diff --git a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml index b8b8a0949a8..ac0b9b1517f 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml +++ b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml @@ -6039,11 +6039,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -6456,11 +6456,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -6753,11 +6753,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -7168,11 +7168,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -7589,11 +7589,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -8001,11 +8001,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -8298,11 +8298,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -8735,11 +8735,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -9984,11 +9984,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array @@ -10398,11 +10398,11 @@ paths: example: - slide position: - type: number + type: integer description: Slide's position example: - - '0' - - '2' + - 0 + - 2 additionalProperties: true tags: type: array diff --git a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json index 87e76fcc86d..f6423f0c82f 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json +++ b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json @@ -378,11 +378,11 @@ ] }, "position": { - "type": "number", + "type": "integer", "description": "Slide's position", "examples": [ - "0", - "2" + 0, + 2 ] } } From d52b4023b68abdeca1fd53da291d23855bac0a5f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 13:25:22 +0200 Subject: [PATCH 031/110] refactoring --- .../client/source/class/osparc/data/model/Study.js | 10 +--------- .../source/class/osparc/data/model/Workbench.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/services/web/client/source/class/osparc/data/model/Study.js b/services/web/client/source/class/osparc/data/model/Study.js index 3fe6e99c7e5..27cc958f928 100644 --- a/services/web/client/source/class/osparc/data/model/Study.js +++ b/services/web/client/source/class/osparc/data/model/Study.js @@ -261,15 +261,7 @@ qx.Class.define("osparc.data.model.Study", { } if (key === "ui") { jsonObject["ui"] = this.getUi(); - if (!("workbench" in jsonObject["ui"])) { - jsonObject["ui"]["workbench"] = {}; - } - const nodes = this.getWorkbench().getNodes(true); - for (const nodeUuid in nodes) { - const node = nodes[nodeUuid]; - jsonObject["ui"]["workbench"][nodeUuid] = {}; - jsonObject["ui"]["workbench"][nodeUuid]["position"] = node.getPosition(); - } + jsonObject["ui"]["workbench"] = this.getWorkbench().serializeWorkbenchUI(); return; } let value = key === "workbench" ? this.getWorkbench().serializeWorkbench() : this.get(key); diff --git a/services/web/client/source/class/osparc/data/model/Workbench.js b/services/web/client/source/class/osparc/data/model/Workbench.js index 26d7d24a180..1c982273a46 100644 --- a/services/web/client/source/class/osparc/data/model/Workbench.js +++ b/services/web/client/source/class/osparc/data/model/Workbench.js @@ -575,6 +575,17 @@ qx.Class.define("osparc.data.model.Workbench", { } } return workbench; + }, + + serializeWorkbenchUI: function() { + let workbenchUI = {}; + const nodes = this.getNodes(true); + for (const nodeUuid in nodes) { + const node = nodes[nodeUuid]; + workbenchUI[nodeUuid] = {}; + workbenchUI[nodeUuid]["position"] = node.getPosition(); + } + return workbenchUI; } } }); From a6135462c3d0c0c2bafc1ce8a608d01025a674ef Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 13:31:45 +0200 Subject: [PATCH 032/110] renamings --- .../class/osparc/component/export/ExportDAG.js | 2 +- .../class/osparc/component/metadata/StudyInfo.js | 2 +- .../class/osparc/component/node/BaseNodeView.js | 2 +- .../source/class/osparc/component/sweeper/Sweeper.js | 2 +- .../client/source/class/osparc/data/model/Node.js | 6 +----- .../client/source/class/osparc/data/model/Study.js | 10 +++++----- .../client/source/class/osparc/data/model/Sweeper.js | 6 +++--- .../source/class/osparc/data/model/Workbench.js | 12 ++++++------ .../source/class/osparc/desktop/StudyEditor.js | 6 +++--- 9 files changed, 22 insertions(+), 26 deletions(-) diff --git a/services/web/client/source/class/osparc/component/export/ExportDAG.js b/services/web/client/source/class/osparc/component/export/ExportDAG.js index a0bb4a45e55..1c4de4ada30 100644 --- a/services/web/client/source/class/osparc/component/export/ExportDAG.js +++ b/services/web/client/source/class/osparc/component/export/ExportDAG.js @@ -164,7 +164,7 @@ qx.Class.define("osparc.component.export.ExportDAG", { nodesGroupService["name"] = this.__groupName.getValue(); nodesGroupService["description"] = this.__groupDesc.getValue(); nodesGroupService["contact"] = osparc.auth.Data.getInstance().getEmail(); - nodesGroupService["workbench"] = outputWorkbench.serializeWorkbench(); + nodesGroupService["workbench"] = outputWorkbench.serialize(); // Use editorValues const innerNodes = this.getOutputWorkbench().getNodes(true); diff --git a/services/web/client/source/class/osparc/component/metadata/StudyInfo.js b/services/web/client/source/class/osparc/component/metadata/StudyInfo.js index d233487aa3e..1ebd03f6798 100644 --- a/services/web/client/source/class/osparc/component/metadata/StudyInfo.js +++ b/services/web/client/source/class/osparc/component/metadata/StudyInfo.js @@ -76,7 +76,7 @@ qx.Class.define("osparc.component.metadata.StudyInfo", { const width = 500; const height = 500; const title = this.tr("Study Details Editor"); - const studyDetailsEditor = new osparc.component.metadata.StudyDetailsEditor(this.getStudy().serializeStudy(), false, width); + const studyDetailsEditor = new osparc.component.metadata.StudyDetailsEditor(this.getStudy().serialize(), false, width); studyDetailsEditor.showOpenButton(false); const win = osparc.ui.window.Window.popUpInWindow(studyDetailsEditor, title, width, height); studyDetailsEditor.addListener("updateStudy", e => { diff --git a/services/web/client/source/class/osparc/component/node/BaseNodeView.js b/services/web/client/source/class/osparc/component/node/BaseNodeView.js index c3708fb20ff..8d769b3df18 100644 --- a/services/web/client/source/class/osparc/component/node/BaseNodeView.js +++ b/services/web/client/source/class/osparc/component/node/BaseNodeView.js @@ -224,7 +224,7 @@ qx.Class.define("osparc.component.node.BaseNodeView", { if (node) { node.renameNode(evt.getData()); } - qx.event.message.Bus.getInstance().dispatchByName("updateStudy", study.serializeStudy()); + qx.event.message.Bus.getInstance().dispatchByName("updateStudy", study.serialize()); } }, this); titlePart.add(title); diff --git a/services/web/client/source/class/osparc/component/sweeper/Sweeper.js b/services/web/client/source/class/osparc/component/sweeper/Sweeper.js index ee77af41437..c882ecbbe9a 100644 --- a/services/web/client/source/class/osparc/component/sweeper/Sweeper.js +++ b/services/web/client/source/class/osparc/component/sweeper/Sweeper.js @@ -201,7 +201,7 @@ qx.Class.define("osparc.component.sweeper.Sweeper", { __recreateIterations: function() { return new Promise((resolve, reject) => { - const primaryStudyData = this.__primaryStudy.serializeStudy(); + const primaryStudyData = this.__primaryStudy.serialize(); this.__primaryStudy.getSweeper().recreateIterations(primaryStudyData) .then(secondaryStudyIds => { const msg = secondaryStudyIds.length + this.tr(" Iterations created"); diff --git a/services/web/client/source/class/osparc/data/model/Node.js b/services/web/client/source/class/osparc/data/model/Node.js index b704da92689..88a08eabe41 100644 --- a/services/web/client/source/class/osparc/data/model/Node.js +++ b/services/web/client/source/class/osparc/data/model/Node.js @@ -1129,11 +1129,7 @@ qx.Class.define("osparc.data.model.Node", { }; }, - serialize: function(saveContainers = true, savePosition = true) { - if (!saveContainers && this.isContainer()) { - return null; - } - + serialize: function() { // node generic let nodeEntry = { key: this.getKey(), diff --git a/services/web/client/source/class/osparc/data/model/Study.js b/services/web/client/source/class/osparc/data/model/Study.js index 27cc958f928..2e0c417a083 100644 --- a/services/web/client/source/class/osparc/data/model/Study.js +++ b/services/web/client/source/class/osparc/data/model/Study.js @@ -246,7 +246,7 @@ qx.Class.define("osparc.data.model.Study", { } }, - serializeStudy: function() { + serialize: function() { let jsonObject = {}; const propertyKeys = this.self().getProperties(); propertyKeys.forEach(key => { @@ -256,15 +256,15 @@ qx.Class.define("osparc.data.model.Study", { } if (key === "sweeper") { jsonObject["dev"] = {}; - jsonObject["dev"]["sweeper"] = this.getSweeper().serializeSweeper(); + jsonObject["dev"]["sweeper"] = this.getSweeper().serialize(); return; } if (key === "ui") { jsonObject["ui"] = this.getUi(); - jsonObject["ui"]["workbench"] = this.getWorkbench().serializeWorkbenchUI(); + jsonObject["ui"]["workbench"] = this.getWorkbench().serializeUI(); return; } - let value = key === "workbench" ? this.getWorkbench().serializeWorkbench() : this.get(key); + let value = key === "workbench" ? this.getWorkbench().serialize() : this.get(key); if (value !== null) { // only put the value in the payload if there is a value jsonObject[key] = value; @@ -275,7 +275,7 @@ qx.Class.define("osparc.data.model.Study", { updateStudy: function(params) { return this.self().updateStudy({ - ...this.serializeStudy(), + ...this.serialize(), ...params }) .then(data => { diff --git a/services/web/client/source/class/osparc/data/model/Sweeper.js b/services/web/client/source/class/osparc/data/model/Sweeper.js index 63cbf1eafe7..0eca2316b89 100644 --- a/services/web/client/source/class/osparc/data/model/Sweeper.js +++ b/services/web/client/source/class/osparc/data/model/Sweeper.js @@ -35,7 +35,7 @@ qx.Class.define("osparc.data.model.Sweeper", { this.__primaryStudyId = null; if ("dev" in studyData && "sweeper" in studyData["dev"]) { - this.deserializeSweeper(studyData["dev"]["sweeper"]); + this.deserialize(studyData["dev"]["sweeper"]); } }, @@ -223,7 +223,7 @@ qx.Class.define("osparc.data.model.Sweeper", { }); }, - serializeSweeper: function() { + serialize: function() { const obj = {}; if (this.hasParameters()) { @@ -262,7 +262,7 @@ qx.Class.define("osparc.data.model.Sweeper", { return obj; }, - deserializeSweeper: function(sweeperData) { + deserialize: function(sweeperData) { if ("parameters" in sweeperData) { this.__setParameters(sweeperData["parameters"]); } diff --git a/services/web/client/source/class/osparc/data/model/Workbench.js b/services/web/client/source/class/osparc/data/model/Workbench.js index 1c982273a46..b70af60f8a6 100644 --- a/services/web/client/source/class/osparc/data/model/Workbench.js +++ b/services/web/client/source/class/osparc/data/model/Workbench.js @@ -63,7 +63,7 @@ qx.Class.define("osparc.data.model.Workbench", { buildWorkbench: function() { this.__rootNodes = {}; this.__edges = {}; - this.__deserializeWorkbench(this.__workbenchInitData, this.__workbenchUIInitData); + this.__deserialize(this.__workbenchInitData, this.__workbenchUIInitData); this.__workbenchInitData = null; this.__workbenchUIInitData = null; }, @@ -216,7 +216,7 @@ qx.Class.define("osparc.data.model.Workbench", { workbench[innerNodeId]["parent"] = workbench[innerNodeId]["parent"] || parentNode.getNodeId(); } - this.__deserializeWorkbench(workbench); + this.__deserialize(workbench); for (let innerNodeId in workbench) { this.getNode(innerNodeId).startInBackend(); @@ -343,7 +343,7 @@ qx.Class.define("osparc.data.model.Workbench", { } }, - __deserializeWorkbench: function(workbenchData, workbenchUIData) { + __deserialize: function(workbenchData, workbenchUIData) { this.__deserializeNodes(workbenchData, workbenchUIData); this.__deserializeEdges(workbenchData); }, @@ -564,12 +564,12 @@ qx.Class.define("osparc.data.model.Workbench", { this.removeNode(nodesGroup.getNodeId()); }, - serializeWorkbench: function(saveContainers = true) { + serialize: function() { let workbench = {}; const allModels = this.getNodes(true); const nodes = Object.values(allModels); for (const node of nodes) { - const data = node.serialize(saveContainers); + const data = node.serialize(); if (data) { workbench[node.getNodeId()] = data; } @@ -577,7 +577,7 @@ qx.Class.define("osparc.data.model.Workbench", { return workbench; }, - serializeWorkbenchUI: function() { + serializeUI: function() { let workbenchUI = {}; const nodes = this.getNodes(true); for (const nodeUuid in nodes) { diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 89337ba48b1..9c0b75e9b04 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -425,7 +425,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { __getCurrentPipeline: function() { const saveContainers = false; - const currentPipeline = this.getStudy().getWorkbench().serializeWorkbench(saveContainers); + const currentPipeline = this.getStudy().getWorkbench().serialize(saveContainers); return currentPipeline; }, @@ -620,7 +620,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { const interval = 5000; let timer = this.__autoSaveTimer = new qx.event.Timer(interval); timer.addListener("interval", () => { - const newObj = this.getStudy().serializeStudy(); + const newObj = this.getStudy().serialize(); const delta = diffPatcher.diff(this.__lastSavedStudy, newObj); if (delta) { let deltaKeys = Object.keys(delta); @@ -646,7 +646,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { updateStudyDocument: function(run=false) { this.getStudy().setLastChangeDate(new Date()); - const newObj = this.getStudy().serializeStudy(); + const newObj = this.getStudy().serialize(); const prjUuid = this.getStudy().getUuid(); const params = { From 78df3a1fc64077e7648d2cc8206dd95b516e5102 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 14:00:57 +0200 Subject: [PATCH 033/110] deserialize slideShow --- .../component/widget/NodesSlidesTree.js | 27 ++++++++++++------- .../class/osparc/desktop/StudyEditor.js | 3 ++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 4c7f6e4e374..875bbd55a1d 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -22,7 +22,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { extend: qx.ui.core.Widget, - construct: function() { + construct: function(initData = {}) { this.base(arguments); this._setLayout(new qx.ui.layout.VBox(10)); @@ -31,7 +31,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { const save = this._createChildControlImpl("save-button"); save.addListener("execute", () => this.__saveSlides(), this); - const model = this.__initTree(); + const model = this.__initTree(initData); this.__tree.setModel(model); this.__populateTree(); @@ -101,18 +101,25 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { return tree; }, - __initTree: function() { + __initTree: function(initData) { const study = osparc.store.Store.getInstance().getCurrentStudy(); const topLevelNodes = study.getWorkbench().getNodes(); - let data = { + let rootData = { label: study.getName(), children: this.self().convertModel(topLevelNodes), nodeId: study.getUuid(), skipNode: null, position: null }; - let model = qx.data.marshal.Json.createModel(data, true); - return model; + const children = rootData.children; + for (let nodeId in initData) { + const idx = children.findIndex(child => child.nodeId === nodeId); + if (idx > -1) { + children[idx].position = initData[nodeId].position; + children[idx].skipNode = initData[nodeId].skipNode; + } + } + return qx.data.marshal.Json.createModel(rootData, true); }, __populateTree: function() { @@ -212,21 +219,21 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { }, __saveSlides: function() { - let slideShow = {}; + let slideshow = {}; const model = this.__tree.getModel(); const children = model.getChildren().toArray(); children.forEach(child => { if (child.getSkipNode() === false) { - slideShow[child.getNodeId()] = { + slideshow[child.getNodeId()] = { "slideType": "slide", "position": child.getPosition() }; } }); - console.log("Serialize me", slideShow); + console.log("Serialize me", slideshow); const study = osparc.store.Store.getInstance().getCurrentStudy(); const studyUI = study.getUi(); - studyUI["slideShow"] = slideShow; + studyUI["slideshow"] = slideshow; } } }); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 9c0b75e9b04..6eed38954a4 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -445,7 +445,8 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, __showEditSlides: function() { - const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(); + const uiData = this.getStudy().getUi(); + const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(uiData["slideshow"]); const title = this.tr("Edit Slides"); osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 600, 500).set({ modal: false, From ae0e3746634cadec69dbd28d6e4fd1cf9f65dd28 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 14:21:37 +0200 Subject: [PATCH 034/110] slideType out --- .../schemas/project-v0.0.1-converted.yaml | 5 -- api/specs/common/schemas/project-v0.0.1.json | 7 --- .../src/models_library/projects.py | 1 - .../api/v0/schemas/project-v0.0.1.json | 7 --- .../api/v0/openapi.yaml | 20 -------- .../api/v0/schemas/project-v0.0.1.json | 7 --- .../component/widget/NodesSlidesTree.js | 31 ++++++++---- .../api/v0/openapi.yaml | 50 ------------------- .../api/v0/schemas/project-v0.0.1.json | 7 --- 9 files changed, 20 insertions(+), 115 deletions(-) diff --git a/api/specs/common/schemas/project-v0.0.1-converted.yaml b/api/specs/common/schemas/project-v0.0.1-converted.yaml index 0b7c6bfb20a..7d2e06aeefa 100644 --- a/api/specs/common/schemas/project-v0.0.1-converted.yaml +++ b/api/specs/common/schemas/project-v0.0.1-converted.yaml @@ -264,11 +264,6 @@ properties: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index f6423f0c82f..90d89a62f24 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -370,13 +370,6 @@ "position" ], "properties": { - "slideType": { - "type": "string", - "description": "Type of slide", - "examples": [ - "slide" - ] - }, "position": { "type": "integer", "description": "Slide's position", diff --git a/packages/models-library/src/models_library/projects.py b/packages/models-library/src/models_library/projects.py index f88bb5f8eda..fb3598080e4 100644 --- a/packages/models-library/src/models_library/projects.py +++ b/packages/models-library/src/models_library/projects.py @@ -94,7 +94,6 @@ class Config: class Slideshow(BaseModel): - slideType: Optional[str] = Field(..., description="Type of slide", example=["slide"]) position: Optional[int] = Field(..., description="Slide's position", example=["0", "2"]) class Config: diff --git a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json index f6423f0c82f..90d89a62f24 100644 --- a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json +++ b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json @@ -370,13 +370,6 @@ "position" ], "properties": { - "slideType": { - "type": "string", - "description": "Type of slide", - "examples": [ - "slide" - ] - }, "position": { "type": "integer", "description": "Slide's position", diff --git a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml index 27f13367b1a..9fc970c57a2 100644 --- a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml +++ b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml @@ -1990,11 +1990,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -2276,11 +2271,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -2572,11 +2562,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -2968,11 +2953,6 @@ components: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position diff --git a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json index f6423f0c82f..90d89a62f24 100644 --- a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json +++ b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json @@ -370,13 +370,6 @@ "position" ], "properties": { - "slideType": { - "type": "string", - "description": "Type of slide", - "examples": [ - "slide" - ] - }, "position": { "type": "integer", "description": "Slide's position", diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 875bbd55a1d..09876580fdc 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -31,10 +31,12 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { const save = this._createChildControlImpl("save-button"); save.addListener("execute", () => this.__saveSlides(), this); - const model = this.__initTree(initData); + const model = this.__initTree(); this.__tree.setModel(model); this.__populateTree(); + + this.__initData(initData); }, statics: { @@ -101,7 +103,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { return tree; }, - __initTree: function(initData) { + __initTree: function() { const study = osparc.store.Store.getInstance().getCurrentStudy(); const topLevelNodes = study.getWorkbench().getNodes(); let rootData = { @@ -111,14 +113,6 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { skipNode: null, position: null }; - const children = rootData.children; - for (let nodeId in initData) { - const idx = children.findIndex(child => child.nodeId === nodeId); - if (idx > -1) { - children[idx].position = initData[nodeId].position; - children[idx].skipNode = initData[nodeId].skipNode; - } - } return qx.data.marshal.Json.createModel(rootData, true); }, @@ -168,6 +162,22 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { }); }, + __initData: function(initData) { + if (Object.keys(initData).length) { + const children = this.__tree.getModel().getChildren().toArray(); + children.forEach(child => { + const nodeId = child.getNodeId(); + if (nodeId in initData) { + child.setPosition(initData[nodeId].position); + child.setSkipNode(false); + } else { + child.setPosition(null); + child.setSkipNode(true); + } + }); + } + }, + __show: function(itemMdl) { itemMdl.set({ skipNode: true @@ -225,7 +235,6 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { children.forEach(child => { if (child.getSkipNode() === false) { slideshow[child.getNodeId()] = { - "slideType": "slide", "position": child.getPosition() }; } diff --git a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml index ac0b9b1517f..237f64a6103 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml +++ b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml @@ -6033,11 +6033,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -6450,11 +6445,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -6747,11 +6737,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -7162,11 +7147,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -7583,11 +7563,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -7995,11 +7970,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -8292,11 +8262,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -8729,11 +8694,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -9978,11 +9938,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position @@ -10392,11 +10347,6 @@ paths: required: - position properties: - slideType: - type: string - description: Type of slide - example: - - slide position: type: integer description: Slide's position diff --git a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json index f6423f0c82f..90d89a62f24 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json +++ b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json @@ -370,13 +370,6 @@ "position" ], "properties": { - "slideType": { - "type": "string", - "description": "Type of slide", - "examples": [ - "slide" - ] - }, "position": { "type": "integer", "description": "Slide's position", From c8bfaa78e5d1dbcae41f64d2161e854027a4265d Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 14:34:17 +0200 Subject: [PATCH 035/110] minor --- .../source/class/osparc/component/widget/NodesSlidesTree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 09876580fdc..5c84c5ef42d 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -171,7 +171,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { child.setPosition(initData[nodeId].position); child.setSkipNode(false); } else { - child.setPosition(null); + child.setPosition(-1); child.setSkipNode(true); } }); From 914a902f61f84cbc810880f93e79923ea3082cd7 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 15:20:57 +0200 Subject: [PATCH 036/110] slides menu moved to Navigation bar --- .../class/osparc/desktop/ControlsBar.js | 8 -- .../source/class/osparc/desktop/MainPage.js | 18 +++++ .../class/osparc/desktop/NavigationBar.js | 76 +++++++++++++++++-- .../class/osparc/desktop/StudyEditor.js | 11 ++- 4 files changed, 95 insertions(+), 18 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/ControlsBar.js b/services/web/client/source/class/osparc/desktop/ControlsBar.js index 50f23c53eb7..6996e07042f 100644 --- a/services/web/client/source/class/osparc/desktop/ControlsBar.js +++ b/services/web/client/source/class/osparc/desktop/ControlsBar.js @@ -42,7 +42,6 @@ qx.Class.define("osparc.desktop.ControlsBar", { }, events: { - "showEditSlides": "qx.event.type.Event", "showSweeper": "qx.event.type.Event", "showWorkbench": "qx.event.type.Event", "showSettings": "qx.event.type.Event", @@ -109,8 +108,6 @@ qx.Class.define("osparc.desktop.ControlsBar", { } const moreCtrls = new qx.ui.toolbar.Part(); - const editSlidesButton = this.__createShowEditSlidesButton(); - moreCtrls.add(editSlidesButton); osparc.data.model.Sweeper.isSweeperEnabled() .then(isSweeperEnabled => { if (isSweeperEnabled) { @@ -126,11 +123,6 @@ qx.Class.define("osparc.desktop.ControlsBar", { this.add(simCtrls); }, - __createShowEditSlidesButton: function() { - const editSlidesButton = this.__createButton(this.tr("Edit slides"), "paw", "showEditSlidesButton", "showEditSlides"); - return editSlidesButton; - }, - __createShowSweeperButton: function() { const parametersButton = this.__createButton(this.tr("Sweeper"), "paw", "showSweeperButton", "showSweeper"); return parametersButton; diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 7a81870f4e1..a85f54351d0 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -83,6 +83,24 @@ qx.Class.define("osparc.desktop.MainPage", { } }, this); + navBar.addListener("slidesStart", () => { + if (this.__studyEditor) { + this.__studyEditor.startSlides(); + } + }, this); + + navBar.addListener("slidesStop", () => { + if (this.__studyEditor) { + this.__studyEditor.stopSlides(); + } + }, this); + + navBar.addListener("slidesEdit", () => { + if (this.__studyEditor) { + this.__studyEditor.editSlides(); + } + }, this); + navBar.addListener("nodeSelected", e => { if (this.__studyEditor) { let nodeId = e.getData(); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 0900b3d3ce7..327f74e100e 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -63,7 +63,10 @@ qx.Class.define("osparc.desktop.NavigationBar", { events: { "nodeSelected": "qx.event.type.Data", - "dashboardPressed": "qx.event.type.Event" + "dashboardPressed": "qx.event.type.Event", + "slidesStart": "qx.event.type.Event", + "slidesStop": "qx.event.type.Event", + "slidesEdit": "qx.event.type.Event" }, properties: { @@ -83,11 +86,18 @@ qx.Class.define("osparc.desktop.NavigationBar", { } }, + // eslint-disable-next-line qx-rules/no-refs-in-members members: { __dashboardBtn: null, __dashboardLabel: null, + __slidesMenu: null, __studyTitle: null, __mainViewCaptionLayout: null, + __pageContext: { + "dashboard": 0, + "studyEditorWorkbench": 1, + "studyEditorSlides": 2 + }, buildLayout: function() { this.getChildControl("logo"); @@ -96,7 +106,10 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.__dashboardBtn = this.getChildControl("dashboard-button"); this.__dashboardLabel = this.getChildControl("dashboard-label"); - this.__dashboardContext(); + + this._add(new qx.ui.core.Spacer(20)); + + this.__slidesMenu = this.getChildControl("slides-menu"); this._add(new qx.ui.core.Spacer(20)); @@ -112,6 +125,8 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.getChildControl("feedback"); this.getChildControl("theme-switch"); this.getChildControl("user-menu"); + + this.__setPageContext(this.__pageContext["dashboard"]); }, _createChildControlImpl: function(id) { @@ -137,6 +152,14 @@ qx.Class.define("osparc.desktop.NavigationBar", { }); this._add(control); break; + case "slides-menu": + control = this.__createSlidesMenuBtn(); + control.set({ + ...this.self().BUTTON_OPTIONS, + font: "text-14" + }); + this._add(control); + break; case "study-path-container": control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({ alignY: "middle" @@ -185,10 +208,10 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.__mainViewCaptionLayout.removeAll(); nodeIds.length === 1 ? this.__studyTitle.show() : this.__studyTitle.exclude(); if (nodeIds.length === 0) { - this.__dashboardContext(true); + this.__setPageContext(this.__pageContext["dashboard"]); return; } - this.__dashboardContext(false); + this.__setPageContext(this.__pageContext["studyEditorWorkbench"]); if (nodeIds.length === 1) { return; } @@ -217,15 +240,26 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.__mainViewCaptionLayout.add(arrow); } if (i === nodeIds.length-1) { - this.__dashboardContext(false); + this.__setPageContext(this.__pageContext["studyEditorWorkbench"]); btn.setFont("title-14"); } } }, - __dashboardContext: function(dashboardContext = true) { - this.__dashboardLabel.setVisibility(dashboardContext ? "visible" : "excluded"); - this.__dashboardBtn.setVisibility(dashboardContext ? "excluded" : "visible"); + __setPageContext: function(mainPageContext) { + switch (mainPageContext) { + case 0: + this.__dashboardLabel.setVisibility("visible"); + this.__dashboardBtn.setVisibility("excluded"); + this.__slidesMenu.setVisibility("excluded"); + break; + case 1: + case 2: + this.__dashboardLabel.setVisibility("excluded"); + this.__dashboardBtn.setVisibility("visible"); + this.__slidesMenu.setVisibility("visible"); + break; + } }, studySaved: function() { @@ -242,6 +276,32 @@ qx.Class.define("osparc.desktop.NavigationBar", { } }, + __createSlidesMenuBtn: function() { + const menu = new qx.ui.menu.Menu().set({ + font: "text-14" + }); + + const startBtn = new qx.ui.menu.Button(this.tr("Start")); + startBtn.addListener("execute", () => { + this.fireEvent("slidesStart"); + }, this); + menu.add(startBtn); + + const stopBtn = new qx.ui.menu.Button(this.tr("Stop")); + stopBtn.addListener("execute", () => { + this.fireEvent("slidesStop"); + }, this); + menu.add(stopBtn); + + const editBtn = new qx.ui.menu.Button(this.tr("Edit")); + editBtn.addListener("execute", () => { + this.fireEvent("slidesEdit"); + }, this); + menu.add(editBtn); + + return new qx.ui.form.MenuButton(this.tr("Slides"), null, menu); + }, + __createManualMenuBtn: function() { const manuals = []; if (this.__serverStatics && this.__serverStatics.manualMainUrl) { diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 6eed38954a4..d4652c236c6 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -444,7 +444,15 @@ qx.Class.define("osparc.desktop.StudyEditor", { } }, - __showEditSlides: function() { + startSlides: function() { + + }, + + stopSlides: function() { + + }, + + editSlides: function() { const uiData = this.getStudy().getUi(); const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(uiData["slideshow"]); const title = this.tr("Edit Slides"); @@ -711,7 +719,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, this); const controlsBar = this.__mainPanel.getControls(); - controlsBar.addListener("showEditSlides", this.__showEditSlides, this); controlsBar.addListener("showSweeper", this.__showSweeper, this); controlsBar.addListener("showWorkbench", this.__showWorkbenchUI, this); controlsBar.addListener("showSettings", this.__showSettings, this); From 968619117b3e554503ebadaba64049c8ee1416ab Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 15:32:51 +0200 Subject: [PATCH 037/110] minor --- .../class/osparc/desktop/NavigationBar.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 327f74e100e..b53a5ee39ca 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -83,21 +83,21 @@ qx.Class.define("osparc.desktop.NavigationBar", { allowGrowY: false, minWidth: 32, minHeight: 32 + }, + + PAGE_CONTEXT: { + "dashboard": 0, + "studyEditorWorkbench": 1, + "studyEditorSlides": 2 } }, - // eslint-disable-next-line qx-rules/no-refs-in-members members: { __dashboardBtn: null, __dashboardLabel: null, __slidesMenu: null, __studyTitle: null, __mainViewCaptionLayout: null, - __pageContext: { - "dashboard": 0, - "studyEditorWorkbench": 1, - "studyEditorSlides": 2 - }, buildLayout: function() { this.getChildControl("logo"); @@ -126,7 +126,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.getChildControl("theme-switch"); this.getChildControl("user-menu"); - this.__setPageContext(this.__pageContext["dashboard"]); + this.__setPageContext(this.self().PAGE_CONTEXT["dashboard"]); }, _createChildControlImpl: function(id) { @@ -208,10 +208,10 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.__mainViewCaptionLayout.removeAll(); nodeIds.length === 1 ? this.__studyTitle.show() : this.__studyTitle.exclude(); if (nodeIds.length === 0) { - this.__setPageContext(this.__pageContext["dashboard"]); + this.__setPageContext(this.self().PAGE_CONTEXT["dashboard"]); return; } - this.__setPageContext(this.__pageContext["studyEditorWorkbench"]); + this.__setPageContext(this.self().PAGE_CONTEXT["studyEditorWorkbench"]); if (nodeIds.length === 1) { return; } @@ -240,7 +240,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.__mainViewCaptionLayout.add(arrow); } if (i === nodeIds.length-1) { - this.__setPageContext(this.__pageContext["studyEditorWorkbench"]); + this.__setPageContext(this.self().PAGE_CONTEXT["studyEditorWorkbench"]); btn.setFont("title-14"); } } From f19f2dbad8464e2a2340977bf45c88b4e8b93e60 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 16:04:06 +0200 Subject: [PATCH 038/110] cleanup --- .../client/source/class/osparc/desktop/MainPage.js | 7 ------- .../source/class/osparc/desktop/NavigationBar.js | 14 -------------- .../source/class/osparc/desktop/StudyEditor.js | 2 -- 3 files changed, 23 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index a85f54351d0..4b169e64c71 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -265,13 +265,6 @@ qx.Class.define("osparc.desktop.MainPage", { this.__studyEditor.addListener("studyIsLocked", () => { this.__showDashboard(); }, this); - - this.__studyEditor.addListener("studySaved", ev => { - const wasSaved = ev.getData(); - if (wasSaved) { - this.__navBar.studySaved(); - } - }, this); }, __getStudyEditor: function() { diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index b53a5ee39ca..962abfbc10d 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -262,20 +262,6 @@ qx.Class.define("osparc.desktop.NavigationBar", { } }, - studySaved: function() { - for (let i=0; i { - widget.removeState("hovered"); - }, this, waitFor); - widget.addState("hovered"); - return; - } - } - }, - __createSlidesMenuBtn: function() { const menu = new qx.ui.menu.Menu().set({ font: "text-14" diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index d4652c236c6..e37b00f9ed1 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -51,7 +51,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { events: { "changeMainViewCaption": "qx.event.type.Data", "studyIsLocked": "qx.event.type.Event", - "studySaved": "qx.event.type.Data", "startStudy": "qx.event.type.Data" }, @@ -668,7 +667,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { return new Promise((resolve, reject) => { osparc.data.Resources.fetch("studies", "put", params) .then(data => { - this.fireDataEvent("studySaved", true); this.__lastSavedStudy = osparc.wrapper.JsonDiffPatch.getInstance().clone(newObj); resolve(); }).catch(error => { From e0df51669585224b7cfc5a04e8fa10771a1749cf Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 16:09:23 +0200 Subject: [PATCH 039/110] minor --- .../source/class/osparc/desktop/NavigationBar.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 962abfbc10d..66095e85683 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -97,7 +97,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { __dashboardLabel: null, __slidesMenu: null, __studyTitle: null, - __mainViewCaptionLayout: null, + __workbenchNodesLayout: null, buildLayout: function() { this.getChildControl("logo"); @@ -115,7 +115,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { const studyTitle = this.__studyTitle = this.__createStudyTitle(); this._add(studyTitle); - this.__mainViewCaptionLayout = this.getChildControl("study-path-container"); + this.__workbenchNodesLayout = this.getChildControl("study-path-container"); this._add(new qx.ui.core.Spacer(), { flex: 1 @@ -205,7 +205,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { }, setPathButtons: function(nodeIds) { - this.__mainViewCaptionLayout.removeAll(); + this.__workbenchNodesLayout.removeAll(); nodeIds.length === 1 ? this.__studyTitle.show() : this.__studyTitle.exclude(); if (nodeIds.length === 0) { this.__setPageContext(this.self().PAGE_CONTEXT["dashboard"]); @@ -231,13 +231,13 @@ qx.Class.define("osparc.desktop.NavigationBar", { btn.addListener("execute", function() { this.fireDataEvent("nodeSelected", nodeId); }, this); - this.__mainViewCaptionLayout.add(btn); + this.__workbenchNodesLayout.add(btn); if (i").set({ font: "text-14" }); - this.__mainViewCaptionLayout.add(arrow); + this.__workbenchNodesLayout.add(arrow); } if (i === nodeIds.length-1) { this.__setPageContext(this.self().PAGE_CONTEXT["studyEditorWorkbench"]); From 29fa6efce23fd29d64f18a0bf354b8749a09f6c1 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 16:50:04 +0200 Subject: [PATCH 040/110] refactoring --- .../source/class/osparc/desktop/MainPage.js | 3 +- .../class/osparc/desktop/NavigationBar.js | 64 ++++++++++++------- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 4b169e64c71..81f21b91bb9 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -179,7 +179,7 @@ qx.Class.define("osparc.desktop.MainPage", { this.__mainStack.setSelection([this.__dashboardLayout]); this.__dashboard.getStudyBrowser().reloadUserStudies(); - this.__navBar.setPathButtons([]); + this.__navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["dashboard"]); if (this.__studyEditor) { this.__studyEditor.destruct(); } @@ -254,6 +254,7 @@ qx.Class.define("osparc.desktop.MainPage", { __syncStudyEditor: function() { const studyEditor = this.__studyEditor; const study = studyEditor.getStudy(); + this.__navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["workbench"]); this.__navBar.setStudy(study); this.__navBar.setPathButtons(this.__studyEditor.getCurrentPathIds()); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 66095e85683..c52554ef875 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -87,8 +87,8 @@ qx.Class.define("osparc.desktop.NavigationBar", { PAGE_CONTEXT: { "dashboard": 0, - "studyEditorWorkbench": 1, - "studyEditorSlides": 2 + "workbench": 1, + "slides": 2 } }, @@ -98,6 +98,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { __slidesMenu: null, __studyTitle: null, __workbenchNodesLayout: null, + __guidedNodesLayout: null, buildLayout: function() { this.getChildControl("logo"); @@ -115,7 +116,8 @@ qx.Class.define("osparc.desktop.NavigationBar", { const studyTitle = this.__studyTitle = this.__createStudyTitle(); this._add(studyTitle); - this.__workbenchNodesLayout = this.getChildControl("study-path-container"); + this.__workbenchNodesLayout = this.getChildControl("workbench-nodes-path-container"); + this.__guidedNodesLayout = this.getChildControl("guided-nodes-path-container"); this._add(new qx.ui.core.Spacer(), { flex: 1 @@ -126,7 +128,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.getChildControl("theme-switch"); this.getChildControl("user-menu"); - this.__setPageContext(this.self().PAGE_CONTEXT["dashboard"]); + this.setPageContext(this.self().PAGE_CONTEXT["dashboard"]); }, _createChildControlImpl: function(id) { @@ -160,12 +162,18 @@ qx.Class.define("osparc.desktop.NavigationBar", { }); this._add(control); break; - case "study-path-container": + case "workbench-nodes-path-container": control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({ alignY: "middle" })); this._add(control); break; + case "guided-nodes-path-container": + control = new qx.ui.basic.Label(this.tr("Wizard")).set({ + font: "text-16" + }); + this._add(control); + break; case "manual": control = this.__createManualMenuBtn(); control.set({ @@ -206,15 +214,6 @@ qx.Class.define("osparc.desktop.NavigationBar", { setPathButtons: function(nodeIds) { this.__workbenchNodesLayout.removeAll(); - nodeIds.length === 1 ? this.__studyTitle.show() : this.__studyTitle.exclude(); - if (nodeIds.length === 0) { - this.__setPageContext(this.self().PAGE_CONTEXT["dashboard"]); - return; - } - this.__setPageContext(this.self().PAGE_CONTEXT["studyEditorWorkbench"]); - if (nodeIds.length === 1) { - return; - } const study = osparc.store.Store.getInstance().getCurrentStudy(); for (let i=0; i Date: Mon, 12 Oct 2020 16:57:11 +0200 Subject: [PATCH 041/110] minor --- .../source/class/osparc/component/widget/NodesSlidesTree.js | 1 - 1 file changed, 1 deletion(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 5c84c5ef42d..842125b0c4b 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -239,7 +239,6 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { }; } }); - console.log("Serialize me", slideshow); const study = osparc.store.Store.getInstance().getCurrentStudy(); const studyUI = study.getUi(); studyUI["slideshow"] = slideshow; From 40f76c2279729023acbd7115047d1b3bf27025f0 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 17:14:59 +0200 Subject: [PATCH 042/110] towards breadcrumb navigation --- .../source/class/osparc/desktop/MainPage.js | 4 ++ .../class/osparc/desktop/NavigationBar.js | 68 ++++++++++++++----- .../class/osparc/desktop/StudyEditor.js | 4 +- 3 files changed, 58 insertions(+), 18 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 81f21b91bb9..3ae98e970d8 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -85,18 +85,22 @@ qx.Class.define("osparc.desktop.MainPage", { navBar.addListener("slidesStart", () => { if (this.__studyEditor) { + navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["slides"]); + navBar.showGuidedButtons(); this.__studyEditor.startSlides(); } }, this); navBar.addListener("slidesStop", () => { if (this.__studyEditor) { + navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["workbench"]); this.__studyEditor.stopSlides(); } }, this); navBar.addListener("slidesEdit", () => { if (this.__studyEditor) { + navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["workbench"]); this.__studyEditor.editSlides(); } }, this); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index c52554ef875..a7e030d4d31 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -169,9 +169,9 @@ qx.Class.define("osparc.desktop.NavigationBar", { this._add(control); break; case "guided-nodes-path-container": - control = new qx.ui.basic.Label(this.tr("Wizard")).set({ - font: "text-16" - }); + control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({ + alignY: "middle" + })); this._add(control); break; case "manual": @@ -212,24 +212,44 @@ qx.Class.define("osparc.desktop.NavigationBar", { return this.__dashboardBtn; }, + __createNodePathBtn: function(nodeId) { + const study = osparc.store.Store.getInstance().getCurrentStudy(); + const btn = new qx.ui.form.Button().set(this.self().BUTTON_OPTIONS); + if (nodeId === study.getUuid()) { + study.bind("name", btn, "label"); + } else { + const node = study.getWorkbench().getNode(nodeId); + if (node) { + node.bind("label", btn, "label"); + } + } + btn.addListener("execute", function() { + this.fireDataEvent("nodeSelected", nodeId); + }, this); + return btn; + }, + + __createNodeSlideBtn: function(nodeId, pos) { + const study = osparc.store.Store.getInstance().getCurrentStudy(); + const btn = new qx.ui.form.Button().set(this.self().BUTTON_OPTIONS); + const node = study.getWorkbench().getNode(nodeId); + if (node) { + node.bind("label", btn, "label", { + converter: val => (pos+1).toString() + " " + val + }); + } + btn.addListener("execute", function() { + this.fireDataEvent("nodeSelected", nodeId); + }, this); + return btn; + }, + setPathButtons: function(nodeIds) { this.__workbenchNodesLayout.removeAll(); - const study = osparc.store.Store.getInstance().getCurrentStudy(); for (let i=0; i Date: Mon, 12 Oct 2020 17:47:13 +0200 Subject: [PATCH 043/110] more refactoring --- .../source/class/osparc/desktop/MainPage.js | 6 +++--- .../class/osparc/desktop/NavigationBar.js | 2 +- .../class/osparc/desktop/StudyEditor.js | 19 +++++++++---------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 3ae98e970d8..29e92425ef3 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -262,9 +262,9 @@ qx.Class.define("osparc.desktop.MainPage", { this.__navBar.setStudy(study); this.__navBar.setPathButtons(this.__studyEditor.getCurrentPathIds()); - this.__studyEditor.addListener("changeMainViewCaption", ev => { - const elements = ev.getData(); - this.__navBar.setPathButtons(elements); + this.__studyEditor.addListener("selectedNodeChanged", e => { + const nodesPath = this.__studyEditor.getCurrentPathIds(); + this.__navBar.setPathButtons(nodesPath); }, this); this.__studyEditor.addListener("studyIsLocked", () => { diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index a7e030d4d31..30d35440811 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -235,7 +235,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { const node = study.getWorkbench().getNode(nodeId); if (node) { node.bind("label", btn, "label", { - converter: val => (pos+1).toString() + " " + val + converter: val => (pos+1).toString() + " - " + val }); } btn.addListener("execute", function() { diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index b81994bd7fd..9292603b059 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -49,7 +49,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, events: { - "changeMainViewCaption": "qx.event.type.Data", + "selectedNodeChanged": "qx.event.type.Data", "studyIsLocked": "qx.event.type.Event", "startStudy": "qx.event.type.Data" }, @@ -303,7 +303,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { const study = this.getStudy(); const workbench = study.getWorkbench(); if (nodeId === study.getUuid()) { - this.showInMainView(this.__workbenchUI, nodeId); + this.__showInMainView(this.__workbenchUI, nodeId); this.__workbenchUI.loadModel(workbench); } else { const node = workbench.getNode(nodeId); @@ -311,12 +311,12 @@ qx.Class.define("osparc.desktop.StudyEditor", { this.__openFilePicker(node); } else if (node.isContainer()) { this.__groupNodeView.setNode(node); - this.showInMainView(this.__workbenchUI, nodeId); + this.__showInMainView(this.__workbenchUI, nodeId); this.__workbenchUI.loadModel(node); this.__groupNodeView.populateLayout(); } else { this.__nodeView.setNode(node); - this.showInMainView(this.__nodeView, nodeId); + this.__showInMainView(this.__nodeView, nodeId); this.__nodeView.populateLayout(); } } @@ -399,7 +399,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { this.__nodesTree.nodeSelected(this.__currentNodeId); }, - showInMainView: function(widget, nodeId) { + __showInMainView: function(widget, nodeId) { this.__mainPanel.setMainView(widget); this.__nodesTree.nodeSelected(nodeId); @@ -409,8 +409,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { controlsBar.setWorkbenchVisibility(widget === this.__workbenchUI); controlsBar.setExtraViewVisibility(this.__groupNodeView && this.__groupNodeView.getNode() && nodeId === this.__groupNodeView.getNode().getNodeId()); - const nodesPath = this.getStudy().getWorkbench().getPathIds(nodeId); - this.fireDataEvent("changeMainViewCaption", nodesPath); + this.fireDataEvent("selectedNodeChanged", nodeId); }, getCurrentPathIds: function() { @@ -486,7 +485,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { const workbench = this.getStudy().getWorkbench(); const currentNode = workbench.getNode(this.__currentNodeId); if (currentNode === this.__workbenchUI.getCurrentModel()) { - this.showInMainView(this.__workbenchUI, this.__currentNodeId); + this.__showInMainView(this.__workbenchUI, this.__currentNodeId); } else { osparc.component.message.FlashMessenger.getInstance().logAs("No Workbench view for this node", "ERROR"); } @@ -496,9 +495,9 @@ qx.Class.define("osparc.desktop.StudyEditor", { const workbench = this.getStudy().getWorkbench(); const currentNode = workbench.getNode(this.__currentNodeId); if (this.__groupNodeView.isPropertyInitialized("node") && currentNode === this.__groupNodeView.getNode()) { - this.showInMainView(this.__groupNodeView, this.__currentNodeId); + this.__showInMainView(this.__groupNodeView, this.__currentNodeId); } else if (this.__nodeView.isPropertyInitialized("node") && currentNode === this.__nodeView.getNode()) { - this.showInMainView(this.__nodeView, this.__currentNodeId); + this.__showInMainView(this.__nodeView, this.__currentNodeId); } else { osparc.component.message.FlashMessenger.getInstance().logAs("No Settings view for this node", "ERROR"); } From a8817d22a361fc6d572c4aefe4c8977ca39d7bf8 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 17:54:27 +0200 Subject: [PATCH 044/110] close after save --- .../source/class/osparc/component/widget/NodesSlidesTree.js | 5 +++++ .../web/client/source/class/osparc/desktop/StudyEditor.js | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 842125b0c4b..074515af4f7 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -39,6 +39,10 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { this.__initData(initData); }, + events: { + "finished": "qx.event.type.Event" + }, + statics: { convertModel: function(nodes) { let children = []; @@ -242,6 +246,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { const study = osparc.store.Store.getInstance().getCurrentStudy(); const studyUI = study.getUi(); studyUI["slideshow"] = slideshow; + this.fireEvent("finished"); } } }); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 9292603b059..34d611b063c 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -454,10 +454,13 @@ qx.Class.define("osparc.desktop.StudyEditor", { const uiData = this.getStudy().getUi(); const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(uiData["slideshow"]); const title = this.tr("Edit Slides"); - osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 600, 500).set({ + const win = osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 600, 500).set({ modal: false, clickAwayClose: false }); + nodesSlidesTree.addListener("finshed", () => { + win.close(); + }); }, __showSweeper: function() { From 8e8f242946b3ff3aeae504373830e30480395e39 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 12 Oct 2020 17:55:23 +0200 Subject: [PATCH 045/110] typo --- services/web/client/source/class/osparc/desktop/StudyEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 34d611b063c..b344d26722c 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -458,7 +458,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { modal: false, clickAwayClose: false }); - nodesSlidesTree.addListener("finshed", () => { + nodesSlidesTree.addListener("finished", () => { win.close(); }); }, From 782c1166380123cf26badae02ed489a15bc2797c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 13 Oct 2020 13:22:40 +0200 Subject: [PATCH 046/110] refactoring --- .../source/class/osparc/desktop/MainPage.js | 9 ++- .../class/osparc/desktop/NavigationBar.js | 72 +++++++++++++------ 2 files changed, 56 insertions(+), 25 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 29e92425ef3..feb1d3b9bea 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -85,7 +85,7 @@ qx.Class.define("osparc.desktop.MainPage", { navBar.addListener("slidesStart", () => { if (this.__studyEditor) { - navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["slides"]); + navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT[2]); navBar.showGuidedButtons(); this.__studyEditor.startSlides(); } @@ -93,14 +93,14 @@ qx.Class.define("osparc.desktop.MainPage", { navBar.addListener("slidesStop", () => { if (this.__studyEditor) { - navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["workbench"]); + navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT[1]); this.__studyEditor.stopSlides(); } }, this); navBar.addListener("slidesEdit", () => { if (this.__studyEditor) { - navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["workbench"]); + navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT[1]); this.__studyEditor.editSlides(); } }, this); @@ -183,7 +183,7 @@ qx.Class.define("osparc.desktop.MainPage", { this.__mainStack.setSelection([this.__dashboardLayout]); this.__dashboard.getStudyBrowser().reloadUserStudies(); - this.__navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["dashboard"]); + this.__navBar.setStudy(null); if (this.__studyEditor) { this.__studyEditor.destruct(); } @@ -258,7 +258,6 @@ qx.Class.define("osparc.desktop.MainPage", { __syncStudyEditor: function() { const studyEditor = this.__studyEditor; const study = studyEditor.getStudy(); - this.__navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT["workbench"]); this.__navBar.setStudy(study); this.__navBar.setPathButtons(this.__studyEditor.getCurrentPathIds()); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 30d35440811..829c017c4f1 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -74,6 +74,12 @@ qx.Class.define("osparc.desktop.NavigationBar", { check: "osparc.data.model.Study", nullable: true, apply: "_applyStudy" + }, + + pageContext: { + check: ["dashboard", "workbench", "slides"], + nullable: false, + apply: "_applyPageContext" } }, @@ -86,9 +92,9 @@ qx.Class.define("osparc.desktop.NavigationBar", { }, PAGE_CONTEXT: { - "dashboard": 0, - "workbench": 1, - "slides": 2 + 0: "dashboard", + 1: "workbench", + 2: "slides" } }, @@ -128,7 +134,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.getChildControl("theme-switch"); this.getChildControl("user-menu"); - this.setPageContext(this.self().PAGE_CONTEXT["dashboard"]); + this.setPageContext("dashboard"); }, _createChildControlImpl: function(id) { @@ -288,35 +294,58 @@ qx.Class.define("osparc.desktop.NavigationBar", { } }, - setPageContext: function(mainPageContext) { + _applyPageContext: function(mainPageContext) { switch (mainPageContext) { - case 0: + case "dashboard": this.__dashboardLabel.show(); this.__dashboardBtn.exclude(); - this.__slidesMenu.exclude(); - this.__studyTitle.exclude(); - this.__workbenchNodesLayout.exclude(); - this.__guidedNodesLayout.exclude(); + this.__setSlidesMenuVis(false); + this.__setWorkbenchBtnsVis(false); + this.__setSlidesBtnsVis(false); break; - case 1: + case "workbench": this.__dashboardLabel.exclude(); this.__dashboardBtn.show(); - this.__slidesMenu.show(); - this.__studyTitle.show(); - this.__workbenchNodesLayout.show(); - this.__guidedNodesLayout.exclude(); + this.__setSlidesMenuVis(true); + this.__setWorkbenchBtnsVis(true); + this.__setSlidesBtnsVis(false); break; - case 2: + case "slides": this.__dashboardLabel.exclude(); this.__dashboardBtn.show(); - this.__slidesMenu.show(); - this.__studyTitle.exclude(); - this.__workbenchNodesLayout.exclude(); - this.__guidedNodesLayout.show(); + this.__setSlidesMenuVis(true); + this.__setWorkbenchBtnsVis(false); + this.__setSlidesBtnsVis(true); break; } }, + __setSlidesMenuVis: function(show) { + if (show && osparc.data.model.Study.isOwner(this.getStudy())) { + this.__slidesMenu.show(); + } else { + this.__slidesMenu.exclude(); + } + }, + + __setWorkbenchBtnsVis: function(show) { + if (show) { + this.__studyTitle.show(); + this.__workbenchNodesLayout.show(); + } else { + this.__studyTitle.exclude(); + this.__workbenchNodesLayout.exclude(); + } + }, + + __setSlidesBtnsVis: function(show) { + if (show) { + this.__guidedNodesLayout.show(); + } else { + this.__guidedNodesLayout.exclude(); + } + }, + __createSlidesMenuBtn: function() { const menu = new qx.ui.menu.Menu().set({ font: "text-14" @@ -519,6 +548,9 @@ qx.Class.define("osparc.desktop.NavigationBar", { _applyStudy: function(study) { if (study) { study.bind("name", this.__studyTitle, "value"); + this.setPageContext("workbench"); + } else { + this.setPageContext("dashboard"); } }, From 1b6ddd97bc74f53be7d6936e22e9d81b81fb313e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 13 Oct 2020 14:37:57 +0200 Subject: [PATCH 047/110] hide inputs/outputs in slideshow --- .../source/class/osparc/component/node/BaseNodeView.js | 8 ++++++++ .../web/client/source/class/osparc/desktop/StudyEditor.js | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/services/web/client/source/class/osparc/component/node/BaseNodeView.js b/services/web/client/source/class/osparc/component/node/BaseNodeView.js index 8d769b3df18..e1af1ee601c 100644 --- a/services/web/client/source/class/osparc/component/node/BaseNodeView.js +++ b/services/web/client/source/class/osparc/component/node/BaseNodeView.js @@ -361,6 +361,14 @@ qx.Class.define("osparc.component.node.BaseNodeView", { osparc.ui.window.Window.popUpInWindow(serviceDetails, title, 700, 800); }, + getInputsView: function() { + return this.__inputsView; + }, + + getOutputsView: function() { + return this.__outputsView; + }, + __attachEventHandlers: function() { const blocker1 = this.getBlocker(); const blocker2 = this.__pane2.getBlocker(); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index b344d26722c..65d5be215e2 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -443,11 +443,15 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, startSlides: function() { - this.__sidePanel.exclude(); + this.__sidePanel.setCollapsed(true); + this.__nodeView.getInputsView().setCollapsed(true); + this.__nodeView.getOutputsView().setCollapsed(true); }, stopSlides: function() { - this.__sidePanel.show(); + this.__sidePanel.setCollapsed(false); + this.__nodeView.getInputsView().setCollapsed(false); + this.__nodeView.getOutputsView().setCollapsed(false); }, editSlides: function() { From 619128379a2c1c3f2ebb8f986759f8d87fb88958 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 13 Oct 2020 15:07:18 +0200 Subject: [PATCH 048/110] allow additionalProperties --- .../schemas/project-v0.0.1-converted.yaml | 2 +- api/specs/common/schemas/project-v0.0.1.json | 2 +- .../api/v0/schemas/project-v0.0.1.json | 2 +- .../api/v0/openapi.yaml | 8 ++++---- .../api/v0/schemas/project-v0.0.1.json | 2 +- .../api/v0/openapi.yaml | 20 +++++++++---------- .../api/v0/schemas/project-v0.0.1.json | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/api/specs/common/schemas/project-v0.0.1-converted.yaml b/api/specs/common/schemas/project-v0.0.1-converted.yaml index 7d2e06aeefa..3b23f8af433 100644 --- a/api/specs/common/schemas/project-v0.0.1-converted.yaml +++ b/api/specs/common/schemas/project-v0.0.1-converted.yaml @@ -232,7 +232,7 @@ properties: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 90d89a62f24..8e2d97275f2 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -328,7 +328,7 @@ }, "ui": { "type": "object", - "additionalProperties": false, + "additionalProperties": true, "properties": { "workbench": { "type": "object", diff --git a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json index 90d89a62f24..8e2d97275f2 100644 --- a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json +++ b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json @@ -328,7 +328,7 @@ }, "ui": { "type": "object", - "additionalProperties": false, + "additionalProperties": true, "properties": { "workbench": { "type": "object", diff --git a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml index 9fc970c57a2..141c3fd39ac 100644 --- a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml +++ b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml @@ -1958,7 +1958,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -2239,7 +2239,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -2530,7 +2530,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -2921,7 +2921,7 @@ components: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object diff --git a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json index 90d89a62f24..8e2d97275f2 100644 --- a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json +++ b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json @@ -328,7 +328,7 @@ }, "ui": { "type": "object", - "additionalProperties": false, + "additionalProperties": true, "properties": { "workbench": { "type": "object", diff --git a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml index 237f64a6103..269574f9cf4 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml +++ b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml @@ -6001,7 +6001,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -6413,7 +6413,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -6705,7 +6705,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -7115,7 +7115,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -7531,7 +7531,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -7938,7 +7938,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -8230,7 +8230,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -8662,7 +8662,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -9906,7 +9906,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object @@ -10315,7 +10315,7 @@ paths: additionalProperties: true ui: type: object - additionalProperties: false + additionalProperties: true properties: workbench: type: object diff --git a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json index 90d89a62f24..8e2d97275f2 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json +++ b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json @@ -328,7 +328,7 @@ }, "ui": { "type": "object", - "additionalProperties": false, + "additionalProperties": true, "properties": { "workbench": { "type": "object", From 800d053a5608a992a81b682ae24ccde1efc0eb69 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 13 Oct 2020 15:26:17 +0200 Subject: [PATCH 049/110] StudyUI data model created --- .../component/widget/NodesSlidesTree.js | 3 +- .../source/class/osparc/data/model/Study.js | 8 +-- .../source/class/osparc/data/model/StudyUI.js | 69 +++++++++++++++++++ 3 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 services/web/client/source/class/osparc/data/model/StudyUI.js diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index 074515af4f7..f3a889cb7e5 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -244,8 +244,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { } }); const study = osparc.store.Store.getInstance().getCurrentStudy(); - const studyUI = study.getUi(); - studyUI["slideshow"] = slideshow; + study.getUi().setSlideshow(slideshow); this.fireEvent("finished"); } } diff --git a/services/web/client/source/class/osparc/data/model/Study.js b/services/web/client/source/class/osparc/data/model/Study.js index 2e0c417a083..814a6b4de5c 100644 --- a/services/web/client/source/class/osparc/data/model/Study.js +++ b/services/web/client/source/class/osparc/data/model/Study.js @@ -57,7 +57,7 @@ qx.Class.define("osparc.data.model.Study", { const wbData = studyData.workbench === undefined ? {} : studyData.workbench; this.setWorkbench(new osparc.data.model.Workbench(wbData, studyData.ui)); - this.setUi(studyData.ui); + this.setUi(new osparc.data.model.StudyUI(studyData.ui)); this.setSweeper(new osparc.data.model.Sweeper(studyData)); }, @@ -124,7 +124,8 @@ qx.Class.define("osparc.data.model.Study", { }, ui: { - check: "Object" + check: "osparc.data.model.StudyUI", + nullable: false }, classifiers: { @@ -260,8 +261,7 @@ qx.Class.define("osparc.data.model.Study", { return; } if (key === "ui") { - jsonObject["ui"] = this.getUi(); - jsonObject["ui"]["workbench"] = this.getWorkbench().serializeUI(); + jsonObject["ui"] = this.getUi().serialize(); return; } let value = key === "workbench" ? this.getWorkbench().serialize() : this.get(key); diff --git a/services/web/client/source/class/osparc/data/model/StudyUI.js b/services/web/client/source/class/osparc/data/model/StudyUI.js new file mode 100644 index 00000000000..bfe784e22d5 --- /dev/null +++ b/services/web/client/source/class/osparc/data/model/StudyUI.js @@ -0,0 +1,69 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2020 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +/** + * + */ + +qx.Class.define("osparc.data.model.StudyUI", { + extend: qx.core.Object, + + /** + * @param studyDataUI {Object} Object containing the serialized Study UI Data + */ + construct: function(studyDataUI) { + this.base(arguments); + + this.set({ + workbech: studyDataUI.workbench === undefined ? this.getWorkbench() : studyDataUI.workbench, + slideshow: studyDataUI.slideshow === undefined ? this.getSlideshow() : studyDataUI.slideshow, + currentNodeId: studyDataUI.currentNodeId === undefined ? this.getCurrentNodeId() : studyDataUI.currentNodeId + }); + }, + + properties: { + workbech: { + check: "Object", + nullable: true, + init: {} + }, + + slideshow: { + check: "Object", + nullable: true, + init: {} + }, + + currentNodeId: { + check: "String", + nullable: true, + event: "changeCurrentNodeId", + init: null + } + }, + + members: { + serialize: function() { + const currentStudy = osparc.store.Store.getInstance().getCurrentStudy(); + let jsonObject = {}; + jsonObject["workbench"] = currentStudy.getWorkbench().serializeUI(); + jsonObject["slideshow"] = this.getSlideshow(); + jsonObject["currentNodeId"] = this.getCurrentNodeId(); + return jsonObject; + } + } +}); From 5345e6cb41bee14c53b6a1ed18ae5092050a63f0 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 13 Oct 2020 16:05:59 +0200 Subject: [PATCH 050/110] NavBar listens to changeCurrentNodeId --- .../source/class/osparc/desktop/MainPage.js | 6 ------ .../source/class/osparc/desktop/NavigationBar.js | 15 ++++++++++++++- .../source/class/osparc/desktop/StudyEditor.js | 9 +-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index feb1d3b9bea..1dab7bce89d 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -259,12 +259,6 @@ qx.Class.define("osparc.desktop.MainPage", { const studyEditor = this.__studyEditor; const study = studyEditor.getStudy(); this.__navBar.setStudy(study); - this.__navBar.setPathButtons(this.__studyEditor.getCurrentPathIds()); - - this.__studyEditor.addListener("selectedNodeChanged", e => { - const nodesPath = this.__studyEditor.getCurrentPathIds(); - this.__navBar.setPathButtons(nodesPath); - }, this); this.__studyEditor.addListener("studyIsLocked", () => { this.__showDashboard(); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 829c017c4f1..b80851e6d37 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -250,7 +250,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { return btn; }, - setPathButtons: function(nodeIds) { + __setPathButtons: function(nodeIds) { this.__workbenchNodesLayout.removeAll(); for (let i=0; i { + const currentNodeId = e.getData(); + const nodesPath = study.getWorkbench().getPathIds(currentNodeId); + this.__setPathButtons(nodesPath); + }); this.setPageContext("workbench"); } else { this.setPageContext("dashboard"); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 65d5be215e2..bfed11490de 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -49,7 +49,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, events: { - "selectedNodeChanged": "qx.event.type.Data", "studyIsLocked": "qx.event.type.Event", "startStudy": "qx.event.type.Data" }, @@ -299,6 +298,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { this.__groupNodeView.restoreIFrame(); } this.__currentNodeId = nodeId; + this.getStudy().getUi().setCurrentNodeId(nodeId); const study = this.getStudy(); const workbench = study.getWorkbench(); @@ -408,13 +408,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { const controlsBar = this.__mainPanel.getControls(); controlsBar.setWorkbenchVisibility(widget === this.__workbenchUI); controlsBar.setExtraViewVisibility(this.__groupNodeView && this.__groupNodeView.getNode() && nodeId === this.__groupNodeView.getNode().getNodeId()); - - this.fireDataEvent("selectedNodeChanged", nodeId); - }, - - getCurrentPathIds: function() { - const nodesPath = this.getStudy().getWorkbench().getPathIds(this.__currentNodeId); - return nodesPath; }, getLogger: function() { From edbced3ee6252c468af68addf7d1b0c1d7c842f9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 13 Oct 2020 16:11:32 +0200 Subject: [PATCH 051/110] more refactoring --- .../class/osparc/desktop/NavigationBar.js | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index b80851e6d37..192c8d03ccc 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -251,8 +251,26 @@ qx.Class.define("osparc.desktop.NavigationBar", { }, __setPathButtons: function(nodeIds) { - this.__workbenchNodesLayout.removeAll(); + if (this.getPageContext() === "workbench") { + this.__setWorkbenchBtnsVis(true); + this.__setSlidesBtnsVis(false); + } else { + this.__setWorkbenchBtnsVis(false); + this.__setSlidesBtnsVis(true); + } + + if (nodeIds.length > 1) { + this.__populateWorkbenchNodesLayout(nodeIds); + this.__studyTitle.exclude(); + this.__workbenchNodesLayout.show(); + } else { + this.__studyTitle.show(); + this.__workbenchNodesLayout.exclude(); + } + }, + __populateWorkbenchNodesLayout: function(nodeIds) { + this.__workbenchNodesLayout.removeAll(); for (let i=0; i Date: Wed, 14 Oct 2020 11:06:33 +0200 Subject: [PATCH 052/110] minor --- services/web/client/source/class/osparc/desktop/StudyEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index bfed11490de..b81dac9a9fc 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -449,7 +449,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { editSlides: function() { const uiData = this.getStudy().getUi(); - const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(uiData["slideshow"]); + const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(uiData.getSlideshow()); const title = this.tr("Edit Slides"); const win = osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 600, 500).set({ modal: false, From 298845b93497939fc48cc11b2c167ae319761c09 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 11:27:56 +0200 Subject: [PATCH 053/110] NavBar buttons, ok --- .../source/class/osparc/desktop/MainPage.js | 1 - .../class/osparc/desktop/NavigationBar.js | 46 +++++++++---------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 1dab7bce89d..a199252cc8a 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -86,7 +86,6 @@ qx.Class.define("osparc.desktop.MainPage", { navBar.addListener("slidesStart", () => { if (this.__studyEditor) { navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT[2]); - navBar.showGuidedButtons(); this.__studyEditor.startSlides(); } }, this); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 192c8d03ccc..0083dc45abe 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -254,22 +254,25 @@ qx.Class.define("osparc.desktop.NavigationBar", { if (this.getPageContext() === "workbench") { this.__setWorkbenchBtnsVis(true); this.__setSlidesBtnsVis(false); + + if (nodeIds.length > 1) { + this.__studyTitle.exclude(); + this.__workbenchNodesLayout.show(); + } else { + this.__studyTitle.show(); + this.__workbenchNodesLayout.exclude(); + } } else { this.__setWorkbenchBtnsVis(false); this.__setSlidesBtnsVis(true); } - - if (nodeIds.length > 1) { - this.__populateWorkbenchNodesLayout(nodeIds); - this.__studyTitle.exclude(); - this.__workbenchNodesLayout.show(); - } else { - this.__studyTitle.show(); - this.__workbenchNodesLayout.exclude(); - } }, - __populateWorkbenchNodesLayout: function(nodeIds) { + __populateWorkbenchNodesLayout: function() { + const study = this.getStudy(); + const nodeIds = study.getWorkbench().getPathIds(study.getUi().getCurrentNodeId()); + this.__setPathButtons(nodeIds); + this.__workbenchNodesLayout.removeAll(); for (let i=0; i { - const currentNodeId = e.getData(); - const nodesPath = study.getWorkbench().getPathIds(currentNodeId); - this.__setPathButtons(nodesPath); + this._applyPageContext(this.getPageContext()); }); this.setPageContext("workbench"); } else { From bc6c54e3d1f84c1517b5b98519ff853158ac04d0 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 13:08:06 +0200 Subject: [PATCH 054/110] gray out SlidesBtns --- .../class/osparc/desktop/NavigationBar.js | 18 +++++++++++++++--- .../source/class/osparc/desktop/StudyEditor.js | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 0083dc45abe..dd7b0626c90 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -102,6 +102,9 @@ qx.Class.define("osparc.desktop.NavigationBar", { __dashboardBtn: null, __dashboardLabel: null, __slidesMenu: null, + __startSlidesBtn: null, + __stopSlidesBtn: null, + __editSlidesBtn: null, __studyTitle: null, __workbenchNodesLayout: null, __guidedNodesLayout: null, @@ -335,6 +338,15 @@ qx.Class.define("osparc.desktop.NavigationBar", { __setSlidesMenuVis: function(show) { if (show && osparc.data.model.Study.isOwner(this.getStudy())) { this.__slidesMenu.show(); + if (this.getPageContext() === "slides") { + this.__startSlidesBtn.setEnabled(false); + this.__stopSlidesBtn.setEnabled(true); + this.__editSlidesBtn.setEnabled(false); + } else { + this.__startSlidesBtn.setEnabled(true); + this.__stopSlidesBtn.setEnabled(false); + this.__editSlidesBtn.setEnabled(true); + } } else { this.__slidesMenu.exclude(); } @@ -363,19 +375,19 @@ qx.Class.define("osparc.desktop.NavigationBar", { font: "text-14" }); - const startBtn = new qx.ui.menu.Button(this.tr("Start")); + const startBtn = this.__startSlidesBtn = new qx.ui.menu.Button(this.tr("Start")); startBtn.addListener("execute", () => { this.fireEvent("slidesStart"); }, this); menu.add(startBtn); - const stopBtn = new qx.ui.menu.Button(this.tr("Stop")); + const stopBtn = this.__stopSlidesBtn = new qx.ui.menu.Button(this.tr("Stop")); stopBtn.addListener("execute", () => { this.fireEvent("slidesStop"); }, this); menu.add(stopBtn); - const editBtn = new qx.ui.menu.Button(this.tr("Edit")); + const editBtn = this.__editSlidesBtn = new qx.ui.menu.Button(this.tr("Edit")); editBtn.addListener("execute", () => { this.fireEvent("slidesEdit"); }, this); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index b81dac9a9fc..d5b3e838d2f 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -676,6 +676,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, closeStudy: function() { + this.stopSlides(); this.getStudy().closeStudy(); }, From 50dc6efc9282f1bbfae5024e0ce66ade0a87d070 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 13:47:11 +0200 Subject: [PATCH 055/110] Slides buttons are radioToolbar --- .../class/osparc/desktop/NavigationBar.js | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index dd7b0626c90..452c5e246fc 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -178,9 +178,9 @@ qx.Class.define("osparc.desktop.NavigationBar", { this._add(control); break; case "guided-nodes-path-container": - control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({ + control = new qx.ui.toolbar.Part().set({ alignY: "middle" - })); + }); this._add(control); break; case "manual": @@ -240,7 +240,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { __createNodeSlideBtn: function(nodeId, pos) { const study = osparc.store.Store.getInstance().getCurrentStudy(); - const btn = new qx.ui.form.Button().set(this.self().BUTTON_OPTIONS); + const btn = new qx.ui.toolbar.RadioButton().set(this.self().BUTTON_OPTIONS); const node = study.getWorkbench().getNode(nodeId); if (node) { node.bind("label", btn, "label", { @@ -298,17 +298,28 @@ qx.Class.define("osparc.desktop.NavigationBar", { const study = this.getStudy(); if (study) { this.__guidedNodesLayout.removeAll(); + const radioGroup = new qx.ui.form.RadioGroup(); const slideShow = study.getUi().getSlideshow(); + const nodes = []; for (let nodeId in slideShow) { const node = slideShow[nodeId]; - const btn = this.__createNodeSlideBtn(nodeId, node.position); - this.__guidedNodesLayout.add(btn); + nodes.push({ + ...node, + nodeId + }); } + nodes.sort((a, b) => (a.position > b.position) ? 1 : 0); + nodes.forEach(node => { + const btn = this.__createNodeSlideBtn(node.nodeId, node.position); + this.__guidedNodesLayout.add(btn); + radioGroup.add(btn); + }); + radioGroup.setAllowEmptySelection(false); } }, - _applyPageContext: function(mainPageContext) { - switch (mainPageContext) { + _applyPageContext: function(newCtxt) { + switch (newCtxt) { case "dashboard": this.__dashboardLabel.show(); this.__dashboardBtn.exclude(); @@ -573,7 +584,9 @@ qx.Class.define("osparc.desktop.NavigationBar", { if (study) { study.bind("name", this.__studyTitle, "value"); study.getUi().addListener("changeCurrentNodeId", e => { - this._applyPageContext(this.getPageContext()); + if (this.getPageContext() === "workbench)") { + this.__populateWorkbenchNodesLayout(); + } }); this.setPageContext("workbench"); } else { From 89a3eedc0c5bf4e8b6108912bf85ee91cddd347c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 13:48:46 +0200 Subject: [PATCH 056/110] typo --- .../web/client/source/class/osparc/desktop/NavigationBar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 452c5e246fc..69d9b82634f 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -584,7 +584,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { if (study) { study.bind("name", this.__studyTitle, "value"); study.getUi().addListener("changeCurrentNodeId", e => { - if (this.getPageContext() === "workbench)") { + if (this.getPageContext() === "workbench") { this.__populateWorkbenchNodesLayout(); } }); From a448d9dceb649427833600d8ed5be7d7c8327ad4 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 13:52:15 +0200 Subject: [PATCH 057/110] minor fixes --- .../web/client/source/class/osparc/desktop/NavigationBar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 69d9b82634f..617d4b6390b 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -308,7 +308,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { nodeId }); } - nodes.sort((a, b) => (a.position > b.position) ? 1 : 0); + nodes.sort((a, b) => (a.position > b.position) ? 1 : -1); nodes.forEach(node => { const btn = this.__createNodeSlideBtn(node.nodeId, node.position); this.__guidedNodesLayout.add(btn); @@ -583,7 +583,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { _applyStudy: function(study) { if (study) { study.bind("name", this.__studyTitle, "value"); - study.getUi().addListener("changeCurrentNodeId", e => { + study.getUi().addListener("changeCurrentNodeId", () => { if (this.getPageContext() === "workbench") { this.__populateWorkbenchNodesLayout(); } From c15d65dc499a99b39a2fc8d7cd4f9c96a9231af5 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 14:34:48 +0200 Subject: [PATCH 058/110] NavigationBar's PageContext is set from MainPage --- services/web/client/source/class/osparc/desktop/MainPage.js | 2 ++ .../web/client/source/class/osparc/desktop/NavigationBar.js | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index a199252cc8a..886bb93387d 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -183,6 +183,7 @@ qx.Class.define("osparc.desktop.MainPage", { this.__mainStack.setSelection([this.__dashboardLayout]); this.__dashboard.getStudyBrowser().reloadUserStudies(); this.__navBar.setStudy(null); + this.__navBar.setPageContext("dashboard"); if (this.__studyEditor) { this.__studyEditor.destruct(); } @@ -258,6 +259,7 @@ qx.Class.define("osparc.desktop.MainPage", { const studyEditor = this.__studyEditor; const study = studyEditor.getStudy(); this.__navBar.setStudy(study); + this.__navBar.setPageContext("workbench"); this.__studyEditor.addListener("studyIsLocked", () => { this.__showDashboard(); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 617d4b6390b..2c43348d9ab 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -588,9 +588,6 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.__populateWorkbenchNodesLayout(); } }); - this.setPageContext("workbench"); - } else { - this.setPageContext("dashboard"); } }, From 806d474771387a8915a36b0b25ba4bc1ce68896c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 14:40:54 +0200 Subject: [PATCH 059/110] refactoring --- .../class/osparc/desktop/NavigationBar.js | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 2c43348d9ab..e47beabbc38 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -123,8 +123,25 @@ qx.Class.define("osparc.desktop.NavigationBar", { this._add(new qx.ui.core.Spacer(20)); - const studyTitle = this.__studyTitle = this.__createStudyTitle(); - this._add(studyTitle); + const studyTitle = this.__studyTitle = this.getChildControl("study-title"); + studyTitle.addListener("editValue", evt => { + if (evt.getData() !== studyTitle.getValue()) { + studyTitle.setFetching(true); + const params = { + name: evt.getData() + }; + this.getStudy().updateStudy(params) + .then(() => { + studyTitle.setFetching(false); + }) + .catch(err => { + studyTitle.setFetching(false); + console.error(err); + osparc.component.message.FlashMessenger.getInstance().logAs(this.tr("There was an error while updating the title."), "ERROR"); + }); + } + }, this); + this.__workbenchNodesLayout = this.getChildControl("workbench-nodes-path-container"); this.__guidedNodesLayout = this.getChildControl("guided-nodes-path-container"); @@ -171,6 +188,14 @@ qx.Class.define("osparc.desktop.NavigationBar", { }); this._add(control); break; + case "study-title": + control = new osparc.ui.form.EditLabel().set({ + visibility: "excluded", + labelFont: "title-14", + inputFont: "text-14", + editable: osparc.data.Permissions.getInstance().canDo("study.update") + }); + break; case "workbench-nodes-path-container": control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({ alignY: "middle" @@ -589,33 +614,6 @@ qx.Class.define("osparc.desktop.NavigationBar", { } }); } - }, - - __createStudyTitle: function() { - const studyTitle = new osparc.ui.form.EditLabel().set({ - visibility: "excluded", - labelFont: "title-14", - inputFont: "text-14", - editable: osparc.data.Permissions.getInstance().canDo("study.update") - }); - studyTitle.addListener("editValue", evt => { - if (evt.getData() !== this.__studyTitle.getValue()) { - this.__studyTitle.setFetching(true); - const params = { - name: evt.getData() - }; - this.getStudy().updateStudy(params) - .then(() => { - this.__studyTitle.setFetching(false); - }) - .catch(err => { - this.__studyTitle.setFetching(false); - console.error(err); - osparc.component.message.FlashMessenger.getInstance().logAs(this.tr("There was an error while updating the title."), "ERROR"); - }); - } - }, this); - return studyTitle; } } }); From bd5ad4ded05a8dfa3d99bc5ffb10f5f59d004316 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 14:41:56 +0200 Subject: [PATCH 060/110] minor --- services/web/client/source/class/osparc/desktop/NavigationBar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index e47beabbc38..f68c0c0bca8 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -195,6 +195,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { inputFont: "text-14", editable: osparc.data.Permissions.getInstance().canDo("study.update") }); + this._add(control); break; case "workbench-nodes-path-container": control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({ From 4912341c0021b560c80364bed0936d256ed28d27 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 15:46:14 +0200 Subject: [PATCH 061/110] pageContext added to StudyEditor --- .../source/class/osparc/desktop/MainPage.js | 4 +-- .../class/osparc/desktop/StudyEditor.js | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 886bb93387d..0261b0428a6 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -86,14 +86,14 @@ qx.Class.define("osparc.desktop.MainPage", { navBar.addListener("slidesStart", () => { if (this.__studyEditor) { navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT[2]); - this.__studyEditor.startSlides(); + this.__studyEditor.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT[2]); } }, this); navBar.addListener("slidesStop", () => { if (this.__studyEditor) { navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT[1]); - this.__studyEditor.stopSlides(); + this.__studyEditor.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT[1]); } }, this); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index d5b3e838d2f..3e2da19fea9 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -15,8 +15,6 @@ ************************************************************************ */ -/* eslint newline-per-chained-call: 0 */ - qx.Class.define("osparc.desktop.StudyEditor", { extend: osparc.ui.basic.LoadingPageHandler, @@ -53,6 +51,14 @@ qx.Class.define("osparc.desktop.StudyEditor", { "startStudy": "qx.event.type.Data" }, + properties: { + pageContext: { + check: ["workbench", "slides"], + nullable: false, + apply: "_applyPageContext" + } + }, + members: { __study: null, __settingStudy: null, @@ -435,13 +441,25 @@ qx.Class.define("osparc.desktop.StudyEditor", { } }, - startSlides: function() { + _applyPageContext: function(newCtxt) { + switch (newCtxt) { + case "workbench": + this.__stopSlides(); + break; + case "slides": + this.__startSlides(); + break; + } + }, + + + __startSlides: function() { this.__sidePanel.setCollapsed(true); this.__nodeView.getInputsView().setCollapsed(true); this.__nodeView.getOutputsView().setCollapsed(true); }, - stopSlides: function() { + __stopSlides: function() { this.__sidePanel.setCollapsed(false); this.__nodeView.getInputsView().setCollapsed(false); this.__nodeView.getOutputsView().setCollapsed(false); From 419dc76015c20161c8e4341cd6123ccc24824782 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 17:08:59 +0200 Subject: [PATCH 062/110] minor --- .../source/class/osparc/data/model/StudyUI.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/services/web/client/source/class/osparc/data/model/StudyUI.js b/services/web/client/source/class/osparc/data/model/StudyUI.js index bfe784e22d5..81bd64e33f1 100644 --- a/services/web/client/source/class/osparc/data/model/StudyUI.js +++ b/services/web/client/source/class/osparc/data/model/StudyUI.js @@ -29,30 +29,27 @@ qx.Class.define("osparc.data.model.StudyUI", { this.base(arguments); this.set({ - workbech: studyDataUI.workbench === undefined ? this.getWorkbench() : studyDataUI.workbench, - slideshow: studyDataUI.slideshow === undefined ? this.getSlideshow() : studyDataUI.slideshow, - currentNodeId: studyDataUI.currentNodeId === undefined ? this.getCurrentNodeId() : studyDataUI.currentNodeId + workbech: studyDataUI.workbench || {}, + slideshow: studyDataUI.slideshow || {}, + currentNodeId: studyDataUI.currentNodeId || null }); }, properties: { workbech: { check: "Object", - nullable: true, - init: {} + nullable: true }, slideshow: { check: "Object", - nullable: true, - init: {} + nullable: true }, currentNodeId: { check: "String", nullable: true, - event: "changeCurrentNodeId", - init: null + event: "changeCurrentNodeId" } }, From d278074f02bf3bfd69c8ca005b1cd7c9511ddd13 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 18:06:09 +0200 Subject: [PATCH 063/110] minor fix --- services/web/client/source/class/osparc/desktop/StudyEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 3e2da19fea9..4490769bab2 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -694,7 +694,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, closeStudy: function() { - this.stopSlides(); + this.__stopSlides(); this.getStudy().closeStudy(); }, From 91cb4653f95d16ee2f4004cc153e7f704059dc2b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 18:08:44 +0200 Subject: [PATCH 064/110] FilePicker is shown in the nodeView --- .../osparc/component/node/BaseNodeView.js | 12 +- .../component/node/FilePickerNodeView.js | 74 ++++++++++++ .../osparc/component/workbench/WorkbenchUI.js | 1 + .../class/osparc/desktop/StudyEditor.js | 34 +----- .../source/class/osparc/file/FilePicker.js | 109 ++++++++++-------- 5 files changed, 149 insertions(+), 81 deletions(-) create mode 100644 services/web/client/source/class/osparc/component/node/FilePickerNodeView.js diff --git a/services/web/client/source/class/osparc/component/node/BaseNodeView.js b/services/web/client/source/class/osparc/component/node/BaseNodeView.js index e1af1ee601c..0be7a01a41f 100644 --- a/services/web/client/source/class/osparc/component/node/BaseNodeView.js +++ b/services/web/client/source/class/osparc/component/node/BaseNodeView.js @@ -56,7 +56,7 @@ qx.Class.define("osparc.component.node.BaseNodeView", { __pane2: null, __title: null, __toolbar: null, - __mainView: null, + _mainView: null, __inputsView: null, __outputsView: null, __inputNodesLayout: null, @@ -99,7 +99,7 @@ qx.Class.define("osparc.component.node.BaseNodeView", { }, __cleanLayout: function() { - this.__mainView.removeAll(); + this._mainView.removeAll(); }, __buildSideView: function(isInput) { @@ -193,7 +193,7 @@ qx.Class.define("osparc.component.node.BaseNodeView", { }, __buildMainView: function() { - const mainView = this.__mainView = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); + const mainView = this._mainView = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); this._settingsLayout = this.self().createSettingsGroupBox(this.tr("Settings")); this._mapperLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); @@ -249,9 +249,9 @@ qx.Class.define("osparc.component.node.BaseNodeView", { _addToMainView: function(view, options = {}) { if (view.hasChildren()) { - this.__mainView.add(view, options); - } else if (qx.ui.core.Widget.contains(this.__mainView, view)) { - this.__mainView.remove(view); + this._mainView.add(view, options); + } else if (qx.ui.core.Widget.contains(this._mainView, view)) { + this._mainView.remove(view); } }, diff --git a/services/web/client/source/class/osparc/component/node/FilePickerNodeView.js b/services/web/client/source/class/osparc/component/node/FilePickerNodeView.js new file mode 100644 index 00000000000..bcab9db6ff1 --- /dev/null +++ b/services/web/client/source/class/osparc/component/node/FilePickerNodeView.js @@ -0,0 +1,74 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2020 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +/** + * + */ + +qx.Class.define("osparc.component.node.FilePickerNodeView", { + extend: osparc.component.node.BaseNodeView, + + /** + * @param node {osparc.data.model.Node} Node owning the widget + */ + construct: function(node) { + this.base(arguments); + + this.set({ + node + }); + }, + + members: { + __filePicker: null, + + // overridden + isSettingsGroupShowable: function() { + return false; + }, + + // overridden + _addSettings: function() { + return; + }, + + // overridden + _addIFrame: function() { + this.__buildMyLayout(); + }, + + // overridden + _openEditAccessLevel: function() { + return; + }, + + // overridden + _applyNode: function(node) { + return; + }, + + __buildMyLayout: function() { + const filePicker = this.__filePicker = new osparc.file.FilePicker(this.getNode()); + filePicker.buildLayout(); + filePicker.init(); + + this._mainView.add(filePicker, { + flex: 1 + }); + } + } +}); 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 25ac7cc710c..607a96f4fe0 100644 --- a/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js +++ b/services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js @@ -936,6 +936,7 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", { }; const nodeUI = this.__addServiceFromCatalog(data, pos); const filePicker = new osparc.file.FilePicker(nodeUI.getNode()); + filePicker.buildLayout(); filePicker.uploadPendingFiles(fileList); } } else { diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 4490769bab2..b960c59c149 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -313,13 +313,15 @@ qx.Class.define("osparc.desktop.StudyEditor", { this.__workbenchUI.loadModel(workbench); } else { const node = workbench.getNode(nodeId); - if (node.isFilePicker()) { - this.__openFilePicker(node); - } else if (node.isContainer()) { + if (node.isContainer()) { this.__groupNodeView.setNode(node); this.__showInMainView(this.__workbenchUI, nodeId); this.__workbenchUI.loadModel(node); this.__groupNodeView.populateLayout(); + } else if (node.isFilePicker()) { + const nodeView = new osparc.component.node.FilePickerNodeView(node); + this.__showInMainView(nodeView, nodeId); + nodeView.populateLayout(); } else { this.__nodeView.setNode(node); this.__showInMainView(this.__nodeView, nodeId); @@ -328,32 +330,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { } }, - __openFilePicker: function(node) { - const filePicker = new osparc.file.FilePicker(node, this.getStudy().getUuid()); - // open file picker in window - const filePickerWin = new osparc.ui.window.Window(node.getLabel()).set({ - appearance: "service-window", - layout: new qx.ui.layout.Grow(), - autoDestroy: true, - contentPadding: 0, - width: 570, - height: 450, - showMinimize: false, - modal: true, - clickAwayClose: true - }); - const showParentWorkbench = () => { - this.nodeSelected(node.getParentNodeId() || this.getStudy().getUuid()); - }; - filePickerWin.add(filePicker); - qx.core.Init.getApplication().getRoot().add(filePickerWin); - filePickerWin.show(); - filePickerWin.center(); - - filePicker.addListener("finished", () => filePickerWin.close(), this); - filePickerWin.addListener("close", () => showParentWorkbench()); - }, - __removeNode: function(nodeId) { if (nodeId === this.__currentNodeId) { return false; diff --git a/services/web/client/source/class/osparc/file/FilePicker.js b/services/web/client/source/class/osparc/file/FilePicker.js index 976900f81f8..043351ff43a 100644 --- a/services/web/client/source/class/osparc/file/FilePicker.js +++ b/services/web/client/source/class/osparc/file/FilePicker.js @@ -18,7 +18,7 @@ /** * Built-in service used for selecting a single file from storage and make it available in the workflow * - * It consists of a VBox containing a FilesTree, Add button and Select button: + * It consists of a widget containing a FilesTree, Add button and Select button: * - FilesTree will be populated with data provided by storage service (simcore.S3 and datcore) * - Add button will open a dialogue where the selected file will be upload to S3 * - Select button puts the file in the output of the FilePicker node so that connected nodes can access it. @@ -39,57 +39,13 @@ qx.Class.define("osparc.file.FilePicker", { /** * @param node {osparc.data.model.Node} Node owning the widget - */ + */ construct: function(node) { this.base(arguments); this.set({ node }); - - const filePickerLayout = new qx.ui.layout.VBox(); - this._setLayout(filePickerLayout); - - const reloadButton = this._createChildControlImpl("reloadButton"); - reloadButton.addListener("execute", function() { - this.__filesTree.resetCache(); - this.__initResources(); - }, this); - - const filesTree = this.__filesTree = this._createChildControlImpl("filesTree"); - filesTree.addListener("selectionChanged", this.__selectionChanged, this); - filesTree.addListener("itemSelected", this.__itemSelected, this); - filesTree.addListener("filesAddedToTree", this.__checkSelectedFileIsListed, this); - - const toolbar = new qx.ui.toolbar.ToolBar(); - const mainButtons = this.__mainButtons = new qx.ui.toolbar.Part(); - toolbar.addSpacer(); - toolbar.add(mainButtons); - - this._add(toolbar); - - const filesAdd = this.__filesAdder = this._createChildControlImpl("filesAdd"); - filesAdd.addListener("fileAdded", e => { - const fileMetadata = e.getData(); - if ("location" in fileMetadata && "dataset" in fileMetadata && "path" in fileMetadata && "name" in fileMetadata) { - this.__setOutputFile(fileMetadata["location"], fileMetadata["dataset"], fileMetadata["path"], fileMetadata["name"]); - } - this.__filesTree.resetCache(); - this.__initResources(); - }, this); - - const selectBtn = this.__selectBtn = this._createChildControlImpl("selectButton"); - selectBtn.setEnabled(false); - selectBtn.addListener("execute", function() { - this.__itemSelected(); - }, this); - - if (this.__isOutputFileSelected()) { - const outFile = this.__getOutputFile(); - this.__filesTree.loadFilePath(outFile.value); - } else { - this.__initResources(); - } }, properties: { @@ -102,6 +58,20 @@ qx.Class.define("osparc.file.FilePicker", { "finished": "qx.event.type.Event" }, + statics: { + getOutputLabel: function(outputValue) { + if ("outFile" in outputValue) { + const outInfo = outputValue["outFile"]; + if ("label" in outInfo) { + return outInfo.label; + } + const splitFilename = outInfo.path.split("/"); + return splitFilename[splitFilename.length-1]; + } + return null; + } + }, + members: { __filesTree: null, __filesAdder: null, @@ -140,6 +110,53 @@ qx.Class.define("osparc.file.FilePicker", { return control || this.base(arguments, id); }, + buildLayout: function() { + this._setLayout(new qx.ui.layout.VBox(5)); + + const reloadButton = this._createChildControlImpl("reloadButton"); + reloadButton.addListener("execute", function() { + this.__filesTree.resetCache(); + this.__initResources(); + }, this); + + const filesTree = this.__filesTree = this._createChildControlImpl("filesTree"); + filesTree.addListener("selectionChanged", this.__selectionChanged, this); + filesTree.addListener("itemSelected", this.__itemSelected, this); + filesTree.addListener("filesAddedToTree", this.__checkSelectedFileIsListed, this); + + const toolbar = new qx.ui.toolbar.ToolBar(); + const mainButtons = this.__mainButtons = new qx.ui.toolbar.Part(); + toolbar.addSpacer(); + toolbar.add(mainButtons); + + this._add(toolbar); + + const filesAdd = this.__filesAdder = this._createChildControlImpl("filesAdd"); + filesAdd.addListener("fileAdded", e => { + const fileMetadata = e.getData(); + if ("location" in fileMetadata && "dataset" in fileMetadata && "path" in fileMetadata && "name" in fileMetadata) { + this.__setOutputFile(fileMetadata["location"], fileMetadata["dataset"], fileMetadata["path"], fileMetadata["name"]); + } + this.__filesTree.resetCache(); + this.__initResources(); + }, this); + + const selectBtn = this.__selectBtn = this._createChildControlImpl("selectButton"); + selectBtn.setEnabled(false); + selectBtn.addListener("execute", function() { + this.__itemSelected(); + }, this); + }, + + init: function() { + if (this.__isOutputFileSelected()) { + const outFile = this.__getOutputFile(); + this.__filesTree.loadFilePath(outFile.value); + } else { + this.__initResources(); + } + }, + uploadPendingFiles: function(files) { if (files.length > 0) { if (files.length > 1) { From 1fd974c07c644fbbdca1f2e64968f5017214b572 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 14 Oct 2020 18:19:56 +0200 Subject: [PATCH 065/110] minor fix --- .../source/class/osparc/desktop/StudyEditor.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index b960c59c149..78e8557ca3e 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -436,9 +436,15 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, __stopSlides: function() { - this.__sidePanel.setCollapsed(false); - this.__nodeView.getInputsView().setCollapsed(false); - this.__nodeView.getOutputsView().setCollapsed(false); + if (this.__sidePanel.getCollapsed()) { + this.__sidePanel.setCollapsed(false); + } + if (this.__nodeView.getInputsView().getCollapsed()) { + this.__nodeView.getInputsView().setCollapsed(false); + } + if (this.__nodeView.getOutputsView().getCollapsed()) { + this.__nodeView.getOutputsView().setCollapsed(false); + } }, editSlides: function() { From 52195213303178a3bb2f917ccd122196b06dea7b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 15 Oct 2020 15:09:31 +0200 Subject: [PATCH 066/110] minor --- services/web/client/source/class/osparc/desktop/StudyEditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 78e8557ca3e..03a7c6017c7 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -668,7 +668,8 @@ qx.Class.define("osparc.desktop.StudyEditor", { .then(data => { this.__lastSavedStudy = osparc.wrapper.JsonDiffPatch.getInstance().clone(newObj); resolve(); - }).catch(error => { + }) + .catch(error => { this.getLogger().error(null, "Error updating pipeline"); reject(); }); From 978d6ece1067168be9992644ef315caa6520ab55 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 15 Oct 2020 15:30:04 +0200 Subject: [PATCH 067/110] StudyEditor splitted into WorkbenchView + SlideShowView --- .../source/class/osparc/desktop/MainPage.js | 1 + .../class/osparc/desktop/SlideShowView.js | 62 ++ .../class/osparc/desktop/StudyEditor.js | 617 +---------------- .../class/osparc/desktop/WorkbenchView.js | 630 ++++++++++++++++++ 4 files changed, 725 insertions(+), 585 deletions(-) create mode 100644 services/web/client/source/class/osparc/desktop/SlideShowView.js create mode 100644 services/web/client/source/class/osparc/desktop/WorkbenchView.js diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 0261b0428a6..356f9b2feb9 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -260,6 +260,7 @@ qx.Class.define("osparc.desktop.MainPage", { const study = studyEditor.getStudy(); this.__navBar.setStudy(study); this.__navBar.setPageContext("workbench"); + studyEditor.setPageContext("workbench"); this.__studyEditor.addListener("studyIsLocked", () => { this.__showDashboard(); diff --git a/services/web/client/source/class/osparc/desktop/SlideShowView.js b/services/web/client/source/class/osparc/desktop/SlideShowView.js new file mode 100644 index 00000000000..a09d41806b9 --- /dev/null +++ b/services/web/client/source/class/osparc/desktop/SlideShowView.js @@ -0,0 +1,62 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2020 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +/** + * + */ + +qx.Class.define("osparc.desktop.SlideShowView", { + extend: qx.ui.core.Widget, + + construct: function() { + this.base(arguments, "horizontal"); + + this._setLayout(new qx.ui.layout.VBox()); + }, + + properties: { + study: { + check: "osparc.data.model.Study", + nullable: false + } + }, + + members: { + initViews: function() { + this.__initViews(); + }, + + nodeSelected: function(nodeId) { + console.log(nodeId); + }, + + startSlides: function() { + console.log("startSlides"); + }, + + stopSlides: function() { + console.log("stopSlides"); + }, + + __initViews: function() { + const label = new qx.ui.basic.Label("Hey"); + this._add(label, { + flex: 1 + }); + } + } +}); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 03a7c6017c7..4ef615fc498 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -23,27 +23,18 @@ qx.Class.define("osparc.desktop.StudyEditor", { this._setLayout(new qx.ui.layout.VBox(10)); - const pane = this.__pane = new qx.ui.splitpane.Pane("horizontal"); - this._add(pane, { - flex: 1 + const viewsStack = this.__viewsStack = new qx.ui.container.Stack(); + const workbenchView = this.__workbenchView = new osparc.desktop.WorkbenchView(); + workbenchView.addListener("startStudy", e => { + this.fireDataEvent("startStudy", e.getData()); }); + viewsStack.add(workbenchView); + const slideshowView = this.__slideshowView = new osparc.desktop.SlideShowView(); + viewsStack.add(slideshowView); - const sidePanel = this.__sidePanel = new osparc.desktop.SidePanel().set({ - minWidth: 0, - width: Math.min(parseInt(window.innerWidth*0.25), 350) - }); - osparc.utils.Utils.addBorder(sidePanel, 2, "right"); - const scroll = this.__scrollContainer = new qx.ui.container.Scroll().set({ - minWidth: 0 + this._add(viewsStack, { + flex: 1 }); - scroll.add(sidePanel); - - pane.add(scroll, 0); // flex 0 - - const mainPanel = this.__mainPanel = new osparc.desktop.MainPanel(); - pane.add(mainPanel, 1); // flex 1 - - this.__attachEventHandlers(); }, events: { @@ -62,17 +53,9 @@ qx.Class.define("osparc.desktop.StudyEditor", { members: { __study: null, __settingStudy: null, - __pane: null, - __mainPanel: null, - __sidePanel: null, - __scrollContainer: null, - __workbenchUI: null, - __nodeView: null, - __groupNodeView: null, - __nodesTree: null, - __extraView: null, - __loggerView: null, - __currentNodeId: null, + __viewsStack: null, + __workbenchView: null, + __slideshowView: null, __autoSaveTimer: null, __lastSavedStudy: null, @@ -122,11 +105,16 @@ qx.Class.define("osparc.desktop.StudyEditor", { console.error(err); } }); - this.__initViews(); - this.__connectEvents(); - this.__attachSocketEventHandlers(); + + this.__workbenchView.setStudy(study); + this.__workbenchView.initViews(); + + this.__slideshowView.setStudy(study); + this.__slideshowView.initViews(); + this.__startAutoSaveTimer(); - this.__openOneNode(); + + this.__workbenchView.openOneNode(); }); }); }, @@ -137,28 +125,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { // overridden _showMainLayout: function(show) { - this.__pane.setVisibility(show ? "visible" : "excluded"); - }, - - __openOneNode: function() { - const validNodeIds = []; - const allNodes = this.getStudy().getWorkbench().getNodes(true); - Object.values(allNodes).forEach(node => { - if (!node.isFilePicker()) { - validNodeIds.push(node.getNodeId()); - } - }); - - const preferencesSettings = osparc.desktop.preferences.Preferences.getInstance(); - if (validNodeIds.length === 1 && preferencesSettings.getAutoOpenNode()) { - this.nodeSelected(validNodeIds[0]); - // Todo Odei: A bit of a hack - qx.event.Timer.once(() => { - this.__checkMaximizeable(); - }, this, 10); - } else { - this.nodeSelected(this.getStudy().getUuid()); - } + this.__viewsStack.setVisibility(show ? "visible" : "excluded"); }, /** @@ -169,231 +136,13 @@ qx.Class.define("osparc.desktop.StudyEditor", { this.__stopAutoSaveTimer(); }, - __initViews: function() { - const study = this.getStudy(); - - const nodesTree = this.__nodesTree = new osparc.component.widget.NodesTree(study); - nodesTree.addListener("removeNode", e => { - const nodeId = e.getData(); - this.__removeNode(nodeId); - }, this); - this.__sidePanel.addOrReplaceAt(new osparc.desktop.PanelView(this.tr("Service tree"), nodesTree), 0, { - flex: 1 - }); - - const extraView = this.__extraView = new osparc.component.metadata.StudyInfo(study); - this.__sidePanel.addOrReplaceAt(new osparc.desktop.PanelView(this.tr("Study information"), extraView), 1, { - flex: 1 - }); - - const loggerView = this.__loggerView = new osparc.component.widget.logger.LoggerView(study.getWorkbench()); - const loggerPanel = new osparc.desktop.PanelView(this.tr("Logger"), loggerView); - osparc.utils.Utils.setIdToWidget(loggerPanel.getTitleLabel(), "loggerTitleLabel"); - this.__sidePanel.addOrReplaceAt(loggerPanel, 2, { - flex: 1 - }); - if (!osparc.data.Permissions.getInstance().canDo("study.logger.debug.read")) { - loggerPanel.setCollapsed(true); - } - - const workbenchUI = this.__workbenchUI = new osparc.component.workbench.WorkbenchUI(study.getWorkbench()); - workbenchUI.addListener("removeEdge", e => { - const edgeId = e.getData(); - this.__removeEdge(edgeId); - }, this); - - this.__nodeView = new osparc.component.node.NodeView().set({ - minHeight: 200 - }); - - this.__groupNodeView = new osparc.component.node.GroupNodeView().set({ - minHeight: 200 - }); - }, - - __connectEvents: function() { - const workbench = this.getStudy().getWorkbench(); - workbench.addListener("workbenchChanged", this.__workbenchChanged, this); - - workbench.addListener("retrieveInputs", e => { - const data = e.getData(); - const node = data["node"]; - const portKey = data["portKey"]; - this.__updatePipelineAndRetrieve(node, portKey); - }, this); - - workbench.addListener("showInLogger", ev => { - const data = ev.getData(); - const nodeId = data.nodeId; - const msg = data.msg; - this.getLogger().info(nodeId, msg); - }, this); - - const workbenchUI = this.__workbenchUI; - const nodesTree = this.__nodesTree; - [ - nodesTree, - workbenchUI - ].forEach(widget => { - widget.addListener("nodeDoubleClicked", e => { - const nodeId = e.getData(); - this.nodeSelected(nodeId); - }, this); - }); - - nodesTree.addListener("changeSelectedNode", e => { - const node = workbenchUI.getNodeUI(e.getData()); - if (node && node.classname.includes("NodeUI")) { - node.setActive(true); - } - }); - nodesTree.addListener("exportNode", e => { - const nodeId = e.getData(); - this.__exportMacro(nodeId); - }); - - workbenchUI.addListener("changeSelectedNode", e => { - const nodeId = e.getData(); - nodesTree.nodeSelected(nodeId); - }); - }, - - __exportMacro: function(nodeId) { - if (!osparc.data.Permissions.getInstance().canDo("study.node.export", true)) { - return; - } - const node = this.getStudy().getWorkbench().getNode(nodeId); - if (node && node.isContainer()) { - const exportDAGView = new osparc.component.export.ExportDAG(node); - const window = new qx.ui.window.Window(this.tr("Export: ") + node.getLabel()).set({ - appearance: "service-window", - layout: new qx.ui.layout.Grow(), - autoDestroy: true, - contentPadding: 0, - width: 700, - height: 700, - showMinimize: false, - modal: true - }); - window.add(exportDAGView); - window.center(); - window.open(); - - window.addListener("close", () => { - exportDAGView.tearDown(); - }, this); - - exportDAGView.addListener("finished", () => { - window.close(); - }, this); - } - }, - nodeSelected: function(nodeId) { - if (!nodeId) { - this.__loggerView.setCurrentNodeId(); - return; - } - if (this.__nodesTree) { - this.__nodesTree.setCurrentNodeId(nodeId); - } - if (this.__nodeView) { - this.__nodeView.restoreIFrame(); - } - if (this.__groupNodeView) { - this.__groupNodeView.restoreIFrame(); - } - this.__currentNodeId = nodeId; - this.getStudy().getUi().setCurrentNodeId(nodeId); - - const study = this.getStudy(); - const workbench = study.getWorkbench(); - if (nodeId === study.getUuid()) { - this.__showInMainView(this.__workbenchUI, nodeId); - this.__workbenchUI.loadModel(workbench); - } else { - const node = workbench.getNode(nodeId); - if (node.isContainer()) { - this.__groupNodeView.setNode(node); - this.__showInMainView(this.__workbenchUI, nodeId); - this.__workbenchUI.loadModel(node); - this.__groupNodeView.populateLayout(); - } else if (node.isFilePicker()) { - const nodeView = new osparc.component.node.FilePickerNodeView(node); - this.__showInMainView(nodeView, nodeId); - nodeView.populateLayout(); - } else { - this.__nodeView.setNode(node); - this.__showInMainView(this.__nodeView, nodeId); - this.__nodeView.populateLayout(); - } - } - }, - - __removeNode: function(nodeId) { - if (nodeId === this.__currentNodeId) { - return false; - } - - const workbench = this.getStudy().getWorkbench(); - const connectedEdges = workbench.getConnectedEdges(nodeId); - if (workbench.removeNode(nodeId)) { - // remove first the connected edges - for (let i=0; i { - this.__retrieveInputs(node, portKey); - }); - this.getLogger().debug(null, "Updating pipeline"); - }, - - __retrieveInputs: function(node, portKey = null) { - this.getLogger().debug(null, "Retrieveing inputs"); - if (node) { - node.retrieveInputs(portKey); - } - }, - _applyPageContext: function(newCtxt) { switch (newCtxt) { case "workbench": - this.__stopSlides(); + this.__viewsStack.setSelection([this.__workbenchView]); break; case "slides": - this.__startSlides(); + this.__viewsStack.setSelection([this.__slideshowView]); + this.startSlides(); break; } }, - - __startSlides: function() { - this.__sidePanel.setCollapsed(true); - this.__nodeView.getInputsView().setCollapsed(true); - this.__nodeView.getOutputsView().setCollapsed(true); - }, - - __stopSlides: function() { - if (this.__sidePanel.getCollapsed()) { - this.__sidePanel.setCollapsed(false); - } - if (this.__nodeView.getInputsView().getCollapsed()) { - this.__nodeView.getInputsView().setCollapsed(false); - } - if (this.__nodeView.getOutputsView().getCollapsed()) { - this.__nodeView.getOutputsView().setCollapsed(false); - } - }, - - editSlides: function() { - const uiData = this.getStudy().getUi(); - const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(uiData.getSlideshow()); - const title = this.tr("Edit Slides"); - const win = osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 600, 500).set({ - modal: false, - clickAwayClose: false - }); - nodesSlidesTree.addListener("finished", () => { - win.close(); - }); - }, - - __showSweeper: function() { - const study = this.getStudy(); - const sweeper = new osparc.component.sweeper.Sweeper(study); - const title = this.tr("Sweeper"); - const win = osparc.ui.window.Window.popUpInWindow(sweeper, title, 400, 700); - sweeper.addListener("iterationSelected", e => { - win.close(); - const iterationStudyId = e.getData(); - const params = { - url: { - "projectId": iterationStudyId - } - }; - osparc.data.Resources.getOne("studies", params) - .then(studyData => { - study.removeIFrames(); - this.fireDataEvent("startStudy", studyData.uuid); - }); - }); - }, - - __showWorkbenchUI: function() { - const workbench = this.getStudy().getWorkbench(); - const currentNode = workbench.getNode(this.__currentNodeId); - if (currentNode === this.__workbenchUI.getCurrentModel()) { - this.__showInMainView(this.__workbenchUI, this.__currentNodeId); - } else { - osparc.component.message.FlashMessenger.getInstance().logAs("No Workbench view for this node", "ERROR"); - } - }, - - __showSettings: function() { - const workbench = this.getStudy().getWorkbench(); - const currentNode = workbench.getNode(this.__currentNodeId); - if (this.__groupNodeView.isPropertyInitialized("node") && currentNode === this.__groupNodeView.getNode()) { - this.__showInMainView(this.__groupNodeView, this.__currentNodeId); - } else if (this.__nodeView.isPropertyInitialized("node") && currentNode === this.__nodeView.getNode()) { - this.__showInMainView(this.__nodeView, this.__currentNodeId); - } else { - osparc.component.message.FlashMessenger.getInstance().logAs("No Settings view for this node", "ERROR"); - } - }, - - __isSelectionEmpty: function(selectedNodeUIs) { - if (selectedNodeUIs === null || selectedNodeUIs.length === 0) { - return true; - } - return false; - }, - - __groupSelection: function() { - // Some checks - if (!osparc.data.Permissions.getInstance().canDo("study.node.create", true)) { - return; - } - - const selectedNodeUIs = this.__workbenchUI.getSelectedNodes(); - if (this.__isSelectionEmpty(selectedNodeUIs)) { - return; - } - - const selectedNodes = []; - selectedNodeUIs.forEach(selectedNodeUI => { - selectedNodes.push(selectedNodeUI.getNode()); - }); - - const workbench = this.getStudy().getWorkbench(); - const currentModel = this.__workbenchUI.getCurrentModel(); - workbench.groupNodes(currentModel, selectedNodes); - - this.nodeSelected(currentModel.getNodeId ? currentModel.getNodeId() : this.getStudy().getUuid()); - this.__workbenchChanged(); - - this.__workbenchUI.resetSelectedNodes(); - }, - - __ungroupSelection: function() { - // Some checks - if (!osparc.data.Permissions.getInstance().canDo("study.node.create", true)) { - return; - } - const selectedNodeUIs = this.__workbenchUI.getSelectedNodes(); - if (this.__isSelectionEmpty(selectedNodeUIs)) { - return; - } - if (selectedNodeUIs.length > 1) { - osparc.component.message.FlashMessenger.getInstance().logAs("Select only one group", "ERROR"); - return; - } - const nodesGroup = selectedNodeUIs[0].getNode(); - if (!nodesGroup.isContainer()) { - osparc.component.message.FlashMessenger.getInstance().logAs("Select a group", "ERROR"); - return; - } - - // Collect info - const workbench = this.getStudy().getWorkbench(); - const currentModel = this.__workbenchUI.getCurrentModel(); - workbench.ungroupNode(currentModel, nodesGroup); - - this.nodeSelected(currentModel.getNodeId ? currentModel.getNodeId() : this.getStudy().getUuid()); - this.__workbenchChanged(); - - this.__workbenchUI.resetSelectedNodes(); - }, - - __startPipeline: function() { - if (!osparc.data.Permissions.getInstance().canDo("study.start", true)) { - return; - } - - this.updateStudyDocument(true) - .then(() => { - this.__doStartPipeline(); - }); - }, - - __doStartPipeline: function() { - if (this.getStudy().getSweeper().hasSecondaryStudies()) { - const secondaryStudyIds = this.getStudy().getSweeper().getSecondaryStudyIds(); - secondaryStudyIds.forEach(secondaryStudyId => { - this.__requestStartPipeline(secondaryStudyId); - }); - } else { - this.getStudy().getWorkbench().clearProgressData(); - this.__requestStartPipeline(this.getStudy().getUuid()); - } - }, - - __requestStartPipeline: function(studyId) { - const url = "/computation/pipeline/" + encodeURIComponent(studyId) + "/start"; - const req = new osparc.io.request.ApiRequest(url, "POST"); - req.addListener("success", this.__onPipelinesubmitted, this); - req.addListener("error", e => { - this.getLogger().error(null, "Error submitting pipeline"); - }, this); - req.addListener("fail", e => { - this.getLogger().error(null, "Failed submitting pipeline"); - }, this); - req.send(); - - this.getLogger().info(null, "Starting pipeline"); - return true; - }, - - __onPipelinesubmitted: function(e) { - const resp = e.getTarget().getResponse(); - const pipelineId = resp.data["project_id"]; - this.getLogger().debug(null, "Pipeline ID " + pipelineId); - const notGood = [null, undefined, -1]; - if (notGood.includes(pipelineId)) { - this.getLogger().error(null, "Submission failed"); - } else { - this.getLogger().info(null, "Pipeline started"); - } - }, - - __onPipelineStopped: function(e) { - this.getStudy().getWorkbench().clearProgressData(); - }, - __startAutoSaveTimer: function() { let diffPatcher = osparc.wrapper.JsonDiffPatch.getInstance(); // Save every 5 seconds @@ -651,6 +193,10 @@ qx.Class.define("osparc.desktop.StudyEditor", { } }, + editSlides: function() { + this.__workbenchView.editSlides(); + }, + updateStudyDocument: function(run=false) { this.getStudy().setLastChangeDate(new Date()); const newObj = this.getStudy().serialize(); @@ -677,106 +223,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, closeStudy: function() { - this.__stopSlides(); this.getStudy().closeStudy(); - }, - - __checkMaximizeable: function() { - this.__scrollContainer.setVisibility("visible"); - this.__nodeView._maximizeIFrame(false); // eslint-disable-line no-underscore-dangle - const node = this.getStudy().getWorkbench().getNode(this.__currentNodeId); - if (node && node.getIFrame() && (node.getInputNodes().length === 0)) { - node.getLoadingPage().maximizeIFrame(true); - node.getIFrame().maximizeIFrame(true); - } - }, - - __maximizeIframe: function(maximize) { - this.__pane.getBlocker().setStyles({ - display: maximize ? "none" : "block" - }); - this.__scrollContainer.setVisibility(maximize ? "excluded" : "visible"); - }, - - __attachEventHandlers: function() { - const blocker = this.__pane.getBlocker(); - blocker.addListener("tap", this.__sidePanel.toggleCollapsed.bind(this.__sidePanel)); - - const splitter = this.__pane.getChildControl("splitter"); - splitter.setWidth(1); - - const maximizeIframeCb = msg => { - this.__maximizeIframe(msg.getData()); - }; - - this.addListener("appear", () => { - qx.event.message.Bus.getInstance().subscribe("maximizeIframe", maximizeIframeCb, this); - }, this); - - this.addListener("disappear", () => { - qx.event.message.Bus.getInstance().unsubscribe("maximizeIframe", maximizeIframeCb, this); - }, this); - - const controlsBar = this.__mainPanel.getControls(); - controlsBar.addListener("showSweeper", this.__showSweeper, this); - controlsBar.addListener("showWorkbench", this.__showWorkbenchUI, this); - controlsBar.addListener("showSettings", this.__showSettings, this); - controlsBar.addListener("groupSelection", this.__groupSelection, this); - controlsBar.addListener("ungroupSelection", this.__ungroupSelection, this); - controlsBar.addListener("startPipeline", this.__startPipeline, this); - }, - - __attachSocketEventHandlers: function() { - // Listen to socket - const socket = osparc.wrapper.WebSocket.getInstance(); - - // callback for incoming logs - const slotName = "logger"; - if (!socket.slotExists(slotName)) { - socket.on(slotName, function(jsonString) { - const data = JSON.parse(jsonString); - if (Object.prototype.hasOwnProperty.call(data, "project_id") && this.getStudy().getUuid() !== data["project_id"]) { - // Filtering out logs from other studies - return; - } - this.getLogger().infos(data["Node"], data["Messages"]); - }, this); - } - socket.emit(slotName); - - // callback for incoming progress - const slotName2 = "progress"; - if (!socket.slotExists(slotName2)) { - socket.on(slotName2, function(data) { - const d = JSON.parse(data); - const nodeId = d["Node"]; - const progress = 100 * Number.parseFloat(d["Progress"]).toFixed(4); - const workbench = this.getStudy().getWorkbench(); - const node = workbench.getNode(nodeId); - if (node) { - node.getStatus().setProgress(progress); - } - }, this); - } - - // callback for node updates - const slotName3 = "nodeUpdated"; - if (!socket.slotExists(slotName3)) { - socket.on(slotName3, data => { - const d = JSON.parse(data); - const nodeId = d["Node"]; - const nodeData = d["Data"]; - const workbench = this.getStudy().getWorkbench(); - const node = workbench.getNode(nodeId); - if (node) { - node.setOutputData(nodeData.outputs); - if (nodeData.progress) { - const progress = Number.parseInt(nodeData.progress); - node.getStatus().setProgress(progress); - } - } - }, this); - } } } }); diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js new file mode 100644 index 00000000000..fafa8dd5fb5 --- /dev/null +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -0,0 +1,630 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2020 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +/** + * + */ + +qx.Class.define("osparc.desktop.WorkbenchView", { + extend: qx.ui.splitpane.Pane, + + construct: function() { + this.base(arguments, "horizontal"); + + const sidePanel = this.__sidePanel = new osparc.desktop.SidePanel().set({ + minWidth: 0, + width: Math.min(parseInt(window.innerWidth*0.25), 350) + }); + osparc.utils.Utils.addBorder(sidePanel, 2, "right"); + const scroll = this.__scrollContainer = new qx.ui.container.Scroll().set({ + minWidth: 0 + }); + scroll.add(sidePanel); + + this.add(scroll, 0); // flex 0 + + const mainPanel = this.__mainPanel = new osparc.desktop.MainPanel(); + this.add(mainPanel, 1); // flex 1 + + this.__attachEventHandlers(); + }, + + events: { + "startStudy": "qx.event.type.Data" + }, + + properties: { + study: { + check: "osparc.data.model.Study", + nullable: false + } + }, + + members: { + __sidePanel: null, + __scrollContainer: null, + __mainPanel: null, + __workbenchUI: null, + __nodeView: null, + __groupNodeView: null, + __nodesTree: null, + __extraView: null, + __loggerView: null, + __currentNodeId: null, + + initViews: function() { + this.__initViews(); + this.__connectEvents(); + this.__attachSocketEventHandlers(); + }, + + nodeSelected: function(nodeId) { + if (!nodeId) { + this.__loggerView.setCurrentNodeId(); + return; + } + if (this.__nodesTree) { + this.__nodesTree.setCurrentNodeId(nodeId); + } + if (this.__nodeView) { + this.__nodeView.restoreIFrame(); + } + if (this.__groupNodeView) { + this.__groupNodeView.restoreIFrame(); + } + this.__currentNodeId = nodeId; + this.getStudy().getUi().setCurrentNodeId(nodeId); + + const study = this.getStudy(); + const workbench = study.getWorkbench(); + if (nodeId === study.getUuid()) { + this.__showInMainView(this.__workbenchUI, nodeId); + this.__workbenchUI.loadModel(workbench); + } else { + const node = workbench.getNode(nodeId); + if (node.isContainer()) { + this.__groupNodeView.setNode(node); + this.__showInMainView(this.__workbenchUI, nodeId); + this.__workbenchUI.loadModel(node); + this.__groupNodeView.populateLayout(); + } else if (node.isFilePicker()) { + const nodeView = new osparc.component.node.FilePickerNodeView(node); + this.__showInMainView(nodeView, nodeId); + nodeView.populateLayout(); + } else { + this.__nodeView.setNode(node); + this.__showInMainView(this.__nodeView, nodeId); + this.__nodeView.populateLayout(); + } + } + }, + + getLogger: function() { + return this.__loggerView; + }, + + editSlides: function() { + const uiData = this.getStudy().getUi(); + const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(uiData.getSlideshow()); + const title = this.tr("Edit Slides"); + const win = osparc.ui.window.Window.popUpInWindow(nodesSlidesTree, title, 600, 500).set({ + modal: false, + clickAwayClose: false + }); + nodesSlidesTree.addListener("finished", () => { + win.close(); + }); + }, + + __showSweeper: function() { + const study = this.getStudy(); + const sweeper = new osparc.component.sweeper.Sweeper(study); + const title = this.tr("Sweeper"); + const win = osparc.ui.window.Window.popUpInWindow(sweeper, title, 400, 700); + sweeper.addListener("iterationSelected", e => { + win.close(); + const iterationStudyId = e.getData(); + const params = { + url: { + "projectId": iterationStudyId + } + }; + osparc.data.Resources.getOne("studies", params) + .then(studyData => { + study.removeIFrames(); + this.fireDataEvent("startStudy", studyData.uuid); + }); + }); + }, + + __showWorkbenchUI: function() { + const workbench = this.getStudy().getWorkbench(); + const currentNode = workbench.getNode(this.__currentNodeId); + if (currentNode === this.__workbenchUI.getCurrentModel()) { + this.__showInMainView(this.__workbenchUI, this.__currentNodeId); + } else { + osparc.component.message.FlashMessenger.getInstance().logAs("No Workbench view for this node", "ERROR"); + } + }, + + __showSettings: function() { + const workbench = this.getStudy().getWorkbench(); + const currentNode = workbench.getNode(this.__currentNodeId); + if (this.__groupNodeView.isPropertyInitialized("node") && currentNode === this.__groupNodeView.getNode()) { + this.__showInMainView(this.__groupNodeView, this.__currentNodeId); + } else if (this.__nodeView.isPropertyInitialized("node") && currentNode === this.__nodeView.getNode()) { + this.__showInMainView(this.__nodeView, this.__currentNodeId); + } else { + osparc.component.message.FlashMessenger.getInstance().logAs("No Settings view for this node", "ERROR"); + } + }, + + __isSelectionEmpty: function(selectedNodeUIs) { + if (selectedNodeUIs === null || selectedNodeUIs.length === 0) { + return true; + } + return false; + }, + + __groupSelection: function() { + // Some checks + if (!osparc.data.Permissions.getInstance().canDo("study.node.create", true)) { + return; + } + + const selectedNodeUIs = this.__workbenchUI.getSelectedNodes(); + if (this.__isSelectionEmpty(selectedNodeUIs)) { + return; + } + + const selectedNodes = []; + selectedNodeUIs.forEach(selectedNodeUI => { + selectedNodes.push(selectedNodeUI.getNode()); + }); + + const workbench = this.getStudy().getWorkbench(); + const currentModel = this.__workbenchUI.getCurrentModel(); + workbench.groupNodes(currentModel, selectedNodes); + + this.nodeSelected(currentModel.getNodeId ? currentModel.getNodeId() : this.getStudy().getUuid()); + this.__workbenchChanged(); + + this.__workbenchUI.resetSelectedNodes(); + }, + + __ungroupSelection: function() { + // Some checks + if (!osparc.data.Permissions.getInstance().canDo("study.node.create", true)) { + return; + } + const selectedNodeUIs = this.__workbenchUI.getSelectedNodes(); + if (this.__isSelectionEmpty(selectedNodeUIs)) { + return; + } + if (selectedNodeUIs.length > 1) { + osparc.component.message.FlashMessenger.getInstance().logAs("Select only one group", "ERROR"); + return; + } + const nodesGroup = selectedNodeUIs[0].getNode(); + if (!nodesGroup.isContainer()) { + osparc.component.message.FlashMessenger.getInstance().logAs("Select a group", "ERROR"); + return; + } + + // Collect info + const workbench = this.getStudy().getWorkbench(); + const currentModel = this.__workbenchUI.getCurrentModel(); + workbench.ungroupNode(currentModel, nodesGroup); + + this.nodeSelected(currentModel.getNodeId ? currentModel.getNodeId() : this.getStudy().getUuid()); + this.__workbenchChanged(); + + this.__workbenchUI.resetSelectedNodes(); + }, + + updateStudyDocument: function(run=false) { + this.getStudy().setLastChangeDate(new Date()); + const newObj = this.getStudy().serialize(); + const prjUuid = this.getStudy().getUuid(); + + const params = { + url: { + projectId: prjUuid, + run + }, + data: newObj + }; + return new Promise((resolve, reject) => { + osparc.data.Resources.fetch("studies", "put", params) + .then(data => { + resolve(); + }) + .catch(error => { + reject(); + }); + }); + }, + + __startPipeline: function() { + if (!osparc.data.Permissions.getInstance().canDo("study.start", true)) { + return; + } + + this.updateStudyDocument(true) + .then(() => { + this.__doStartPipeline(); + }); + }, + + __doStartPipeline: function() { + if (this.getStudy().getSweeper().hasSecondaryStudies()) { + const secondaryStudyIds = this.getStudy().getSweeper().getSecondaryStudyIds(); + secondaryStudyIds.forEach(secondaryStudyId => { + this.__requestStartPipeline(secondaryStudyId); + }); + } else { + this.getStudy().getWorkbench().clearProgressData(); + this.__requestStartPipeline(this.getStudy().getUuid()); + } + }, + + __requestStartPipeline: function(studyId) { + const url = "/computation/pipeline/" + encodeURIComponent(studyId) + "/start"; + const req = new osparc.io.request.ApiRequest(url, "POST"); + req.addListener("success", this.__onPipelinesubmitted, this); + req.addListener("error", e => { + this.getLogger().error(null, "Error submitting pipeline"); + }, this); + req.addListener("fail", e => { + this.getLogger().error(null, "Failed submitting pipeline"); + }, this); + req.send(); + + this.getLogger().info(null, "Starting pipeline"); + return true; + }, + + __onPipelinesubmitted: function(e) { + const resp = e.getTarget().getResponse(); + const pipelineId = resp.data["project_id"]; + this.getLogger().debug(null, "Pipeline ID " + pipelineId); + const notGood = [null, undefined, -1]; + if (notGood.includes(pipelineId)) { + this.getLogger().error(null, "Submission failed"); + } else { + this.getLogger().info(null, "Pipeline started"); + } + }, + + __maximizeIframe: function(maximize) { + this.getBlocker().setStyles({ + display: maximize ? "none" : "block" + }); + this.__scrollContainer.setVisibility(maximize ? "excluded" : "visible"); + }, + + __attachEventHandlers: function() { + const blocker = this.getBlocker(); + blocker.addListener("tap", this.__sidePanel.toggleCollapsed.bind(this.__sidePanel)); + + const splitter = this.getChildControl("splitter"); + splitter.setWidth(1); + + const maximizeIframeCb = msg => { + this.__maximizeIframe(msg.getData()); + }; + + this.addListener("appear", () => { + qx.event.message.Bus.getInstance().subscribe("maximizeIframe", maximizeIframeCb, this); + }, this); + + this.addListener("disappear", () => { + qx.event.message.Bus.getInstance().unsubscribe("maximizeIframe", maximizeIframeCb, this); + }, this); + + const controlsBar = this.__mainPanel.getControls(); + controlsBar.addListener("showSweeper", this.__showSweeper, this); + controlsBar.addListener("showWorkbench", this.__showWorkbenchUI, this); + controlsBar.addListener("showSettings", this.__showSettings, this); + controlsBar.addListener("groupSelection", this.__groupSelection, this); + controlsBar.addListener("ungroupSelection", this.__ungroupSelection, this); + controlsBar.addListener("startPipeline", this.__startPipeline, this); + }, + + __initViews: function() { + const study = this.getStudy(); + + const nodesTree = this.__nodesTree = new osparc.component.widget.NodesTree(study); + nodesTree.addListener("removeNode", e => { + const nodeId = e.getData(); + this.__removeNode(nodeId); + }, this); + this.__sidePanel.addOrReplaceAt(new osparc.desktop.PanelView(this.tr("Service tree"), nodesTree), 0, { + flex: 1 + }); + + const extraView = this.__extraView = new osparc.component.metadata.StudyInfo(study); + this.__sidePanel.addOrReplaceAt(new osparc.desktop.PanelView(this.tr("Study information"), extraView), 1, { + flex: 1 + }); + + const loggerView = this.__loggerView = new osparc.component.widget.logger.LoggerView(study.getWorkbench()); + const loggerPanel = new osparc.desktop.PanelView(this.tr("Logger"), loggerView); + osparc.utils.Utils.setIdToWidget(loggerPanel.getTitleLabel(), "loggerTitleLabel"); + this.__sidePanel.addOrReplaceAt(loggerPanel, 2, { + flex: 1 + }); + if (!osparc.data.Permissions.getInstance().canDo("study.logger.debug.read")) { + loggerPanel.setCollapsed(true); + } + + const workbenchUI = this.__workbenchUI = new osparc.component.workbench.WorkbenchUI(study.getWorkbench()); + workbenchUI.addListener("removeEdge", e => { + const edgeId = e.getData(); + this.__removeEdge(edgeId); + }, this); + + this.__nodeView = new osparc.component.node.NodeView().set({ + minHeight: 200 + }); + + this.__groupNodeView = new osparc.component.node.GroupNodeView().set({ + minHeight: 200 + }); + }, + + + __removeNode: function(nodeId) { + if (nodeId === this.__currentNodeId) { + return false; + } + + const workbench = this.getStudy().getWorkbench(); + const connectedEdges = workbench.getConnectedEdges(nodeId); + if (workbench.removeNode(nodeId)) { + // remove first the connected edges + for (let i=0; i { + this.__retrieveInputs(node, portKey); + }); + this.getLogger().debug(null, "Updating pipeline"); + }, + + __retrieveInputs: function(node, portKey = null) { + this.getLogger().debug(null, "Retrieveing inputs"); + if (node) { + node.retrieveInputs(portKey); + } + }, + + __showInMainView: function(widget, nodeId) { + this.__mainPanel.setMainView(widget); + + this.__nodesTree.nodeSelected(nodeId); + this.__loggerView.setCurrentNodeId(nodeId); + + const controlsBar = this.__mainPanel.getControls(); + controlsBar.setWorkbenchVisibility(widget === this.__workbenchUI); + controlsBar.setExtraViewVisibility(this.__groupNodeView && this.__groupNodeView.getNode() && nodeId === this.__groupNodeView.getNode().getNodeId()); + }, + + __workbenchChanged: function() { + this.__nodesTree.populateTree(); + this.__nodesTree.nodeSelected(this.__currentNodeId); + }, + + __connectEvents: function() { + const workbench = this.getStudy().getWorkbench(); + workbench.addListener("workbenchChanged", this.__workbenchChanged, this); + + workbench.addListener("retrieveInputs", e => { + const data = e.getData(); + const node = data["node"]; + const portKey = data["portKey"]; + this.__updatePipelineAndRetrieve(node, portKey); + }, this); + + workbench.addListener("showInLogger", ev => { + const data = ev.getData(); + const nodeId = data.nodeId; + const msg = data.msg; + this.getLogger().info(nodeId, msg); + }, this); + + const workbenchUI = this.__workbenchUI; + const nodesTree = this.__nodesTree; + [ + nodesTree, + workbenchUI + ].forEach(widget => { + widget.addListener("nodeDoubleClicked", e => { + const nodeId = e.getData(); + this.nodeSelected(nodeId); + }, this); + }); + + nodesTree.addListener("changeSelectedNode", e => { + const node = workbenchUI.getNodeUI(e.getData()); + if (node && node.classname.includes("NodeUI")) { + node.setActive(true); + } + }); + nodesTree.addListener("exportNode", e => { + const nodeId = e.getData(); + this.__exportMacro(nodeId); + }); + + workbenchUI.addListener("changeSelectedNode", e => { + const nodeId = e.getData(); + nodesTree.nodeSelected(nodeId); + }); + }, + + __exportMacro: function(nodeId) { + if (!osparc.data.Permissions.getInstance().canDo("study.node.export", true)) { + return; + } + const node = this.getStudy().getWorkbench().getNode(nodeId); + if (node && node.isContainer()) { + const exportDAGView = new osparc.component.export.ExportDAG(node); + const window = new qx.ui.window.Window(this.tr("Export: ") + node.getLabel()).set({ + appearance: "service-window", + layout: new qx.ui.layout.Grow(), + autoDestroy: true, + contentPadding: 0, + width: 700, + height: 700, + showMinimize: false, + modal: true + }); + window.add(exportDAGView); + window.center(); + window.open(); + + window.addListener("close", () => { + exportDAGView.tearDown(); + }, this); + + exportDAGView.addListener("finished", () => { + window.close(); + }, this); + } + }, + + __attachSocketEventHandlers: function() { + // Listen to socket + const socket = osparc.wrapper.WebSocket.getInstance(); + + // callback for incoming logs + const slotName = "logger"; + if (!socket.slotExists(slotName)) { + socket.on(slotName, function(jsonString) { + const data = JSON.parse(jsonString); + if (Object.prototype.hasOwnProperty.call(data, "project_id") && this.getStudy().getUuid() !== data["project_id"]) { + // Filtering out logs from other studies + return; + } + this.getLogger().infos(data["Node"], data["Messages"]); + }, this); + } + socket.emit(slotName); + + // callback for incoming progress + const slotName2 = "progress"; + if (!socket.slotExists(slotName2)) { + socket.on(slotName2, function(data) { + const d = JSON.parse(data); + const nodeId = d["Node"]; + const progress = 100 * Number.parseFloat(d["Progress"]).toFixed(4); + const workbench = this.getStudy().getWorkbench(); + const node = workbench.getNode(nodeId); + if (node) { + node.getStatus().setProgress(progress); + } + }, this); + } + + // callback for node updates + const slotName3 = "nodeUpdated"; + if (!socket.slotExists(slotName3)) { + socket.on(slotName3, data => { + const d = JSON.parse(data); + const nodeId = d["Node"]; + const nodeData = d["Data"]; + const workbench = this.getStudy().getWorkbench(); + const node = workbench.getNode(nodeId); + if (node) { + node.setOutputData(nodeData.outputs); + if (nodeData.progress) { + const progress = Number.parseInt(nodeData.progress); + node.getStatus().setProgress(progress); + } + } + }, this); + } + }, + + __checkMaximizeable: function() { + this.__scrollContainer.setVisibility("visible"); + this.__nodeView._maximizeIFrame(false); // eslint-disable-line no-underscore-dangle + const node = this.getStudy().getWorkbench().getNode(this.__currentNodeId); + if (node && node.getIFrame() && (node.getInputNodes().length === 0)) { + node.getLoadingPage().maximizeIFrame(true); + node.getIFrame().maximizeIFrame(true); + } + }, + + openOneNode: function() { + const validNodeIds = []; + const allNodes = this.getStudy().getWorkbench().getNodes(true); + Object.values(allNodes).forEach(node => { + if (!node.isFilePicker()) { + validNodeIds.push(node.getNodeId()); + } + }); + + const preferencesSettings = osparc.desktop.preferences.Preferences.getInstance(); + if (validNodeIds.length === 1 && preferencesSettings.getAutoOpenNode()) { + this.nodeSelected(validNodeIds[0]); + // Todo Odei: A bit of a hack + qx.event.Timer.once(() => { + this.__checkMaximizeable(); + }, this, 10); + } else { + this.nodeSelected(this.getStudy().getUuid()); + } + } + } +}); From 010a5bf9a0bbad2d56aea6146aa3485242982512 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 15 Oct 2020 15:45:05 +0200 Subject: [PATCH 068/110] editSlides moved to NodesTree --- .../class/osparc/component/widget/NodesTree.js | 8 ++++++++ .../client/source/class/osparc/desktop/MainPage.js | 7 ------- .../source/class/osparc/desktop/NavigationBar.js | 12 +----------- .../source/class/osparc/desktop/StudyEditor.js | 4 ---- .../source/class/osparc/desktop/WorkbenchView.js | 5 ++++- 5 files changed, 13 insertions(+), 23 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 449bca4f6fa..97c7d71f73e 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -51,6 +51,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { }, events: { + "slidesEdit": "qx.event.type.Event", "nodeDoubleClicked": "qx.event.type.Data", "removeNode": "qx.event.type.Data", "exportNode": "qx.event.type.Data", @@ -80,6 +81,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { members: { __toolBar: null, __tree: null, + __editSlidesBtn: null, __exportButton: null, __openButton: null, __deleteButton: null, @@ -117,6 +119,12 @@ qx.Class.define("osparc.component.widget.NodesTree", { const iconSize = 14; const toolbar = this.__toolBar = new qx.ui.toolbar.ToolBar(); + const editBtn = this.__editSlidesBtn = new qx.ui.toolbar.Button(this.tr("Slides"), "@FontAwesome5Solid/paw/"+iconSize); + editBtn.addListener("execute", () => { + this.fireEvent("slidesEdit"); + }, this); + toolbar.add(editBtn); + toolbar.addSpacer(); if (osparc.data.Permissions.getInstance().canDo("study.node.export")) { diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 356f9b2feb9..90a921ae713 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -97,13 +97,6 @@ qx.Class.define("osparc.desktop.MainPage", { } }, this); - navBar.addListener("slidesEdit", () => { - if (this.__studyEditor) { - navBar.setPageContext(osparc.desktop.NavigationBar.PAGE_CONTEXT[1]); - this.__studyEditor.editSlides(); - } - }, this); - navBar.addListener("nodeSelected", e => { if (this.__studyEditor) { let nodeId = e.getData(); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index f68c0c0bca8..433300d3149 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -65,8 +65,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { "nodeSelected": "qx.event.type.Data", "dashboardPressed": "qx.event.type.Event", "slidesStart": "qx.event.type.Event", - "slidesStop": "qx.event.type.Event", - "slidesEdit": "qx.event.type.Event" + "slidesStop": "qx.event.type.Event" }, properties: { @@ -104,7 +103,6 @@ qx.Class.define("osparc.desktop.NavigationBar", { __slidesMenu: null, __startSlidesBtn: null, __stopSlidesBtn: null, - __editSlidesBtn: null, __studyTitle: null, __workbenchNodesLayout: null, __guidedNodesLayout: null, @@ -378,11 +376,9 @@ qx.Class.define("osparc.desktop.NavigationBar", { if (this.getPageContext() === "slides") { this.__startSlidesBtn.setEnabled(false); this.__stopSlidesBtn.setEnabled(true); - this.__editSlidesBtn.setEnabled(false); } else { this.__startSlidesBtn.setEnabled(true); this.__stopSlidesBtn.setEnabled(false); - this.__editSlidesBtn.setEnabled(true); } } else { this.__slidesMenu.exclude(); @@ -424,12 +420,6 @@ qx.Class.define("osparc.desktop.NavigationBar", { }, this); menu.add(stopBtn); - const editBtn = this.__editSlidesBtn = new qx.ui.menu.Button(this.tr("Edit")); - editBtn.addListener("execute", () => { - this.fireEvent("slidesEdit"); - }, this); - menu.add(editBtn); - return new qx.ui.form.MenuButton(this.tr("Slides"), null, menu); }, diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 4ef615fc498..1bdbd2b2326 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -193,10 +193,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { } }, - editSlides: function() { - this.__workbenchView.editSlides(); - }, - updateStudyDocument: function(run=false) { this.getStudy().setLastChangeDate(new Date()); const newObj = this.getStudy().serialize(); diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index fafa8dd5fb5..9321c746551 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -117,7 +117,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", { return this.__loggerView; }, - editSlides: function() { + __editSlides: function() { const uiData = this.getStudy().getUi(); const nodesSlidesTree = new osparc.component.widget.NodesSlidesTree(uiData.getSlideshow()); const title = this.tr("Edit Slides"); @@ -349,6 +349,9 @@ qx.Class.define("osparc.desktop.WorkbenchView", { const study = this.getStudy(); const nodesTree = this.__nodesTree = new osparc.component.widget.NodesTree(study); + nodesTree.addListener("slidesEdit", () => { + this.__editSlides(); + }, this); nodesTree.addListener("removeNode", e => { const nodeId = e.getData(); this.__removeNode(nodeId); From 8ad929ff188de2e093c01a386e052c22b72c0ddc Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 15 Oct 2020 16:54:17 +0200 Subject: [PATCH 069/110] first working version --- .../class/osparc/desktop/SlideShowView.js | 121 ++++++++++++++++-- .../class/osparc/desktop/StudyEditor.js | 2 +- 2 files changed, 114 insertions(+), 9 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/SlideShowView.js b/services/web/client/source/class/osparc/desktop/SlideShowView.js index a09d41806b9..4e2660b815f 100644 --- a/services/web/client/source/class/osparc/desktop/SlideShowView.js +++ b/services/web/client/source/class/osparc/desktop/SlideShowView.js @@ -36,27 +36,132 @@ qx.Class.define("osparc.desktop.SlideShowView", { }, members: { + __nodeView: null, + __controlsBar: null, + __prvsBtn: null, + __nextBtn: null, + __currentNodeId: null, + initViews: function() { this.__initViews(); + + this.__showFirstNode(); }, - nodeSelected: function(nodeId) { - console.log(nodeId); + __showFirstNode: function() { + const study = this.getStudy(); + if (study) { + const slideShow = study.getUi().getSlideshow(); + const nodes = []; + for (let nodeId in slideShow) { + const node = slideShow[nodeId]; + nodes.push({ + ...node, + nodeId + }); + } + nodes.sort((a, b) => (a.position > b.position) ? 1 : -1); + this.nodeSelected(nodes[0].nodeId); + } }, - startSlides: function() { - console.log("startSlides"); + nodeSelected: function(nodeId) { + this.__currentNodeId = nodeId; + this.getStudy().getUi().setCurrentNodeId(nodeId); + + const node = this.getStudy().getWorkbench().getNode(nodeId); + if (node) { + this.__nodeView.setNode(node); + this.__nodeView.populateLayout(); + } + this.getStudy().getUi().setCurrentNodeId(nodeId); }, - stopSlides: function() { - console.log("stopSlides"); + startSlides: function() { + const currentNodeId = this.getStudy().getUi().getCurrentNodeId(); + const study = this.getStudy(); + const slideShow = study.getUi().getSlideshow(); + const isValid = Object.keys(slideShow).indexOf(currentNodeId) !== -1; + if (isValid && currentNodeId) { + this.nodeSelected(currentNodeId); + } else { + this.__showFirstNode(); + } }, __initViews: function() { - const label = new qx.ui.basic.Label("Hey"); - this._add(label, { + const nodeView = this.__nodeView = new osparc.component.node.NodeView(); + this._add(nodeView, { + flex: 1 + }); + + const controlsBar = this.__controlsBar = new qx.ui.container.Composite(new qx.ui.layout.HBox(10)).set({ + padding: 5 + }); + + controlsBar.add(new qx.ui.core.Spacer(), { flex: 1 }); + + const prvsBtn = this.__prvsBtn = new qx.ui.form.Button(this.tr("Previuos")).set({ + allowGrowX: false + }); + prvsBtn.addListener("execute", () => { + this.__previous(); + }, this); + controlsBar.add(prvsBtn); + + const nextBtn = this.__nextBtn = new qx.ui.form.Button(this.tr("Next")).set({ + allowGrowX: false + }); + nextBtn.addListener("execute", () => { + this.__next(); + }, this); + controlsBar.add(nextBtn); + + this._add(controlsBar); + }, + + __next: function() { + const study = this.getStudy(); + if (study) { + const slideShow = study.getUi().getSlideshow(); + const nodes = []; + for (let nodeId in slideShow) { + const node = slideShow[nodeId]; + nodes.push({ + ...node, + nodeId + }); + } + nodes.sort((a, b) => (a.position > b.position) ? 1 : -1); + + const idx = nodes.findIndex(node => node.nodeId === this.__currentNodeId); + if (idx > -1 && idx+1 < nodes.length) { + this.nodeSelected(nodes[idx+1].nodeId); + } + } + }, + + __previous: function() { + const study = this.getStudy(); + if (study) { + const slideShow = study.getUi().getSlideshow(); + const nodes = []; + for (let nodeId in slideShow) { + const node = slideShow[nodeId]; + nodes.push({ + ...node, + nodeId + }); + } + nodes.sort((a, b) => (a.position > b.position) ? 1 : -1); + + const idx = nodes.findIndex(node => node.nodeId === this.__currentNodeId); + if (idx > -1 && idx-1 > -1) { + this.nodeSelected(nodes[idx-1].nodeId); + } + } } } }); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 1bdbd2b2326..7929e13e233 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -158,7 +158,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { break; case "slides": this.__viewsStack.setSelection([this.__slideshowView]); - this.startSlides(); + this.__slideshowView.startSlides(); break; } }, From 47774f708159ca91f92433bdc5bf815ef1c4c93f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 15 Oct 2020 17:05:25 +0200 Subject: [PATCH 070/110] this is looking good --- .../source/class/osparc/desktop/NavigationBar.js | 10 ++++++++++ .../source/class/osparc/desktop/SlideShowView.js | 3 +++ 2 files changed, 13 insertions(+) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 433300d3149..4531f119435 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -323,6 +323,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { if (study) { this.__guidedNodesLayout.removeAll(); const radioGroup = new qx.ui.form.RadioGroup(); + const currentNodeId = study.getUi().getCurrentNodeId(); const slideShow = study.getUi().getSlideshow(); const nodes = []; for (let nodeId in slideShow) { @@ -333,11 +334,18 @@ qx.Class.define("osparc.desktop.NavigationBar", { }); } nodes.sort((a, b) => (a.position > b.position) ? 1 : -1); + let selectedBtn = null; nodes.forEach(node => { const btn = this.__createNodeSlideBtn(node.nodeId, node.position); + if (node.nodeId === currentNodeId) { + selectedBtn = btn; + } this.__guidedNodesLayout.add(btn); radioGroup.add(btn); }); + if (selectedBtn) { + radioGroup.setSelection([selectedBtn]); + } radioGroup.setAllowEmptySelection(false); } }, @@ -602,6 +610,8 @@ qx.Class.define("osparc.desktop.NavigationBar", { study.getUi().addListener("changeCurrentNodeId", () => { if (this.getPageContext() === "workbench") { this.__populateWorkbenchNodesLayout(); + } else if (this.getPageContext() === "slides") { + this.__populateGuidedNodesLayout(); } }); } diff --git a/services/web/client/source/class/osparc/desktop/SlideShowView.js b/services/web/client/source/class/osparc/desktop/SlideShowView.js index 4e2660b815f..7058a9b611d 100644 --- a/services/web/client/source/class/osparc/desktop/SlideShowView.js +++ b/services/web/client/source/class/osparc/desktop/SlideShowView.js @@ -73,6 +73,8 @@ qx.Class.define("osparc.desktop.SlideShowView", { if (node) { this.__nodeView.setNode(node); this.__nodeView.populateLayout(); + this.__nodeView.getInputsView().exclude(); + this.__nodeView.getOutputsView().exclude(); } this.getStudy().getUi().setCurrentNodeId(nodeId); }, @@ -96,6 +98,7 @@ qx.Class.define("osparc.desktop.SlideShowView", { }); const controlsBar = this.__controlsBar = new qx.ui.container.Composite(new qx.ui.layout.HBox(10)).set({ + minHeight: 40, padding: 5 }); From 9e502180f1810c9625ebb8aec73c7e268c04bf67 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 15 Oct 2020 17:19:25 +0200 Subject: [PATCH 071/110] minor --- .../web/client/source/class/osparc/data/model/Study.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/services/web/client/source/class/osparc/data/model/Study.js b/services/web/client/source/class/osparc/data/model/Study.js index 814a6b4de5c..3b98b862942 100644 --- a/services/web/client/source/class/osparc/data/model/Study.js +++ b/services/web/client/source/class/osparc/data/model/Study.js @@ -141,9 +141,7 @@ qx.Class.define("osparc.data.model.Study", { sweeper: { check: "osparc.data.model.Sweeper", nullable: false - }, - - state: {} + } }, statics: { @@ -251,10 +249,6 @@ qx.Class.define("osparc.data.model.Study", { let jsonObject = {}; const propertyKeys = this.self().getProperties(); propertyKeys.forEach(key => { - // TODO OM: Hacky - if (key === "state") { - return; - } if (key === "sweeper") { jsonObject["dev"] = {}; jsonObject["dev"]["sweeper"] = this.getSweeper().serialize(); From b5f092bdf8a56a0534236d689e5cb871ca9a7881 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 09:08:23 +0200 Subject: [PATCH 072/110] missed in merge --- .../class/osparc/desktop/StudyEditor.js | 6 --- .../class/osparc/desktop/WorkbenchView.js | 52 ++++++++++--------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 7929e13e233..cd8b88fc88a 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -145,12 +145,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { return this.__workbenchView.getLogger(); }, - __getCurrentPipeline: function() { - const saveContainers = false; - const currentPipeline = this.getStudy().getWorkbench().serialize(saveContainers); - return currentPipeline; - }, - _applyPageContext: function(newCtxt) { switch (newCtxt) { case "workbench": diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index 9321c746551..0c82cb39d4e 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -236,29 +236,6 @@ qx.Class.define("osparc.desktop.WorkbenchView", { this.__workbenchUI.resetSelectedNodes(); }, - updateStudyDocument: function(run=false) { - this.getStudy().setLastChangeDate(new Date()); - const newObj = this.getStudy().serialize(); - const prjUuid = this.getStudy().getUuid(); - - const params = { - url: { - projectId: prjUuid, - run - }, - data: newObj - }; - return new Promise((resolve, reject) => { - osparc.data.Resources.fetch("studies", "put", params) - .then(data => { - resolve(); - }) - .catch(error => { - reject(); - }); - }); - }, - __startPipeline: function() { if (!osparc.data.Permissions.getInstance().canDo("study.start", true)) { return; @@ -290,7 +267,11 @@ qx.Class.define("osparc.desktop.WorkbenchView", { this.getLogger().error(null, "Error submitting pipeline"); }, this); req.addListener("fail", e => { - this.getLogger().error(null, "Failed submitting pipeline"); + if (e.getTarget().getResponse().error.status == "403") { + this.getLogger().error(null, "Pipeline is already running"); + } else { + this.getLogger().error(null, "Failed submitting pipeline"); + } }, this); req.send(); @@ -628,6 +609,29 @@ qx.Class.define("osparc.desktop.WorkbenchView", { } else { this.nodeSelected(this.getStudy().getUuid()); } + }, + + updateStudyDocument: function(run=false) { + this.getStudy().setLastChangeDate(new Date()); + const newObj = this.getStudy().serialize(); + const prjUuid = this.getStudy().getUuid(); + + const params = { + url: { + projectId: prjUuid, + run + }, + data: newObj + }; + return new Promise((resolve, reject) => { + osparc.data.Resources.fetch("studies", "put", params) + .then(data => { + resolve(); + }) + .catch(error => { + reject(); + }); + }); } } }); From 9cb5b1095ffca30ba930de5d7ef692f292f9c161 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 09:30:34 +0200 Subject: [PATCH 073/110] Mark Position in Workbench model as depracted --- api/specs/common/schemas/project-v0.0.1.json | 3 ++- packages/models-library/src/models_library/projects.py | 2 +- .../web/client/source/class/osparc/desktop/WorkbenchView.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 8e2d97275f2..db28213c939 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -320,7 +320,8 @@ "y": { "type": "integer" } - } + }, + "deprecated": true } } } diff --git a/packages/models-library/src/models_library/projects.py b/packages/models-library/src/models_library/projects.py index fb3598080e4..74a2298da1b 100644 --- a/packages/models-library/src/models_library/projects.py +++ b/packages/models-library/src/models_library/projects.py @@ -159,7 +159,7 @@ class Node(BaseModel): example=["nodeUUid1", "nodeUuid2"], ) - position: Optional[Position] = Field(...) + position: Optional[Position] = Field(..., deprecated=True) class Config: extra = Extra.forbid diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index 0c82cb39d4e..1e3d81ccf1b 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -569,7 +569,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", { const nodeData = d["Data"]; const workbench = this.getStudy().getWorkbench(); const node = workbench.getNode(nodeId); - if (node) { + if (node && nodeData) { node.setOutputData(nodeData.outputs); if (nodeData.progress) { const progress = Number.parseInt(nodeData.progress); From 80b80bda40029d1f19df11baebb5a23484b3966e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 09:36:06 +0200 Subject: [PATCH 074/110] Update project-v0.0.1.json --- api/specs/common/schemas/project-v0.0.1.json | 1 - 1 file changed, 1 deletion(-) diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index a1856856509..95f11ce6751 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -322,7 +322,6 @@ } }, "deprecated": true - } }, "state": { "title": "RunningState", From 1fc004d14d3319ba350b5b5b0ca837068684f76c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 09:41:10 +0200 Subject: [PATCH 075/110] Mark Position in Workbench model as depracted II --- api/specs/common/schemas/project-v0.0.1-converted.yaml | 1 + .../api/v0/schemas/project-v0.0.1.json | 3 ++- .../src/simcore_service_storage/api/v0/openapi.yaml | 4 ++++ .../api/v0/schemas/project-v0.0.1.json | 3 ++- .../src/simcore_service_webserver/api/v0/openapi.yaml | 10 ++++++++++ .../api/v0/schemas/project-v0.0.1.json | 3 ++- 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/api/specs/common/schemas/project-v0.0.1-converted.yaml b/api/specs/common/schemas/project-v0.0.1-converted.yaml index ae9ac31379d..c9cb449871b 100644 --- a/api/specs/common/schemas/project-v0.0.1-converted.yaml +++ b/api/specs/common/schemas/project-v0.0.1-converted.yaml @@ -229,6 +229,7 @@ properties: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state diff --git a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json index 1e5a2bfa6c3..95f11ce6751 100644 --- a/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json +++ b/services/director/src/simcore_service_director/api/v0/schemas/project-v0.0.1.json @@ -320,7 +320,8 @@ "y": { "type": "integer" } - } + }, + "deprecated": true }, "state": { "title": "RunningState", diff --git a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml index bd42ec96495..3fee948fdca 100644 --- a/services/storage/src/simcore_service_storage/api/v0/openapi.yaml +++ b/services/storage/src/simcore_service_storage/api/v0/openapi.yaml @@ -1955,6 +1955,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -2316,6 +2317,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -2687,6 +2689,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -3158,6 +3161,7 @@ components: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state diff --git a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json index 1e5a2bfa6c3..95f11ce6751 100644 --- a/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json +++ b/services/storage/src/simcore_service_storage/api/v0/schemas/project-v0.0.1.json @@ -320,7 +320,8 @@ "y": { "type": "integer" } - } + }, + "deprecated": true }, "state": { "title": "RunningState", diff --git a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml index c65a501c74f..58afa93a2b0 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml +++ b/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml @@ -5898,6 +5898,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -6390,6 +6391,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -6762,6 +6764,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -7252,6 +7255,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -7748,6 +7752,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -8235,6 +8240,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -8607,6 +8613,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -9119,6 +9126,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -10443,6 +10451,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state @@ -10932,6 +10941,7 @@ paths: type: integer 'y': type: integer + deprecated: true state: title: RunningState description: the node's running state diff --git a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json index 1e5a2bfa6c3..95f11ce6751 100644 --- a/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json +++ b/services/web/server/src/simcore_service_webserver/api/v0/schemas/project-v0.0.1.json @@ -320,7 +320,8 @@ "y": { "type": "integer" } - } + }, + "deprecated": true }, "state": { "title": "RunningState", From 051a8da0b0b56aad80dbcf6dfd9ffd77d1214924 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 10:04:31 +0200 Subject: [PATCH 076/110] For now, enable slides in only "master" and "dev" --- .../osparc/component/widget/NodesTree.js | 23 +++++++++++++++++-- .../class/osparc/desktop/NavigationBar.js | 21 ++++++++++++++++- 2 files changed, 41 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 97c7d71f73e..3512b56730d 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -75,7 +75,20 @@ qx.Class.define("osparc.component.widget.NodesTree", { children.push(nodeInTree); } return children; - } + }, + + areSlidesEnabled: function() { + return new Promise((resolve, reject) => { + osparc.utils.LibVersions.getPlatformName() + .then(platformName => { + if (["dev", "master"].includes(platformName)) { + resolve(true); + } else { + resolve(false); + } + }); + }); + }, }, members: { @@ -119,7 +132,13 @@ qx.Class.define("osparc.component.widget.NodesTree", { const iconSize = 14; const toolbar = this.__toolBar = new qx.ui.toolbar.ToolBar(); - const editBtn = this.__editSlidesBtn = new qx.ui.toolbar.Button(this.tr("Slides"), "@FontAwesome5Solid/paw/"+iconSize); + const editBtn = this.__editSlidesBtn = new qx.ui.toolbar.Button(this.tr("Slides"), "@FontAwesome5Solid/paw/"+iconSize).set({ + visibility: "excluded" + }); + this.self().areSlidesEnabled() + .then(areSlidesEnabled => { + editBtn.setVisibility(areSlidesEnabled ? "show" : "excluded"); + }); editBtn.addListener("execute", () => { this.fireEvent("slidesEdit"); }, this); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 4531f119435..fffdc7ed3e7 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -94,6 +94,19 @@ qx.Class.define("osparc.desktop.NavigationBar", { 0: "dashboard", 1: "workbench", 2: "slides" + }, + + areSlidesEnabled: function() { + return new Promise((resolve, reject) => { + osparc.utils.LibVersions.getPlatformName() + .then(platformName => { + if (["dev", "master"].includes(platformName)) { + resolve(true); + } else { + resolve(false); + } + }); + }); } }, @@ -117,7 +130,13 @@ qx.Class.define("osparc.desktop.NavigationBar", { this._add(new qx.ui.core.Spacer(20)); - this.__slidesMenu = this.getChildControl("slides-menu"); + const slidesMenu = this.__slidesMenu = this.getChildControl("slides-menu").set({ + visibility: "excluded" + }); + this.self().areSlidesEnabled() + .then(areSlidesEnabled => { + slidesMenu.setVisibility(areSlidesEnabled ? "show" : "excluded"); + }); this._add(new qx.ui.core.Spacer(20)); From 66af71d41668431bf274a1032b0cb6e1d8077664 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 10:08:06 +0200 Subject: [PATCH 077/110] minor --- .../client/source/class/osparc/component/widget/NodesTree.js | 2 +- .../web/client/source/class/osparc/desktop/NavigationBar.js | 2 +- 2 files changed, 2 insertions(+), 2 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 3512b56730d..5a92abd2849 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -137,7 +137,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { }); this.self().areSlidesEnabled() .then(areSlidesEnabled => { - editBtn.setVisibility(areSlidesEnabled ? "show" : "excluded"); + editBtn.setVisibility(areSlidesEnabled ? "visible" : "excluded"); }); editBtn.addListener("execute", () => { this.fireEvent("slidesEdit"); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index fffdc7ed3e7..ca18b2a2d1c 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -135,7 +135,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { }); this.self().areSlidesEnabled() .then(areSlidesEnabled => { - slidesMenu.setVisibility(areSlidesEnabled ? "show" : "excluded"); + slidesMenu.setVisibility(areSlidesEnabled ? "visible" : "excluded"); }); this._add(new qx.ui.core.Spacer(20)); From e93c31e7276c90d0a3f14bf3a0d05749946c1f4c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 10:08:27 +0200 Subject: [PATCH 078/110] linting --- .../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 5a92abd2849..fc34563d50f 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -88,7 +88,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { } }); }); - }, + } }, members: { From 548f5d6f6d7b6033faa7b28a7c6dcc473159f468 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 10:17:50 +0200 Subject: [PATCH 079/110] Update 27c6a30d7c24_add_ui_in_projects_table.py --- .../versions/27c6a30d7c24_add_ui_in_projects_table.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/postgres-database/src/simcore_postgres_database/migration/versions/27c6a30d7c24_add_ui_in_projects_table.py b/packages/postgres-database/src/simcore_postgres_database/migration/versions/27c6a30d7c24_add_ui_in_projects_table.py index fcbf018d815..0407e43f317 100644 --- a/packages/postgres-database/src/simcore_postgres_database/migration/versions/27c6a30d7c24_add_ui_in_projects_table.py +++ b/packages/postgres-database/src/simcore_postgres_database/migration/versions/27c6a30d7c24_add_ui_in_projects_table.py @@ -1,7 +1,7 @@ """add ui in projects table Revision ID: 27c6a30d7c24 -Revises: 350103a7efbd +Revises: 009c81406676 Create Date: 2020-10-09 09:46:27.364227+00:00 """ @@ -11,7 +11,7 @@ # revision identifiers, used by Alembic. revision = '27c6a30d7c24' -down_revision = '350103a7efbd' +down_revision = '009c81406676' branch_labels = None depends_on = None From 67473a021df213cc7f90a50c9d37d8471e1c8bd5 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 10:26:28 +0200 Subject: [PATCH 080/110] Update NavigationBar.js --- .../class/osparc/desktop/NavigationBar.js | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index ca18b2a2d1c..97eba38789e 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -130,13 +130,9 @@ qx.Class.define("osparc.desktop.NavigationBar", { this._add(new qx.ui.core.Spacer(20)); - const slidesMenu = this.__slidesMenu = this.getChildControl("slides-menu").set({ + this.__slidesMenu = this.getChildControl("slides-menu").set({ visibility: "excluded" }); - this.self().areSlidesEnabled() - .then(areSlidesEnabled => { - slidesMenu.setVisibility(areSlidesEnabled ? "visible" : "excluded"); - }); this._add(new qx.ui.core.Spacer(20)); @@ -398,18 +394,21 @@ qx.Class.define("osparc.desktop.NavigationBar", { }, __setSlidesMenuVis: function(show) { - if (show && osparc.data.model.Study.isOwner(this.getStudy())) { - this.__slidesMenu.show(); - if (this.getPageContext() === "slides") { - this.__startSlidesBtn.setEnabled(false); - this.__stopSlidesBtn.setEnabled(true); - } else { - this.__startSlidesBtn.setEnabled(true); - this.__stopSlidesBtn.setEnabled(false); - } - } else { - this.__slidesMenu.exclude(); - } + this.self().areSlidesEnabled() + .then(areSlidesEnabled => { + if (show && areSlidesEnabled && osparc.data.model.Study.isOwner(this.getStudy())) { + this.__slidesMenu.show(); + if (this.getPageContext() === "slides") { + this.__startSlidesBtn.setEnabled(false); + this.__stopSlidesBtn.setEnabled(true); + } else { + this.__startSlidesBtn.setEnabled(true); + this.__stopSlidesBtn.setEnabled(false); + } + } else { + this.__slidesMenu.exclude(); + } + }); }, __setWorkbenchBtnsVis: function(show) { From c44ca53181b14440df29d8b7d045ca43ae9d5e99 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 10:48:44 +0200 Subject: [PATCH 081/110] Allow disabling slideshow --- .../component/widget/NodesSlidesTree.js | 37 +++++++++++++++---- .../class/osparc/desktop/SlideShowView.js | 6 ++- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index f3a889cb7e5..e45d1e7ae62 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -28,8 +28,10 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { this._setLayout(new qx.ui.layout.VBox(10)); this.__tree = this._createChildControlImpl("tree"); - const save = this._createChildControlImpl("save-button"); - save.addListener("execute", () => this.__saveSlides(), this); + const disable = this._createChildControlImpl("disable"); + disable.addListener("execute", () => this.__disableSlides(), this); + const enable = this._createChildControlImpl("enable"); + enable.addListener("execute", () => this.__enableSlides(), this); const model = this.__initTree(); this.__tree.setModel(model); @@ -85,13 +87,28 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { flex: 1 }); break; - case "save-button": - control = new qx.ui.form.Button(this.tr("Save")).set({ - allowGrowX: false, + case "buttons": + control = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({ alignX: "right" - }); + })); this._add(control); break; + case "disable": { + control = new qx.ui.form.Button(this.tr("Disable")).set({ + allowGrowX: false + }); + const buttons = this.getChildControl("buttons"); + buttons.add(control); + break; + } + case "enable": { + control = new qx.ui.form.Button(this.tr("Enable")).set({ + allowGrowX: false + }); + const buttons = this.getChildControl("buttons"); + buttons.add(control); + break; + } } return control || this.base(arguments, id); @@ -232,7 +249,7 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { this.__tree.refresh(); }, - __saveSlides: function() { + __enableSlides: function() { let slideshow = {}; const model = this.__tree.getModel(); const children = model.getChildren().toArray(); @@ -246,6 +263,12 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { const study = osparc.store.Store.getInstance().getCurrentStudy(); study.getUi().setSlideshow(slideshow); this.fireEvent("finished"); + }, + + __disableSlides: function() { + const study = osparc.store.Store.getInstance().getCurrentStudy(); + study.getUi().setSlideshow({}); + this.fireEvent("finished"); } } }); diff --git a/services/web/client/source/class/osparc/desktop/SlideShowView.js b/services/web/client/source/class/osparc/desktop/SlideShowView.js index 7058a9b611d..a16ee113b58 100644 --- a/services/web/client/source/class/osparc/desktop/SlideShowView.js +++ b/services/web/client/source/class/osparc/desktop/SlideShowView.js @@ -60,8 +60,10 @@ qx.Class.define("osparc.desktop.SlideShowView", { nodeId }); } - nodes.sort((a, b) => (a.position > b.position) ? 1 : -1); - this.nodeSelected(nodes[0].nodeId); + if (nodes.length) { + nodes.sort((a, b) => (a.position > b.position) ? 1 : -1); + this.nodeSelected(nodes[0].nodeId); + } } }, From efbdb0b20bf0bef1e6ec293afd8a53d544c1fb8e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 11:12:06 +0200 Subject: [PATCH 082/110] Start/Stop slides react to model changes --- .../source/class/osparc/data/model/StudyUI.js | 3 +- .../class/osparc/desktop/NavigationBar.js | 60 ++++++++++--------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/services/web/client/source/class/osparc/data/model/StudyUI.js b/services/web/client/source/class/osparc/data/model/StudyUI.js index 81bd64e33f1..4a0fc8dd7fc 100644 --- a/services/web/client/source/class/osparc/data/model/StudyUI.js +++ b/services/web/client/source/class/osparc/data/model/StudyUI.js @@ -43,7 +43,8 @@ qx.Class.define("osparc.data.model.StudyUI", { slideshow: { check: "Object", - nullable: true + nullable: true, + event: "changeSlideshow" }, currentNodeId: { diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 97eba38789e..6af7b0decbe 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -113,7 +113,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { members: { __dashboardBtn: null, __dashboardLabel: null, - __slidesMenu: null, + __slideBtns: null, __startSlidesBtn: null, __stopSlidesBtn: null, __studyTitle: null, @@ -130,7 +130,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { this._add(new qx.ui.core.Spacer(20)); - this.__slidesMenu = this.getChildControl("slides-menu").set({ + this.__slideBtns = this.getChildControl("slide-buttons").set({ visibility: "excluded" }); @@ -193,12 +193,8 @@ qx.Class.define("osparc.desktop.NavigationBar", { }); this._add(control); break; - case "slides-menu": - control = this.__createSlidesMenuBtn(); - control.set({ - ...this.self().BUTTON_OPTIONS, - font: "text-14" - }); + case "slide-buttons": + control = this.__createSlideBtns(); this._add(control); break; case "study-title": @@ -370,14 +366,14 @@ qx.Class.define("osparc.desktop.NavigationBar", { case "dashboard": this.__dashboardLabel.show(); this.__dashboardBtn.exclude(); - this.__setSlidesMenuVis(false); + this.__resetSlideBtnsVis(false); this.__setWorkbenchBtnsVis(false); this.__setSlidesBtnsVis(false); break; case "workbench": this.__dashboardLabel.exclude(); this.__dashboardBtn.show(); - this.__setSlidesMenuVis(true); + this.__resetSlideBtnsVis(true); this.__setWorkbenchBtnsVis(true); this.__setSlidesBtnsVis(false); this.__populateWorkbenchNodesLayout(); @@ -385,7 +381,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { case "slides": this.__dashboardLabel.exclude(); this.__dashboardBtn.show(); - this.__setSlidesMenuVis(true); + this.__resetSlideBtnsVis(true); this.__setWorkbenchBtnsVis(false); this.__setSlidesBtnsVis(true); this.__populateGuidedNodesLayout(); @@ -393,21 +389,26 @@ qx.Class.define("osparc.desktop.NavigationBar", { } }, - __setSlidesMenuVis: function(show) { + __resetSlideBtnsVis: function() { this.self().areSlidesEnabled() .then(areSlidesEnabled => { - if (show && areSlidesEnabled && osparc.data.model.Study.isOwner(this.getStudy())) { - this.__slidesMenu.show(); - if (this.getPageContext() === "slides") { - this.__startSlidesBtn.setEnabled(false); - this.__stopSlidesBtn.setEnabled(true); - } else { - this.__startSlidesBtn.setEnabled(true); - this.__stopSlidesBtn.setEnabled(false); + const context = ["workbench", "slides"].includes(this.getPageContext()); + if (areSlidesEnabled && context) { + const study = this.getStudy(); + const slides = Object.keys(study.getUi().getSlideshow()).length; + if (slides && osparc.data.model.Study.isOwner(study)) { + this.__slideBtns.show(); + if (this.getPageContext() === "slides") { + this.__startSlidesBtn.exclude(); + this.__stopSlidesBtn.show(); + } else if (this.getPageContext() === "workbench") { + this.__startSlidesBtn.show(); + this.__stopSlidesBtn.exclude(); + } + return; } - } else { - this.__slidesMenu.exclude(); } + this.__slideBtns.exclude(); }); }, @@ -429,24 +430,22 @@ qx.Class.define("osparc.desktop.NavigationBar", { } }, - __createSlidesMenuBtn: function() { - const menu = new qx.ui.menu.Menu().set({ - font: "text-14" - }); + __createSlideBtns: function() { + const menu = new qx.ui.toolbar.Part(); - const startBtn = this.__startSlidesBtn = new qx.ui.menu.Button(this.tr("Start")); + const startBtn = this.__startSlidesBtn = new qx.ui.toolbar.Button(this.tr("Start slides")); startBtn.addListener("execute", () => { this.fireEvent("slidesStart"); }, this); menu.add(startBtn); - const stopBtn = this.__stopSlidesBtn = new qx.ui.menu.Button(this.tr("Stop")); + const stopBtn = this.__stopSlidesBtn = new qx.ui.toolbar.Button(this.tr("Stop slides")); stopBtn.addListener("execute", () => { this.fireEvent("slidesStop"); }, this); menu.add(stopBtn); - return new qx.ui.form.MenuButton(this.tr("Slides"), null, menu); + return menu; }, __createManualMenuBtn: function() { @@ -625,6 +624,9 @@ qx.Class.define("osparc.desktop.NavigationBar", { _applyStudy: function(study) { if (study) { study.bind("name", this.__studyTitle, "value"); + study.getUi().addListener("changeSlideshow", () => { + this.__resetSlideBtnsVis(); + }); study.getUi().addListener("changeCurrentNodeId", () => { if (this.getPageContext() === "workbench") { this.__populateWorkbenchNodesLayout(); From 3864cb5673e696820b3da86d450dbb750687c64b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 11:15:15 +0200 Subject: [PATCH 083/110] minor --- .../web/client/source/class/osparc/desktop/SlideShowView.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/web/client/source/class/osparc/desktop/SlideShowView.js b/services/web/client/source/class/osparc/desktop/SlideShowView.js index a16ee113b58..7af8836500c 100644 --- a/services/web/client/source/class/osparc/desktop/SlideShowView.js +++ b/services/web/client/source/class/osparc/desktop/SlideShowView.js @@ -94,6 +94,8 @@ qx.Class.define("osparc.desktop.SlideShowView", { }, __initViews: function() { + this._removeAll(); + const nodeView = this.__nodeView = new osparc.component.node.NodeView(); this._add(nodeView, { flex: 1 From f8af1077a6116dd31490ba53f27593af4d313da3 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 11:50:18 +0200 Subject: [PATCH 084/110] Working on Optionals --- .../src/models_library/projects.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/models-library/src/models_library/projects.py b/packages/models-library/src/models_library/projects.py index c54515fa0b2..3be9f2dd830 100644 --- a/packages/models-library/src/models_library/projects.py +++ b/packages/models-library/src/models_library/projects.py @@ -98,14 +98,14 @@ class Config: class WorkbenchUI(BaseModel): - position: Optional[Position] = Field(..., description="The node position in the workbench") + position: Position = Field(..., description="The node position in the workbench") class Config: extra = Extra.forbid class Slideshow(BaseModel): - position: Optional[int] = Field(..., description="Slide's position", example=["0", "2"]) + position: int = Field(..., description="Slide's position", example=["0", "2"]) class Config: extra = Extra.forbid @@ -137,7 +137,12 @@ class Node(BaseModel): label: str = Field( ..., description="The short name of the node", example=["JupyterLab"] ) - progress: float = Field(..., ge=0, le=100, description="the node progress value") + progress: Optional[float] = Field( + 0, + ge=0, + le=100, + description="the node progress value" + ) thumbnail: Optional[HttpUrl] = Field( None, description="url of the latest screenshot of the node", @@ -145,13 +150,13 @@ class Node(BaseModel): ) inputs: Optional[Dict[InputID, InputTypes]] = Field( - ..., description="values of input properties" + {}, description="values of input properties" ) inputAccess: Optional[Dict[InputID, AccessEnum]] = Field( - ..., description="map with key - access level pairs" + {}, description="map with key - access level pairs" ) inputNodes: Optional[List[UUID4]] = Field( - ..., + [], description="node IDs of where the node is connected to", example=["nodeUuid1", "nodeUuid2"], ) @@ -159,7 +164,7 @@ class Node(BaseModel): outputs: Optional[Dict[OutputID, OutputTypes]] = None outputNode: Optional[bool] = Field(None, deprecated=True) outputNodes: Optional[List[UUID4]] = Field( - ..., + [], description="Used in group-nodes. Node IDs of those connected to the output", example=["nodeUuid1", "nodeUuid2"], ) @@ -170,15 +175,15 @@ class Node(BaseModel): example=["nodeUUid1", "nodeUuid2"], ) - position: Optional[Position] = Field(..., deprecated=True) + position: Optional[Position] = Field(None, deprecated=True) class Config: extra = Extra.forbid class StudyUI(BaseModel): - workbench: Optional[Dict[NodeID, WorkbenchUI]] = Field(...) - slideshow: Optional[Dict[NodeID, Slideshow]] = Field(...) + workbench: Optional[Dict[NodeID, WorkbenchUI]] = Field(None) + slideshow: Optional[Dict[NodeID, Slideshow]] = Field(None) class AccessRights(BaseModel): From 380c5c3143f616bcb96d12b4d01bcc94a3b0519e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 12:02:38 +0200 Subject: [PATCH 085/110] Working on Optionals II --- packages/models-library/src/models_library/projects.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/models-library/src/models_library/projects.py b/packages/models-library/src/models_library/projects.py index 3be9f2dd830..0902b14b99e 100644 --- a/packages/models-library/src/models_library/projects.py +++ b/packages/models-library/src/models_library/projects.py @@ -138,7 +138,7 @@ class Node(BaseModel): ..., description="The short name of the node", example=["JupyterLab"] ) progress: Optional[float] = Field( - 0, + None, ge=0, le=100, description="the node progress value" @@ -150,13 +150,13 @@ class Node(BaseModel): ) inputs: Optional[Dict[InputID, InputTypes]] = Field( - {}, description="values of input properties" + None, description="values of input properties" ) inputAccess: Optional[Dict[InputID, AccessEnum]] = Field( - {}, description="map with key - access level pairs" + None, description="map with key - access level pairs" ) inputNodes: Optional[List[UUID4]] = Field( - [], + None, description="node IDs of where the node is connected to", example=["nodeUuid1", "nodeUuid2"], ) @@ -164,7 +164,7 @@ class Node(BaseModel): outputs: Optional[Dict[OutputID, OutputTypes]] = None outputNode: Optional[bool] = Field(None, deprecated=True) outputNodes: Optional[List[UUID4]] = Field( - [], + None, description="Used in group-nodes. Node IDs of those connected to the output", example=["nodeUuid1", "nodeUuid2"], ) From c7431d8f2b9cdb5ed342b4248d043ccd78db2d8e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 12:12:37 +0200 Subject: [PATCH 086/110] Update project-v0.0.1.json --- api/specs/common/schemas/project-v0.0.1.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 95f11ce6751..8d9140749d1 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -101,7 +101,7 @@ "workbench": { "type": "object", "patternProperties": { - "^\\S+$": { + "^\\d+$": { "type": "object", "additionalProperties": false, "required": [ From 1758af2caccfed7cb031596dc7bed3674a1a1119 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 12:18:18 +0200 Subject: [PATCH 087/110] Update project-v0.0.1.json --- api/specs/common/schemas/project-v0.0.1.json | 24 ++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/api/specs/common/schemas/project-v0.0.1.json b/api/specs/common/schemas/project-v0.0.1.json index 8d9140749d1..29d08948ef9 100644 --- a/api/specs/common/schemas/project-v0.0.1.json +++ b/api/specs/common/schemas/project-v0.0.1.json @@ -315,10 +315,18 @@ ], "properties": { "x": { - "type": "integer" + "type": "integer", + "description": "The x position", + "example": [ + "12" + ] }, "y": { - "type": "integer" + "type": "integer", + "description": "The y position", + "example": [ + "15" + ] } }, "deprecated": true @@ -365,10 +373,18 @@ ], "properties": { "x": { - "type": "integer" + "type": "integer", + "description": "The x position", + "example": [ + "12" + ] }, "y": { - "type": "integer" + "type": "integer", + "description": "The y position", + "example": [ + "15" + ] } } } From 7e81dd5c8f7840cf9a23591ceb965d5009c02a1c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 15:26:37 +0200 Subject: [PATCH 088/110] renaming --- services/web/client/source/class/osparc/desktop/MainPage.js | 2 +- services/web/client/source/class/osparc/desktop/StudyEditor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 90a921ae713..6af6d462062 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -230,7 +230,7 @@ qx.Class.define("osparc.desktop.MainPage", { throw new Error(msg); } this.__showStudyEditor(this.__getStudyEditor()); - this.__studyEditor.setStudy(latestStudyData) + this.__studyEditor.setStudyData(latestStudyData) .then(() => { this.__syncStudyEditor(); }); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index cd8b88fc88a..c789b2eb797 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -59,7 +59,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { __autoSaveTimer: null, __lastSavedStudy: null, - setStudy: function(studyData) { + setStudyData: function(studyData) { return new Promise((resolve, reject) => { if (this.__settingStudy) { resolve(); From 83423518201dc6ec17e10a88f0cff38e84be4930 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 15:41:51 +0200 Subject: [PATCH 089/110] refactoring --- .../class/osparc/desktop/StudyEditor.js | 70 ++++++++++--------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index c789b2eb797..3d4c69b37a4 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -43,6 +43,12 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, properties: { + study: { + check: "osparc.data.model.Study", + nullable: true, + apply: "_applyStudy" + }, + pageContext: { check: ["workbench", "slides"], nullable: false, @@ -83,44 +89,42 @@ qx.Class.define("osparc.desktop.StudyEditor", { .then(values => { studyData = values[0]; const study = new osparc.data.model.Study(studyData); - this.__study = study; - this.__settingStudy = false; - - this._hideLoadingPage(); - + this.setStudy(study); resolve(); - - osparc.store.Store.getInstance().setCurrentStudy(study); - study.buildWorkbench(); - study.openStudy() - .then(() => { - study.getWorkbench().initWorkbench(); - }) - .catch(err => { - if ("status" in err && err["status"] == 423) { // Locked - const msg = study.getName() + this.tr(" is already opened"); - osparc.component.message.FlashMessenger.getInstance().logAs(msg, "ERROR"); - this.fireEvent("studyIsLocked"); - } else { - console.error(err); - } - }); - - this.__workbenchView.setStudy(study); - this.__workbenchView.initViews(); - - this.__slideshowView.setStudy(study); - this.__slideshowView.initViews(); - - this.__startAutoSaveTimer(); - - this.__workbenchView.openOneNode(); }); }); }, - getStudy: function() { - return this.__study; + _applyStudy: function(study) { + this.__settingStudy = false; + + this._hideLoadingPage(); + + osparc.store.Store.getInstance().setCurrentStudy(study); + study.buildWorkbench(); + study.openStudy() + .then(() => { + study.getWorkbench().initWorkbench(); + }) + .catch(err => { + if ("status" in err && err["status"] == 423) { // Locked + const msg = study.getName() + this.tr(" is already opened"); + osparc.component.message.FlashMessenger.getInstance().logAs(msg, "ERROR"); + this.fireEvent("studyIsLocked"); + } else { + console.error(err); + } + }); + + this.__workbenchView.setStudy(study); + this.__workbenchView.initViews(); + + this.__slideshowView.setStudy(study); + this.__slideshowView.initViews(); + + this.__startAutoSaveTimer(); + + this.__workbenchView.openOneNode(); }, // overridden From 731ed44760c66e75fd0054c9774ab162160db210 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 16:03:35 +0200 Subject: [PATCH 090/110] Only study owner can edit slides --- .../client/source/class/osparc/component/widget/NodesTree.js | 4 +++- .../web/client/source/class/osparc/desktop/NavigationBar.js | 3 +-- 2 files changed, 4 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 fc34563d50f..44d1643abda 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -137,7 +137,9 @@ qx.Class.define("osparc.component.widget.NodesTree", { }); this.self().areSlidesEnabled() .then(areSlidesEnabled => { - editBtn.setVisibility(areSlidesEnabled ? "visible" : "excluded"); + const study = osparc.store.Store.getInstance().getCurrentStudy(); + const isOwner = osparc.data.model.Study.isOwner(study); + editBtn.setVisibility(areSlidesEnabled && isOwner ? "visible" : "excluded"); }); editBtn.addListener("execute", () => { this.fireEvent("slidesEdit"); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 6af7b0decbe..b8070019fcf 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -395,8 +395,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { const context = ["workbench", "slides"].includes(this.getPageContext()); if (areSlidesEnabled && context) { const study = this.getStudy(); - const slides = Object.keys(study.getUi().getSlideshow()).length; - if (slides && osparc.data.model.Study.isOwner(study)) { + if (Object.keys(study.getUi().getSlideshow()).length) { this.__slideBtns.show(); if (this.getPageContext() === "slides") { this.__startSlidesBtn.exclude(); From bf7277bcd432edae973b79f0b3e10c1be3db54b5 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 16:07:32 +0200 Subject: [PATCH 091/110] renamings --- .../source/class/osparc/component/metadata/StudyInfo.js | 4 ++-- services/web/client/source/class/osparc/store/Store.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/services/web/client/source/class/osparc/component/metadata/StudyInfo.js b/services/web/client/source/class/osparc/component/metadata/StudyInfo.js index 1ebd03f6798..70d0370bffc 100644 --- a/services/web/client/source/class/osparc/component/metadata/StudyInfo.js +++ b/services/web/client/source/class/osparc/component/metadata/StudyInfo.js @@ -62,13 +62,13 @@ qx.Class.define("osparc.component.metadata.StudyInfo", { return moreInfoButton; }, - _applyStudy: function(newStudy) { + _applyStudy: function(study) { if (this.__studyDetails) { this._remove(this.__studyDetails); } const windowWidth = 400; - const studyDetails = this.__studyDetails = new osparc.component.metadata.StudyDetails(newStudy, windowWidth); + const studyDetails = this.__studyDetails = new osparc.component.metadata.StudyDetails(study, windowWidth); this._add(studyDetails); }, diff --git a/services/web/client/source/class/osparc/store/Store.js b/services/web/client/source/class/osparc/store/Store.js index 856fbf01d13..92ef1ab60b0 100644 --- a/services/web/client/source/class/osparc/store/Store.js +++ b/services/web/client/source/class/osparc/store/Store.js @@ -436,9 +436,9 @@ qx.Class.define("osparc.store.Store", { }); }, - _applyStudy: function(newStudy) { - if (newStudy) { - this.setCurrentStudyId(newStudy.getStudyId()); + _applyStudy: function(study) { + if (study) { + this.setCurrentStudyId(study.getStudyId()); } else { this.setCurrentStudyId(null); } From f8b40d36577d8fe0ce417d6f49b370668f121275 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 16 Oct 2020 16:46:30 +0200 Subject: [PATCH 092/110] more refactoring --- .../osparc/component/metadata/StudyInfo.js | 6 +--- .../osparc/component/widget/NodesTree.js | 29 ++++++++++++++----- .../class/osparc/desktop/WorkbenchView.js | 6 ++-- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/services/web/client/source/class/osparc/component/metadata/StudyInfo.js b/services/web/client/source/class/osparc/component/metadata/StudyInfo.js index 70d0370bffc..24070b517c4 100644 --- a/services/web/client/source/class/osparc/component/metadata/StudyInfo.js +++ b/services/web/client/source/class/osparc/component/metadata/StudyInfo.js @@ -23,10 +23,7 @@ qx.Class.define("osparc.component.metadata.StudyInfo", { extend: qx.ui.core.Widget, - /** - * @param study {osparc.data.model.Study} Study model - */ - construct: function(study) { + construct: function() { this.base(arguments); this.set({ @@ -36,7 +33,6 @@ qx.Class.define("osparc.component.metadata.StudyInfo", { this._setLayout(new qx.ui.layout.VBox(8)); this._add(this.__getMoreInfoMenuButton()); - this.setStudy(study); }, properties: { 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 44d1643abda..bb454647a9d 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -45,7 +45,6 @@ qx.Class.define("osparc.component.widget.NodesTree", { this.__toolBar = this._createChildControlImpl("toolbar"); this.__tree = this._createChildControlImpl("tree"); - this.populateTree(); this.__attachEventHandlers(); }, @@ -58,6 +57,14 @@ qx.Class.define("osparc.component.widget.NodesTree", { "changeSelectedNode": "qx.event.type.Data" }, + properties: { + study: { + check: "osparc.data.model.Study", + nullable: false, + apply: "_applyStudy" + } + }, + statics: { convertModel: function(nodes) { let children = []; @@ -119,6 +126,11 @@ qx.Class.define("osparc.component.widget.NodesTree", { return control || this.base(arguments, id); }, + _applyStudy: function(study) { + this.__populateToolbar(); + this.populateTree(); + }, + setCurrentNodeId: function(nodeId) { this.__currentNodeId = nodeId; }, @@ -135,12 +147,6 @@ qx.Class.define("osparc.component.widget.NodesTree", { const editBtn = this.__editSlidesBtn = new qx.ui.toolbar.Button(this.tr("Slides"), "@FontAwesome5Solid/paw/"+iconSize).set({ visibility: "excluded" }); - this.self().areSlidesEnabled() - .then(areSlidesEnabled => { - const study = osparc.store.Store.getInstance().getCurrentStudy(); - const isOwner = osparc.data.model.Study.isOwner(study); - editBtn.setVisibility(areSlidesEnabled && isOwner ? "visible" : "excluded"); - }); editBtn.addListener("execute", () => { this.fireEvent("slidesEdit"); }, this); @@ -225,6 +231,15 @@ qx.Class.define("osparc.component.widget.NodesTree", { return tree; }, + __populateToolbar: function() { + this.self().areSlidesEnabled() + .then(areSlidesEnabled => { + const study = this.getStudy(); + const isOwner = osparc.data.model.Study.isOwner(study); + this.__editSlidesBtn.setVisibility(areSlidesEnabled && isOwner ? "visible" : "excluded"); + }); + }, + populateTree: function() { const study = osparc.store.Store.getInstance().getCurrentStudy(); const topLevelNodes = study.getWorkbench().getNodes(); diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index 1e3d81ccf1b..ccc0ac054b1 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -329,7 +329,8 @@ qx.Class.define("osparc.desktop.WorkbenchView", { __initViews: function() { const study = this.getStudy(); - const nodesTree = this.__nodesTree = new osparc.component.widget.NodesTree(study); + const nodesTree = this.__nodesTree = new osparc.component.widget.NodesTree(); + nodesTree.setStudy(study); nodesTree.addListener("slidesEdit", () => { this.__editSlides(); }, this); @@ -341,7 +342,8 @@ qx.Class.define("osparc.desktop.WorkbenchView", { flex: 1 }); - const extraView = this.__extraView = new osparc.component.metadata.StudyInfo(study); + const extraView = this.__extraView = new osparc.component.metadata.StudyInfo(); + extraView.setStudy(study); this.__sidePanel.addOrReplaceAt(new osparc.desktop.PanelView(this.tr("Study information"), extraView), 1, { flex: 1 }); From b1ea51b1ccb80e63aa86e7117ea203af60766a0a Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 16 Oct 2020 20:29:16 +0200 Subject: [PATCH 093/110] state missing from projects --- .../models-library/src/models_library/projects.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/models-library/src/models_library/projects.py b/packages/models-library/src/models_library/projects.py index 0902b14b99e..0dca50c054c 100644 --- a/packages/models-library/src/models_library/projects.py +++ b/packages/models-library/src/models_library/projects.py @@ -138,10 +138,7 @@ class Node(BaseModel): ..., description="The short name of the node", example=["JupyterLab"] ) progress: Optional[float] = Field( - None, - ge=0, - le=100, - description="the node progress value" + None, ge=0, le=100, description="the node progress value" ) thumbnail: Optional[HttpUrl] = Field( None, @@ -177,6 +174,12 @@ class Node(BaseModel): position: Optional[Position] = Field(None, deprecated=True) + state: Optional[RunningState] = Field( + RunningState.NOT_STARTED, + description="the node's running state", + example=["RUNNING", "FAILURE"], + ) + class Config: extra = Extra.forbid @@ -269,6 +272,7 @@ class Project(BaseModel): dev: Optional[Dict] = Field( None, description="object used for development purposes only" ) + state: Optional[ProjectState] = Field(None, description="Project state") class Config: description = "Description of a simcore project" From 7b28478c9e68f3262ef467c49eddf7222b8b6051 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 19 Oct 2020 11:00:30 +0200 Subject: [PATCH 094/110] add more info to "startStudy" Event --- .../client/source/class/osparc/dashboard/ExploreBrowser.js | 5 ++++- .../web/client/source/class/osparc/dashboard/StudyBrowser.js | 5 ++++- services/web/client/source/class/osparc/desktop/MainPage.js | 5 ++++- .../web/client/source/class/osparc/desktop/WorkbenchView.js | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/services/web/client/source/class/osparc/dashboard/ExploreBrowser.js b/services/web/client/source/class/osparc/dashboard/ExploreBrowser.js index 1e1d7d0cf8d..59b156de946 100644 --- a/services/web/client/source/class/osparc/dashboard/ExploreBrowser.js +++ b/services/web/client/source/class/osparc/dashboard/ExploreBrowser.js @@ -339,7 +339,10 @@ qx.Class.define("osparc.dashboard.ExploreBrowser", { return; } - this.fireDataEvent("startStudy", studyId); + const data = { + studyId: studyId + }; + this.fireDataEvent("startStudy", data); }, __resetTemplateItem: function(templateData) { diff --git a/services/web/client/source/class/osparc/dashboard/StudyBrowser.js b/services/web/client/source/class/osparc/dashboard/StudyBrowser.js index 053faf5d7ba..ed726fc5a07 100644 --- a/services/web/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/web/client/source/class/osparc/dashboard/StudyBrowser.js @@ -328,7 +328,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __startStudy: function(studyId) { - this.fireDataEvent("startStudy", studyId); + const data = { + studyId: studyId + }; + this.fireDataEvent("startStudy", data); }, __resetStudyItem: function(studyData) { diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 6af6d462062..5fcd5b1e4ae 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -156,7 +156,10 @@ qx.Class.define("osparc.desktop.MainPage", { exploreBrowser ].forEach(browser => { browser.addListener("startStudy", e => { - const studyId = e.getData(); + const { + studyId, + mode + } = e.getData(); this.__startStudy(studyId); }, this); }); diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index ccc0ac054b1..946a24e69c1 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -146,7 +146,10 @@ qx.Class.define("osparc.desktop.WorkbenchView", { osparc.data.Resources.getOne("studies", params) .then(studyData => { study.removeIFrames(); - this.fireDataEvent("startStudy", studyData.uuid); + const data = { + studyId: studyData.uuid + }; + this.fireDataEvent("startStudy", data); }); }); }, From 355472468e15bc86513cfb22d260d40e79853490 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 19 Oct 2020 11:06:47 +0200 Subject: [PATCH 095/110] minor --- .../source/class/osparc/desktop/MainPage.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 5fcd5b1e4ae..3ead60be409 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -156,11 +156,8 @@ qx.Class.define("osparc.desktop.MainPage", { exploreBrowser ].forEach(browser => { browser.addListener("startStudy", e => { - const { - studyId, - mode - } = e.getData(); - this.__startStudy(studyId); + const startStudyData = e.getData(); + this.__startStudy(startStudyData); }, this); }); @@ -200,7 +197,11 @@ qx.Class.define("osparc.desktop.MainPage", { this.__mainStack.setSelection([this.__studyEditor]); }, - __startStudy: function(studyId) { + __startStudy: function(startStudyData) { + const { + studyId, + mode + } = startStudyData; this.__showLoadingPage(this.tr("Loading Study")); const params = { @@ -266,8 +267,8 @@ qx.Class.define("osparc.desktop.MainPage", { __getStudyEditor: function() { const studyEditor = this.__studyEditor || new osparc.desktop.StudyEditor(); studyEditor.addListenerOnce("startStudy", e => { - const studyId = e.getData(); - this.__startStudy(studyId); + const startStudyData = e.getData(); + this.__startStudy(startStudyData); }, this); return studyEditor; } From 457d4509c9bb8c3535ee23aca537a579c56a1d98 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 19 Oct 2020 11:17:27 +0200 Subject: [PATCH 096/110] Allow starting in slideshow mode --- .../class/osparc/dashboard/StudyBrowser.js | 18 ++++++++++++++++-- .../source/class/osparc/data/model/Study.js | 7 +++++++ .../source/class/osparc/desktop/MainPage.js | 14 +++++++++----- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/services/web/client/source/class/osparc/dashboard/StudyBrowser.js b/services/web/client/source/class/osparc/dashboard/StudyBrowser.js index ed726fc5a07..b9b158e24e4 100644 --- a/services/web/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/web/client/source/class/osparc/dashboard/StudyBrowser.js @@ -327,9 +327,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }); }, - __startStudy: function(studyId) { + __startStudy: function(studyId, pageContext) { const data = { - studyId: studyId + studyId, + pageContext }; this.fireDataEvent("startStudy", data); }, @@ -446,6 +447,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { menu.add(saveAsTemplateButton); } + if (osparc.data.model.Study.hasSlideshow(studyData)) { + const startAsSlideshowButton = this.__getStartAsSlideshowButton(studyData); + menu.add(startAsSlideshowButton); + } + const deleteButton = this.__getDeleteStudyMenuButton(studyData, false); if (deleteButton) { menu.addSeparator(); @@ -536,6 +542,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { return saveAsTemplateButton; }, + __getStartAsSlideshowButton: function(studyData) { + const saveAsTemplateButton = new qx.ui.menu.Button(this.tr("Start slideshow")); + saveAsTemplateButton.addListener("execute", () => { + this.__startStudy(studyData["uuid"], "slideshow"); + }, this); + return saveAsTemplateButton; + }, + __getDeleteStudyMenuButton: function(studyData) { const deleteButton = new qx.ui.menu.Button(this.tr("Delete")); osparc.utils.Utils.setIdToWidget(deleteButton, "studyItemMenuDelete"); diff --git a/services/web/client/source/class/osparc/data/model/Study.js b/services/web/client/source/class/osparc/data/model/Study.js index 3b98b862942..f5558f4f339 100644 --- a/services/web/client/source/class/osparc/data/model/Study.js +++ b/services/web/client/source/class/osparc/data/model/Study.js @@ -207,6 +207,13 @@ qx.Class.define("osparc.data.model.Study", { return aceessRights[myGid]["delete"]; } return false; + }, + + hasSlideshow: function(studyData) { + if ("ui" in studyData && "slideshow" in studyData["ui"] && Object.keys(studyData["ui"]["slideshow"]).length) { + return true; + } + return false; } }, diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 3ead60be409..dc47d83449d 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -200,7 +200,7 @@ qx.Class.define("osparc.desktop.MainPage", { __startStudy: function(startStudyData) { const { studyId, - mode + pageContext } = startStudyData; this.__showLoadingPage(this.tr("Loading Study")); @@ -236,7 +236,7 @@ qx.Class.define("osparc.desktop.MainPage", { this.__showStudyEditor(this.__getStudyEditor()); this.__studyEditor.setStudyData(latestStudyData) .then(() => { - this.__syncStudyEditor(); + this.__syncStudyEditor(pageContext); }); }) .catch(err => { @@ -252,12 +252,16 @@ qx.Class.define("osparc.desktop.MainPage", { }); }, - __syncStudyEditor: function() { + __syncStudyEditor: function(pageContext) { const studyEditor = this.__studyEditor; const study = studyEditor.getStudy(); this.__navBar.setStudy(study); - this.__navBar.setPageContext("workbench"); - studyEditor.setPageContext("workbench"); + if (pageContext === "slideshow") { + this.__navBar.setPageContext("slides"); + studyEditor.setPageContext("slides"); + } else { + this.__navBar.setPageContext("workbench"); + } this.__studyEditor.addListener("studyIsLocked", () => { this.__showDashboard(); From 371a6a6b1366f2d36e9cdfd870079058757eec0d Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 19 Oct 2020 11:21:38 +0200 Subject: [PATCH 097/110] "slides" -> "slideshow" --- .../client/source/class/osparc/desktop/MainPage.js | 4 ++-- .../source/class/osparc/desktop/NavigationBar.js | 12 ++++++------ .../source/class/osparc/desktop/StudyEditor.js | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index dc47d83449d..b8d671c63f8 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -257,8 +257,8 @@ qx.Class.define("osparc.desktop.MainPage", { const study = studyEditor.getStudy(); this.__navBar.setStudy(study); if (pageContext === "slideshow") { - this.__navBar.setPageContext("slides"); - studyEditor.setPageContext("slides"); + this.__navBar.setPageContext("slideshow"); + studyEditor.setPageContext("slideshow"); } else { this.__navBar.setPageContext("workbench"); } diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index b8070019fcf..4d5c15d0e77 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -76,7 +76,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { }, pageContext: { - check: ["dashboard", "workbench", "slides"], + check: ["dashboard", "workbench", "slideshow"], nullable: false, apply: "_applyPageContext" } @@ -93,7 +93,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { PAGE_CONTEXT: { 0: "dashboard", 1: "workbench", - 2: "slides" + 2: "slideshow" }, areSlidesEnabled: function() { @@ -378,7 +378,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { this.__setSlidesBtnsVis(false); this.__populateWorkbenchNodesLayout(); break; - case "slides": + case "slideshow": this.__dashboardLabel.exclude(); this.__dashboardBtn.show(); this.__resetSlideBtnsVis(true); @@ -392,12 +392,12 @@ qx.Class.define("osparc.desktop.NavigationBar", { __resetSlideBtnsVis: function() { this.self().areSlidesEnabled() .then(areSlidesEnabled => { - const context = ["workbench", "slides"].includes(this.getPageContext()); + const context = ["workbench", "slideshow"].includes(this.getPageContext()); if (areSlidesEnabled && context) { const study = this.getStudy(); if (Object.keys(study.getUi().getSlideshow()).length) { this.__slideBtns.show(); - if (this.getPageContext() === "slides") { + if (this.getPageContext() === "slideshow") { this.__startSlidesBtn.exclude(); this.__stopSlidesBtn.show(); } else if (this.getPageContext() === "workbench") { @@ -629,7 +629,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { study.getUi().addListener("changeCurrentNodeId", () => { if (this.getPageContext() === "workbench") { this.__populateWorkbenchNodesLayout(); - } else if (this.getPageContext() === "slides") { + } else if (this.getPageContext() === "slideshow") { this.__populateGuidedNodesLayout(); } }); diff --git a/services/web/client/source/class/osparc/desktop/StudyEditor.js b/services/web/client/source/class/osparc/desktop/StudyEditor.js index 3d4c69b37a4..7f03c5fdb13 100644 --- a/services/web/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/web/client/source/class/osparc/desktop/StudyEditor.js @@ -50,7 +50,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, pageContext: { - check: ["workbench", "slides"], + check: ["workbench", "slideshow"], nullable: false, apply: "_applyPageContext" } @@ -154,7 +154,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { case "workbench": this.__viewsStack.setSelection([this.__workbenchView]); break; - case "slides": + case "slideshow": this.__viewsStack.setSelection([this.__slideshowView]); this.__slideshowView.startSlides(); break; From bfefaefa29820ba8663f52ec6735a70cb8d29849 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 19 Oct 2020 11:22:42 +0200 Subject: [PATCH 098/110] minor --- .../web/client/source/class/osparc/desktop/NavigationBar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 4d5c15d0e77..f0d8b46d67e 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -130,7 +130,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { this._add(new qx.ui.core.Spacer(20)); - this.__slideBtns = this.getChildControl("slide-buttons").set({ + this.__slideBtns = this.getChildControl("slideshow-buttons").set({ visibility: "excluded" }); @@ -193,7 +193,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { }); this._add(control); break; - case "slide-buttons": + case "slideshow-buttons": control = this.__createSlideBtns(); this._add(control); break; From b0bc06eccb24f2a2023910b34c1a54955120c310 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 19 Oct 2020 13:08:51 +0200 Subject: [PATCH 099/110] ui field added to fixture projects --- api/tests/test_repo_data.py | 1 + services/web/server/tests/data/fake-project.json | 1 + services/web/server/tests/unit/with_dbs/slow/test_projects.py | 1 + 3 files changed, 3 insertions(+) diff --git a/api/tests/test_repo_data.py b/api/tests/test_repo_data.py index d9ee135c681..e61396185a9 100644 --- a/api/tests/test_repo_data.py +++ b/api/tests/test_repo_data.py @@ -86,6 +86,7 @@ def test_project_against_schema(data_path, project_schema, this_repo_root_dir): "thumbnail": "labore incid", "accessRights": {}, "workbench": data["workbench"], + "ui": {}, "dev": {}, } data = prj diff --git a/services/web/server/tests/data/fake-project.json b/services/web/server/tests/data/fake-project.json index 579d9d92652..8f09604bd9a 100644 --- a/services/web/server/tests/data/fake-project.json +++ b/services/web/server/tests/data/fake-project.json @@ -71,5 +71,6 @@ "thumbnail": "" } }, + "ui": {}, "dev": {} } diff --git a/services/web/server/tests/unit/with_dbs/slow/test_projects.py b/services/web/server/tests/unit/with_dbs/slow/test_projects.py index 430d722bb88..4a31eb712e6 100644 --- a/services/web/server/tests/unit/with_dbs/slow/test_projects.py +++ b/services/web/server/tests/unit/with_dbs/slow/test_projects.py @@ -388,6 +388,7 @@ async def _new_project( "workbench": {}, "tags": [], "classifiers": [], + "ui": {}, "dev": {}, } if project: From ccbfd6c40d1c4f1a95ff4edd661e72aed8018316 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 19 Oct 2020 13:33:43 +0200 Subject: [PATCH 100/110] Update sleepers_project_template_sql.csv --- tests/e2e/tutorials/sleepers_project_template_sql.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/tutorials/sleepers_project_template_sql.csv b/tests/e2e/tutorials/sleepers_project_template_sql.csv index 0ced37c3044..42a1216a611 100644 --- a/tests/e2e/tutorials/sleepers_project_template_sql.csv +++ b/tests/e2e/tutorials/sleepers_project_template_sql.csv @@ -1,2 +1,2 @@ -id,type,uuid,name,description,thumbnail,prj_owner,creation_date,last_change_date,workbench,published,access_rights,dev,classifiers -10,TEMPLATE,template-uuid-5203-915e-1ae8ae0c9991,Sleepers,5 sleepers interconnected,"",,2019-06-06 14:34:19.631,2019-06-06 14:34:28.647,"{""template-uuid-5f7e-92b0-5a14e84401e9"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 0"", ""inputs"": {""in_2"": 2}, ""inputAccess"": {""in_1"": ""Invisible"", ""in_2"": ""ReadOnly""}, ""inputNodes"": [], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 50, ""y"": 300}}, ""template-uuid-5d8a-812c-44dacf56840e"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 1"", ""inputs"": {""in_1"": {""nodeUuid"": ""template-uuid-5f7e-92b0-5a14e84401e9"", ""output"": ""out_1""}, ""in_2"": 2}, ""inputNodes"": [""template-uuid-5f7e-92b0-5a14e84401e9""], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 300, ""y"": 200}}, ""template-uuid-5706-b741-4073a4454f0d"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 2"", ""inputs"": {""in_1"": {""nodeUuid"": ""template-uuid-5d8a-812c-44dacf56840e"", ""output"": ""out_1""}, ""in_2"": {""nodeUuid"": ""template-uuid-5d8a-812c-44dacf56840e"", ""output"": ""out_2""}}, ""inputNodes"": [""template-uuid-5d8a-812c-44dacf56840e""], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 550, ""y"": 200}}, ""template-uuid-5065-a079-a5a0476e3c10"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 3"", ""inputs"": {""in_2"": {""nodeUuid"": ""template-uuid-5f7e-92b0-5a14e84401e9"", ""output"": ""out_2""}}, ""inputNodes"": [""template-uuid-5f7e-92b0-5a14e84401e9""], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 420, ""y"": 400}}, ""template-uuid-559d-aa19-dc9293e10e4c"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 4"", ""inputs"": {""in_1"": {""nodeUuid"": ""template-uuid-5706-b741-4073a4454f0d"", ""output"": ""out_1""}, ""in_2"": {""nodeUuid"": ""template-uuid-5065-a079-a5a0476e3c10"", ""output"": ""out_2""}}, ""inputNodes"": [""template-uuid-5706-b741-4073a4454f0d"", ""template-uuid-5065-a079-a5a0476e3c10""], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 800, ""y"": 300}}}",true,"{""1"": {""read"":true, ""write"":false, ""delete"":false}}", "{}", "{}" +id,type,uuid,name,description,thumbnail,prj_owner,creation_date,last_change_date,workbench,published,access_rights,dev,ui,classifiers +10,TEMPLATE,template-uuid-5203-915e-1ae8ae0c9991,Sleepers,5 sleepers interconnected,"",,2019-06-06 14:34:19.631,2019-06-06 14:34:28.647,"{""template-uuid-5f7e-92b0-5a14e84401e9"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 0"", ""inputs"": {""in_2"": 2}, ""inputAccess"": {""in_1"": ""Invisible"", ""in_2"": ""ReadOnly""}, ""inputNodes"": [], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 50, ""y"": 300}}, ""template-uuid-5d8a-812c-44dacf56840e"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 1"", ""inputs"": {""in_1"": {""nodeUuid"": ""template-uuid-5f7e-92b0-5a14e84401e9"", ""output"": ""out_1""}, ""in_2"": 2}, ""inputNodes"": [""template-uuid-5f7e-92b0-5a14e84401e9""], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 300, ""y"": 200}}, ""template-uuid-5706-b741-4073a4454f0d"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 2"", ""inputs"": {""in_1"": {""nodeUuid"": ""template-uuid-5d8a-812c-44dacf56840e"", ""output"": ""out_1""}, ""in_2"": {""nodeUuid"": ""template-uuid-5d8a-812c-44dacf56840e"", ""output"": ""out_2""}}, ""inputNodes"": [""template-uuid-5d8a-812c-44dacf56840e""], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 550, ""y"": 200}}, ""template-uuid-5065-a079-a5a0476e3c10"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 3"", ""inputs"": {""in_2"": {""nodeUuid"": ""template-uuid-5f7e-92b0-5a14e84401e9"", ""output"": ""out_2""}}, ""inputNodes"": [""template-uuid-5f7e-92b0-5a14e84401e9""], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 420, ""y"": 400}}, ""template-uuid-559d-aa19-dc9293e10e4c"": {""key"": ""simcore/services/comp/itis/sleeper"", ""version"": ""1.0.0"", ""label"": ""sleeper 4"", ""inputs"": {""in_1"": {""nodeUuid"": ""template-uuid-5706-b741-4073a4454f0d"", ""output"": ""out_1""}, ""in_2"": {""nodeUuid"": ""template-uuid-5065-a079-a5a0476e3c10"", ""output"": ""out_2""}}, ""inputNodes"": [""template-uuid-5706-b741-4073a4454f0d"", ""template-uuid-5065-a079-a5a0476e3c10""], ""outputs"": {}, ""progress"": 0, ""thumbnail"": """", ""position"": {""x"": 800, ""y"": 300}}}",true,"{""1"": {""read"":true, ""write"":false, ""delete"":false}}", "{}", "{}", "{}" From 47648719b422e84a76b222c5d89c178de6809e7f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 20 Oct 2020 11:04:05 +0200 Subject: [PATCH 101/110] Visuals --- .../osparc/component/widget/NodeSlideTreeItem.js | 12 +++++++++--- .../class/osparc/component/widget/NodesTree.js | 2 +- .../source/class/osparc/dashboard/StudyBrowser.js | 2 +- .../source/class/osparc/desktop/NavigationBar.js | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js index 996ca13dda1..99a633b1d2d 100644 --- a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js +++ b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js @@ -65,7 +65,9 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { flex: 1 }); - const posLbl = new qx.ui.basic.Label(); + const posLbl = new qx.ui.basic.Label().set({ + marginRight: 5 + }); this.bind("position", posLbl, "value", { converter: val => { if (val === null) { @@ -79,7 +81,9 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { }); this.addWidget(posLbl); - const hideBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye-slash/10"); + const hideBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye-slash/10").set({ + marginRight: 5 + }); hideBtn.addListener("execute", () => { this.fireEvent("showNode"); }, this); @@ -96,7 +100,9 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { }); this.addWidget(hideBtn); - const showBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye/10"); + const showBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye/10").set({ + marginRight: 5 + }); showBtn.addListener("execute", () => { this.fireEvent("hideNode"); }, this); 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 bb454647a9d..014b650afd6 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesTree.js @@ -144,7 +144,7 @@ qx.Class.define("osparc.component.widget.NodesTree", { const iconSize = 14; const toolbar = this.__toolBar = new qx.ui.toolbar.ToolBar(); - const editBtn = this.__editSlidesBtn = new qx.ui.toolbar.Button(this.tr("Slides"), "@FontAwesome5Solid/paw/"+iconSize).set({ + const editBtn = this.__editSlidesBtn = new qx.ui.toolbar.Button(this.tr("Edit Guided mode"), "@FontAwesome5Solid/caret-square-right/"+iconSize).set({ visibility: "excluded" }); editBtn.addListener("execute", () => { diff --git a/services/web/client/source/class/osparc/dashboard/StudyBrowser.js b/services/web/client/source/class/osparc/dashboard/StudyBrowser.js index b9b158e24e4..ff10d7692c0 100644 --- a/services/web/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/web/client/source/class/osparc/dashboard/StudyBrowser.js @@ -543,7 +543,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __getStartAsSlideshowButton: function(studyData) { - const saveAsTemplateButton = new qx.ui.menu.Button(this.tr("Start slideshow")); + const saveAsTemplateButton = new qx.ui.menu.Button(this.tr("Start Guided mode")); saveAsTemplateButton.addListener("execute", () => { this.__startStudy(studyData["uuid"], "slideshow"); }, this); diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index f0d8b46d67e..d9e5be6eddd 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -179,7 +179,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { break; } case "dashboard-button": - control = new osparc.ui.form.FetchButton(this.tr("Dashboard"), "@FontAwesome5Solid/arrow-left/14"); + control = new osparc.ui.form.FetchButton(this.tr("Dashboard"), "@FontAwesome5Solid/arrow-left/16"); osparc.utils.Utils.setIdToWidget(control, "dashboardBtn"); control.set(this.self().BUTTON_OPTIONS); control.addListener("execute", () => { @@ -432,13 +432,13 @@ qx.Class.define("osparc.desktop.NavigationBar", { __createSlideBtns: function() { const menu = new qx.ui.toolbar.Part(); - const startBtn = this.__startSlidesBtn = new qx.ui.toolbar.Button(this.tr("Start slides")); + const startBtn = this.__startSlidesBtn = new qx.ui.toolbar.Button(this.tr("Start Guided mode"), "@FontAwesome5Solid/caret-square-right/18"); startBtn.addListener("execute", () => { this.fireEvent("slidesStart"); }, this); menu.add(startBtn); - const stopBtn = this.__stopSlidesBtn = new qx.ui.toolbar.Button(this.tr("Stop slides")); + const stopBtn = this.__stopSlidesBtn = new qx.ui.toolbar.Button(this.tr("Stop Guided mode"), "@FontAwesome5Solid/stop/18"); stopBtn.addListener("execute", () => { this.fireEvent("slidesStop"); }, this); From 7eded826b3d06e0a9dacceb4144540b2428ab79f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 20 Oct 2020 11:12:38 +0200 Subject: [PATCH 102/110] start in workbench mode by default --- services/web/client/source/class/osparc/desktop/MainPage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index b8d671c63f8..556d8644770 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -261,6 +261,7 @@ qx.Class.define("osparc.desktop.MainPage", { studyEditor.setPageContext("slideshow"); } else { this.__navBar.setPageContext("workbench"); + studyEditor.setPageContext("workbench"); } this.__studyEditor.addListener("studyIsLocked", () => { From 4ac71510eb5deef44a2db33a649371e005d99baf Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 20 Oct 2020 12:12:40 +0200 Subject: [PATCH 103/110] more uniform buttons --- .../web/client/source/class/osparc/desktop/NavigationBar.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index d9e5be6eddd..97dcae652cb 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -432,13 +432,15 @@ qx.Class.define("osparc.desktop.NavigationBar", { __createSlideBtns: function() { const menu = new qx.ui.toolbar.Part(); - const startBtn = this.__startSlidesBtn = new qx.ui.toolbar.Button(this.tr("Start Guided mode"), "@FontAwesome5Solid/caret-square-right/18"); + const startBtn = this.__startSlidesBtn = new qx.ui.toolbar.Button(this.tr("Start Guided mode"), "@FontAwesome5Solid/caret-square-right/16"); + startBtn.set(this.self().BUTTON_OPTIONS); startBtn.addListener("execute", () => { this.fireEvent("slidesStart"); }, this); menu.add(startBtn); - const stopBtn = this.__stopSlidesBtn = new qx.ui.toolbar.Button(this.tr("Stop Guided mode"), "@FontAwesome5Solid/stop/18"); + const stopBtn = this.__stopSlidesBtn = new qx.ui.toolbar.Button(this.tr("Stop Guided mode"), "@FontAwesome5Solid/stop/16"); + stopBtn.set(this.self().BUTTON_OPTIONS); stopBtn.addListener("execute", () => { this.fireEvent("slidesStop"); }, this); From 3840575af1956599a5c4a83ade351b0e8ab916f3 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 20 Oct 2020 12:25:47 +0200 Subject: [PATCH 104/110] maxWidth + tooltip for Navigation buttons --- .../class/osparc/desktop/NavigationBar.js | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 97dcae652cb..dfa987911d6 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -84,7 +84,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { statics: { BUTTON_OPTIONS: { - font: "title-14", + font: "text-14", allowGrowY: false, minWidth: 32, minHeight: 32 @@ -179,9 +179,11 @@ qx.Class.define("osparc.desktop.NavigationBar", { break; } case "dashboard-button": - control = new osparc.ui.form.FetchButton(this.tr("Dashboard"), "@FontAwesome5Solid/arrow-left/16"); + control = new osparc.ui.form.FetchButton(this.tr("Dashboard"), "@FontAwesome5Solid/arrow-left/16").set({ + ...this.self().BUTTON_OPTIONS, + font: "title-14" + }); osparc.utils.Utils.setIdToWidget(control, "dashboardBtn"); - control.set(this.self().BUTTON_OPTIONS); control.addListener("execute", () => { this.fireEvent("dashboardPressed"); }, this); @@ -220,18 +222,12 @@ qx.Class.define("osparc.desktop.NavigationBar", { break; case "manual": control = this.__createManualMenuBtn(); - control.set({ - ...this.self().BUTTON_OPTIONS, - font: "text-14" - }); + control.set(this.self().BUTTON_OPTIONS); this._add(control); break; case "feedback": control = this.__createFeedbackMenuBtn(); - control.set({ - ...this.self().BUTTON_OPTIONS, - font: "text-14" - }); + control.set(this.self().BUTTON_OPTIONS); this._add(control); break; case "theme-switch": @@ -242,10 +238,7 @@ qx.Class.define("osparc.desktop.NavigationBar", { break; case "user-menu": control = this.__createUserMenuBtn(); - control.set({ - ...this.self().BUTTON_OPTIONS, - font: "text-14" - }); + control.set(this.self().BUTTON_OPTIONS); this._add(control); break; } @@ -258,16 +251,21 @@ qx.Class.define("osparc.desktop.NavigationBar", { __createNodePathBtn: function(nodeId) { const study = osparc.store.Store.getInstance().getCurrentStudy(); - const btn = new qx.ui.form.Button().set(this.self().BUTTON_OPTIONS); + const btn = new qx.ui.form.Button().set({ + ...this.self().BUTTON_OPTIONS, + maxWidth: 200 + }); if (nodeId === study.getUuid()) { study.bind("name", btn, "label"); + study.bind("name", btn, "toolTipText"); } else { const node = study.getWorkbench().getNode(nodeId); if (node) { node.bind("label", btn, "label"); + node.bind("label", btn, "toolTipText"); } } - btn.addListener("execute", function() { + btn.addListener("execute", () => { this.fireDataEvent("nodeSelected", nodeId); }, this); return btn; @@ -275,14 +273,18 @@ qx.Class.define("osparc.desktop.NavigationBar", { __createNodeSlideBtn: function(nodeId, pos) { const study = osparc.store.Store.getInstance().getCurrentStudy(); - const btn = new qx.ui.toolbar.RadioButton().set(this.self().BUTTON_OPTIONS); + const btn = new qx.ui.toolbar.RadioButton().set({ + ...this.self().BUTTON_OPTIONS, + maxWidth: 200 + }); const node = study.getWorkbench().getNode(nodeId); if (node) { node.bind("label", btn, "label", { converter: val => (pos+1).toString() + " - " + val }); + node.bind("label", btn, "toolTipText"); } - btn.addListener("execute", function() { + btn.addListener("execute", () => { this.fireDataEvent("nodeSelected", nodeId); }, this); return btn; From ed6eab7d72048bbb45193ada35cf1e54f9b1ac52 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 20 Oct 2020 13:15:22 +0200 Subject: [PATCH 105/110] cropping node labels --- .../source/class/osparc/component/widget/NodeSlideTreeItem.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js index 99a633b1d2d..b21acbb61b0 100644 --- a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js +++ b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js @@ -60,6 +60,10 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { this.addOpenButton(); this.addIcon(); this.addLabel(); + const label = this.getChildControl("label"); + if (label) { + label.setMaxWidth(150); + } this.addWidget(new qx.ui.core.Spacer(), { flex: 1 From f7fa881b5f823241f2aa4ffba562038991533fde Mon Sep 17 00:00:00 2001 From: Ignacio Pascual <4764217+ignapas@users.noreply.github.com> Date: Tue, 20 Oct 2020 13:16:30 +0200 Subject: [PATCH 106/110] Added visuals --- .../component/widget/NodeSlideTreeItem.js | 14 ++++++++++---- .../osparc/component/widget/NodesSlidesTree.js | 9 ++++++--- .../source/class/osparc/desktop/MainPage.js | 2 +- .../source/class/osparc/theme/Appearance.js | 18 +++++++++++++++++- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js index 99a633b1d2d..c8ad91e37ee 100644 --- a/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js +++ b/services/web/client/source/class/osparc/component/widget/NodeSlideTreeItem.js @@ -82,7 +82,8 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { this.addWidget(posLbl); const hideBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye-slash/10").set({ - marginRight: 5 + marginRight: 5, + appearance: "no-shadow-button" }); hideBtn.addListener("execute", () => { this.fireEvent("showNode"); @@ -101,7 +102,8 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { this.addWidget(hideBtn); const showBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/eye/10").set({ - marginRight: 5 + marginRight: 5, + appearance: "no-shadow-button" }); showBtn.addListener("execute", () => { this.fireEvent("hideNode"); @@ -119,7 +121,9 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { }); this.addWidget(showBtn); - const moveUpBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/arrow-up/10"); + const moveUpBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/arrow-up/10").set({ + appearance: "no-shadow-button" + }); moveUpBtn.addListener("execute", () => { this.fireEvent("moveUp"); }, this); @@ -133,7 +137,9 @@ qx.Class.define("osparc.component.widget.NodeSlideTreeItem", { }); this.addWidget(moveUpBtn); - const moveDownBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/arrow-down/10"); + const moveDownBtn = new qx.ui.form.Button(null, "@FontAwesome5Solid/arrow-down/10").set({ + appearance: "no-shadow-button" + }); moveDownBtn.addListener("execute", () => { this.fireEvent("moveDown"); }, this); diff --git a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js index e45d1e7ae62..6dc57363ed1 100644 --- a/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js +++ b/services/web/client/source/class/osparc/component/widget/NodesSlidesTree.js @@ -95,7 +95,8 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { break; case "disable": { control = new qx.ui.form.Button(this.tr("Disable")).set({ - allowGrowX: false + allowGrowX: false, + appearance: "no-shadow-button" }); const buttons = this.getChildControl("buttons"); buttons.add(control); @@ -103,7 +104,8 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { } case "enable": { control = new qx.ui.form.Button(this.tr("Enable")).set({ - allowGrowX: false + allowGrowX: false, + appearance: "no-shadow-button" }); const buttons = this.getChildControl("buttons"); buttons.add(control); @@ -119,7 +121,8 @@ qx.Class.define("osparc.component.widget.NodesSlidesTree", { decorator: "service-tree", openMode: "none", contentPadding: 0, - padding: 0 + padding: 0, + backgroundColor: "material-button-background" }); return tree; }, diff --git a/services/web/client/source/class/osparc/desktop/MainPage.js b/services/web/client/source/class/osparc/desktop/MainPage.js index 556d8644770..9410d71bad6 100644 --- a/services/web/client/source/class/osparc/desktop/MainPage.js +++ b/services/web/client/source/class/osparc/desktop/MainPage.js @@ -222,7 +222,7 @@ qx.Class.define("osparc.desktop.MainPage", { } if (locked) { - const msg = this.tr("Study is opened"); + const msg = this.tr("Study is already open"); throw new Error(msg); } const store = osparc.store.Store.getInstance(); diff --git a/services/web/client/source/class/osparc/theme/Appearance.js b/services/web/client/source/class/osparc/theme/Appearance.js index 4146d1aa675..8e8fa5414fa 100644 --- a/services/web/client/source/class/osparc/theme/Appearance.js +++ b/services/web/client/source/class/osparc/theme/Appearance.js @@ -630,6 +630,22 @@ qx.Theme.define("osparc.theme.Appearance", { style: state => ({ font: "text-14" }) - } + }, + + "no-shadow-button": { + alias: "atom", + style: function(states) { + var decorator = "toolbar-button"; + if (states.hovered || states.pressed || states.checked) { + decorator += "-hovered"; + } + return { + cursor: states.disabled ? undefined : "pointer", + decorator: decorator, + textColor: "material-button-text", + padding: [3, 5] + }; + } + }, } }); From 7adbedecf28c9a3df375b8860ecf16f70b90de1e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 20 Oct 2020 13:30:30 +0200 Subject: [PATCH 107/110] clean up --- .../class/osparc/desktop/NavigationBar.js | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index dfa987911d6..83932b02b2d 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -113,7 +113,6 @@ qx.Class.define("osparc.desktop.NavigationBar", { members: { __dashboardBtn: null, __dashboardLabel: null, - __slideBtns: null, __startSlidesBtn: null, __stopSlidesBtn: null, __studyTitle: null, @@ -130,7 +129,10 @@ qx.Class.define("osparc.desktop.NavigationBar", { this._add(new qx.ui.core.Spacer(20)); - this.__slideBtns = this.getChildControl("slideshow-buttons").set({ + this.__startSlidesBtn = this.getChildControl("slideshow-start").set({ + visibility: "excluded" + }); + this.__stopSlidesBtn = this.getChildControl("slideshow-stop").set({ visibility: "excluded" }); @@ -195,8 +197,12 @@ qx.Class.define("osparc.desktop.NavigationBar", { }); this._add(control); break; - case "slideshow-buttons": - control = this.__createSlideBtns(); + case "slideshow-start": + control = this.__createSlideStartBtn(); + this._add(control); + break; + case "slideshow-stop": + control = this.__createSlideStopBtn(); this._add(control); break; case "study-title": @@ -398,7 +404,6 @@ qx.Class.define("osparc.desktop.NavigationBar", { if (areSlidesEnabled && context) { const study = this.getStudy(); if (Object.keys(study.getUi().getSlideshow()).length) { - this.__slideBtns.show(); if (this.getPageContext() === "slideshow") { this.__startSlidesBtn.exclude(); this.__stopSlidesBtn.show(); @@ -409,7 +414,6 @@ qx.Class.define("osparc.desktop.NavigationBar", { return; } } - this.__slideBtns.exclude(); }); }, @@ -431,24 +435,24 @@ qx.Class.define("osparc.desktop.NavigationBar", { } }, - __createSlideBtns: function() { - const menu = new qx.ui.toolbar.Part(); - - const startBtn = this.__startSlidesBtn = new qx.ui.toolbar.Button(this.tr("Start Guided mode"), "@FontAwesome5Solid/caret-square-right/16"); - startBtn.set(this.self().BUTTON_OPTIONS); + __createSlideStartBtn: function() { + const startBtn = new qx.ui.form.Button(this.tr("Start Guided mode"), "@FontAwesome5Solid/caret-square-right/16").set({ + ...this.self().BUTTON_OPTIONS + }); startBtn.addListener("execute", () => { this.fireEvent("slidesStart"); }, this); - menu.add(startBtn); + return startBtn; + }, - const stopBtn = this.__stopSlidesBtn = new qx.ui.toolbar.Button(this.tr("Stop Guided mode"), "@FontAwesome5Solid/stop/16"); - stopBtn.set(this.self().BUTTON_OPTIONS); + __createSlideStopBtn: function() { + const stopBtn = new qx.ui.form.Button(this.tr("Stop Guided mode"), "@FontAwesome5Solid/stop/16").set({ + ...this.self().BUTTON_OPTIONS + }); stopBtn.addListener("execute", () => { this.fireEvent("slidesStop"); }, this); - menu.add(stopBtn); - - return menu; + return stopBtn; }, __createManualMenuBtn: function() { From aa3f568b4d69e911365f1063be7c76e2e3e5a8fc Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 20 Oct 2020 13:50:21 +0200 Subject: [PATCH 108/110] eslint --- services/web/client/source/class/osparc/theme/Appearance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/client/source/class/osparc/theme/Appearance.js b/services/web/client/source/class/osparc/theme/Appearance.js index 8e8fa5414fa..7e7094dd637 100644 --- a/services/web/client/source/class/osparc/theme/Appearance.js +++ b/services/web/client/source/class/osparc/theme/Appearance.js @@ -646,6 +646,6 @@ qx.Theme.define("osparc.theme.Appearance", { padding: [3, 5] }; } - }, + } } }); From 865e09d4db4c6a2129cd8bae1463c48386c364e9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 20 Oct 2020 14:45:23 +0200 Subject: [PATCH 109/110] crop label also in NodeTree --- .../source/class/osparc/component/widget/NodeTreeItem.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/web/client/source/class/osparc/component/widget/NodeTreeItem.js b/services/web/client/source/class/osparc/component/widget/NodeTreeItem.js index 5dd1cba6715..f4d4101fbd6 100644 --- a/services/web/client/source/class/osparc/component/widget/NodeTreeItem.js +++ b/services/web/client/source/class/osparc/component/widget/NodeTreeItem.js @@ -59,6 +59,10 @@ qx.Class.define("osparc.component.widget.NodeTreeItem", { // The label this.addLabel(); + const label = this.getChildControl("label"); + if (label) { + label.setMaxWidth(150); + } // All else should be right justified this.addWidget(new qx.ui.core.Spacer(), { From 9bc863287f63b6d6bd6eebd59b6455968f70d2dd Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 20 Oct 2020 14:50:46 +0200 Subject: [PATCH 110/110] Update NavigationBar.js --- .../web/client/source/class/osparc/desktop/NavigationBar.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/web/client/source/class/osparc/desktop/NavigationBar.js b/services/web/client/source/class/osparc/desktop/NavigationBar.js index 83932b02b2d..c7c36e77523 100644 --- a/services/web/client/source/class/osparc/desktop/NavigationBar.js +++ b/services/web/client/source/class/osparc/desktop/NavigationBar.js @@ -414,6 +414,8 @@ qx.Class.define("osparc.desktop.NavigationBar", { return; } } + this.__startSlidesBtn.exclude(); + this.__stopSlidesBtn.exclude(); }); },