From 14b7797c568be558dac4d7bc459df4d32262c240 Mon Sep 17 00:00:00 2001 From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:59:50 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20[Frontend]=20Reopening=20running?= =?UTF-8?q?=20study=20breaks=20the=20connections=20(#6259)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/class/osparc/data/model/Node.js | 52 +++++-------------- .../class/osparc/form/renderer/PropForm.js | 16 +++--- .../osparc/node/slideshow/BaseNodeView.js | 7 --- .../osparc/node/slideshow/FilePickerView.js | 5 -- .../class/osparc/node/slideshow/NodeView.js | 11 ---- 5 files changed, 22 insertions(+), 69 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/Node.js b/services/static-webserver/client/source/class/osparc/data/model/Node.js index 7e152805fb6..a6cf28b8af3 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Node.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Node.js @@ -166,12 +166,6 @@ qx.Class.define("osparc.data.model.Node", { apply: "__applyPropsForm" }, - propsFormEditor: { - check: "osparc.form.renderer.PropFormEditor", - init: null, - nullable: true - }, - marker: { check: "qx.core.Object", init: null, @@ -447,7 +441,6 @@ qx.Class.define("osparc.data.model.Node", { this.setInputs(metadata.inputs); if (Object.keys(metadata.inputs).length) { this.__addSettings(metadata.inputs); - this.__addSettingsAccessLevelEditor(metadata.inputs); } if (this.getPropsForm()) { this.getPropsForm().makeInputsDynamic(); @@ -549,7 +542,17 @@ qx.Class.define("osparc.data.model.Node", { this.getPropsForm().setEnabled(!isPipelineRunning); }; this.getStudy().addListener("changeState", () => checkIsPipelineRunning(), this); - checkIsPipelineRunning(); + + // potentially disabling the inputs form might have side effects if the deserialization is not over + if (this.getWorkbench().isDeserialized()) { + checkIsPipelineRunning(); + } else { + this.getWorkbench().addListener("changeDeserialized", e => { + if (e.getData()) { + checkIsPipelineRunning(); + } + }, this); + } }, /** @@ -609,36 +612,6 @@ qx.Class.define("osparc.data.model.Node", { }, this); }, - __addSettingsAccessLevelEditor: function(inputs) { - const propsForm = this.getPropsForm(); - const form = new osparc.form.Auto(inputs); - form.setData(this.__settingsForm.getData()); - const propsFormEditor = new osparc.form.renderer.PropFormEditor(form, this); - this.__settingsForm.addListener("changeData", e => { - // apply data - const data = this.__settingsForm.getData(); - form.setData(data); - }, this); - propsForm.addListener("linkFieldModified", e => { - const linkFieldModified = e.getData(); - const { - portId, - added - } = linkFieldModified; - if (added) { - const srcControlLink = propsForm.getControlLink(portId); - const controlLink = new qx.ui.form.TextField().set({ - enabled: false - }); - srcControlLink.bind("value", controlLink, "value"); - propsFormEditor.linkAdded(portId, controlLink); - } else { - propsFormEditor.linkRemoved(portId); - } - }, this); - this.setPropsFormEditor(propsFormEditor); - }, - removeNodePortConnections: function(inputNodeId) { let inputs = this.__getInputData(); for (const portId in inputs) { @@ -684,7 +657,7 @@ qx.Class.define("osparc.data.model.Node", { inputData[key] = inputsCopy[key]; } } - this.getPropsForm().addPortLinks(inputLinks); + this.getPropsForm().setInputLinks(inputLinks); this.__settingsForm.setData(inputData); } }, @@ -699,7 +672,6 @@ qx.Class.define("osparc.data.model.Node", { if (inputAccess) { this.setInputAccess(inputAccess); this.getPropsForm().setAccessLevel(inputAccess); - this.getPropsFormEditor().setAccessLevel(inputAccess); } const study = this.getStudy(); diff --git a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js index 8c8825b11db..f3d257222d7 100644 --- a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js +++ b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js @@ -842,7 +842,9 @@ qx.Class.define("osparc.form.renderer.PropForm", { if (portId in this.__linkUnlinkStackMap) { const stack = this.__linkUnlinkStackMap[portId]; - stack.setSelection([stack.getSelectables()[1]]); + if (stack.getSelectables().length > 1) { + stack.setSelection([stack.getSelectables()[1]]); + } } const linkFieldModified = { @@ -859,7 +861,9 @@ qx.Class.define("osparc.form.renderer.PropForm", { if (this.__resetCtrlField(portId)) { if (portId in this.__linkUnlinkStackMap) { const stack = this.__linkUnlinkStackMap[portId]; - stack.setSelection([stack.getSelectables()[0]]); + if (stack.getSelectables() > 0) { + stack.setSelection([stack.getSelectables()[0]]); + } } const linkFieldModified = { @@ -926,10 +930,10 @@ qx.Class.define("osparc.form.renderer.PropForm", { return true; }, - addPortLinks: function(data) { - for (let key in data) { - if (osparc.utils.Ports.isDataALink(data[key])) { - this.addPortLink(key, data[key].nodeUuid, data[key].output); + setInputLinks: function(inputLinks) { + for (let key in inputLinks) { + if (osparc.utils.Ports.isDataALink(inputLinks[key])) { + this.addPortLink(key, inputLinks[key].nodeUuid, inputLinks[key].output); } } }, diff --git a/services/static-webserver/client/source/class/osparc/node/slideshow/BaseNodeView.js b/services/static-webserver/client/source/class/osparc/node/slideshow/BaseNodeView.js index ce09559db2a..206a9adeda2 100644 --- a/services/static-webserver/client/source/class/osparc/node/slideshow/BaseNodeView.js +++ b/services/static-webserver/client/source/class/osparc/node/slideshow/BaseNodeView.js @@ -309,13 +309,6 @@ qx.Class.define("osparc.node.slideshow.BaseNodeView", { return; }, - /** - * @abstract - */ - _openEditAccessLevel: function() { - throw new Error("Abstract method called!"); - }, - __areInputsReady: function() { const wb = this.getNode().getStudy().getWorkbench(); const upstreamNodeIds = wb.getUpstreamCompNodes(this.getNode(), false); diff --git a/services/static-webserver/client/source/class/osparc/node/slideshow/FilePickerView.js b/services/static-webserver/client/source/class/osparc/node/slideshow/FilePickerView.js index cb79fc75da7..cd66e03d48a 100644 --- a/services/static-webserver/client/source/class/osparc/node/slideshow/FilePickerView.js +++ b/services/static-webserver/client/source/class/osparc/node/slideshow/FilePickerView.js @@ -42,11 +42,6 @@ qx.Class.define("osparc.node.slideshow.FilePickerView", { this.__buildMyLayout(); }, - // overridden - _openEditAccessLevel: function() { - return; - }, - // overridden _applyNode: function(node) { if (!node.isFilePicker()) { diff --git a/services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js b/services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js index b2a5b20e34d..ee59c8f6370 100644 --- a/services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js +++ b/services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js @@ -121,17 +121,6 @@ qx.Class.define("osparc.node.slideshow.NodeView", { return this.__loggerPanel; }, - // overridden - _openEditAccessLevel: function() { - const settingsEditorLayout = osparc.node.slideshow.BaseNodeView.createSettingsGroupBox(this.tr("Settings")); - const propsFormEditor = this.getNode().getPropsFormEditor(); - settingsEditorLayout.add(propsFormEditor); - const title = this.getNode().getLabel(); - osparc.ui.window.Window.popUpInWindow(settingsEditorLayout, title, 800, 600).set({ - autoDestroy: false - }); - }, - // overridden _applyNode: function(node) { this.base(arguments, node);