Skip to content

Commit 14b7797

Browse files
odeimaizmatusdrobuliak66
authored andcommitted
🐛 [Frontend] Reopening running study breaks the connections (#6259)
1 parent 400e0b5 commit 14b7797

File tree

5 files changed

+22
-69
lines changed

5 files changed

+22
-69
lines changed

services/static-webserver/client/source/class/osparc/data/model/Node.js

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,6 @@ qx.Class.define("osparc.data.model.Node", {
166166
apply: "__applyPropsForm"
167167
},
168168

169-
propsFormEditor: {
170-
check: "osparc.form.renderer.PropFormEditor",
171-
init: null,
172-
nullable: true
173-
},
174-
175169
marker: {
176170
check: "qx.core.Object",
177171
init: null,
@@ -447,7 +441,6 @@ qx.Class.define("osparc.data.model.Node", {
447441
this.setInputs(metadata.inputs);
448442
if (Object.keys(metadata.inputs).length) {
449443
this.__addSettings(metadata.inputs);
450-
this.__addSettingsAccessLevelEditor(metadata.inputs);
451444
}
452445
if (this.getPropsForm()) {
453446
this.getPropsForm().makeInputsDynamic();
@@ -549,7 +542,17 @@ qx.Class.define("osparc.data.model.Node", {
549542
this.getPropsForm().setEnabled(!isPipelineRunning);
550543
};
551544
this.getStudy().addListener("changeState", () => checkIsPipelineRunning(), this);
552-
checkIsPipelineRunning();
545+
546+
// potentially disabling the inputs form might have side effects if the deserialization is not over
547+
if (this.getWorkbench().isDeserialized()) {
548+
checkIsPipelineRunning();
549+
} else {
550+
this.getWorkbench().addListener("changeDeserialized", e => {
551+
if (e.getData()) {
552+
checkIsPipelineRunning();
553+
}
554+
}, this);
555+
}
553556
},
554557

555558
/**
@@ -609,36 +612,6 @@ qx.Class.define("osparc.data.model.Node", {
609612
}, this);
610613
},
611614

612-
__addSettingsAccessLevelEditor: function(inputs) {
613-
const propsForm = this.getPropsForm();
614-
const form = new osparc.form.Auto(inputs);
615-
form.setData(this.__settingsForm.getData());
616-
const propsFormEditor = new osparc.form.renderer.PropFormEditor(form, this);
617-
this.__settingsForm.addListener("changeData", e => {
618-
// apply data
619-
const data = this.__settingsForm.getData();
620-
form.setData(data);
621-
}, this);
622-
propsForm.addListener("linkFieldModified", e => {
623-
const linkFieldModified = e.getData();
624-
const {
625-
portId,
626-
added
627-
} = linkFieldModified;
628-
if (added) {
629-
const srcControlLink = propsForm.getControlLink(portId);
630-
const controlLink = new qx.ui.form.TextField().set({
631-
enabled: false
632-
});
633-
srcControlLink.bind("value", controlLink, "value");
634-
propsFormEditor.linkAdded(portId, controlLink);
635-
} else {
636-
propsFormEditor.linkRemoved(portId);
637-
}
638-
}, this);
639-
this.setPropsFormEditor(propsFormEditor);
640-
},
641-
642615
removeNodePortConnections: function(inputNodeId) {
643616
let inputs = this.__getInputData();
644617
for (const portId in inputs) {
@@ -684,7 +657,7 @@ qx.Class.define("osparc.data.model.Node", {
684657
inputData[key] = inputsCopy[key];
685658
}
686659
}
687-
this.getPropsForm().addPortLinks(inputLinks);
660+
this.getPropsForm().setInputLinks(inputLinks);
688661
this.__settingsForm.setData(inputData);
689662
}
690663
},
@@ -699,7 +672,6 @@ qx.Class.define("osparc.data.model.Node", {
699672
if (inputAccess) {
700673
this.setInputAccess(inputAccess);
701674
this.getPropsForm().setAccessLevel(inputAccess);
702-
this.getPropsFormEditor().setAccessLevel(inputAccess);
703675
}
704676

705677
const study = this.getStudy();

services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,9 @@ qx.Class.define("osparc.form.renderer.PropForm", {
842842

843843
if (portId in this.__linkUnlinkStackMap) {
844844
const stack = this.__linkUnlinkStackMap[portId];
845-
stack.setSelection([stack.getSelectables()[1]]);
845+
if (stack.getSelectables().length > 1) {
846+
stack.setSelection([stack.getSelectables()[1]]);
847+
}
846848
}
847849

848850
const linkFieldModified = {
@@ -859,7 +861,9 @@ qx.Class.define("osparc.form.renderer.PropForm", {
859861
if (this.__resetCtrlField(portId)) {
860862
if (portId in this.__linkUnlinkStackMap) {
861863
const stack = this.__linkUnlinkStackMap[portId];
862-
stack.setSelection([stack.getSelectables()[0]]);
864+
if (stack.getSelectables() > 0) {
865+
stack.setSelection([stack.getSelectables()[0]]);
866+
}
863867
}
864868

865869
const linkFieldModified = {
@@ -926,10 +930,10 @@ qx.Class.define("osparc.form.renderer.PropForm", {
926930
return true;
927931
},
928932

929-
addPortLinks: function(data) {
930-
for (let key in data) {
931-
if (osparc.utils.Ports.isDataALink(data[key])) {
932-
this.addPortLink(key, data[key].nodeUuid, data[key].output);
933+
setInputLinks: function(inputLinks) {
934+
for (let key in inputLinks) {
935+
if (osparc.utils.Ports.isDataALink(inputLinks[key])) {
936+
this.addPortLink(key, inputLinks[key].nodeUuid, inputLinks[key].output);
933937
}
934938
}
935939
},

services/static-webserver/client/source/class/osparc/node/slideshow/BaseNodeView.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,6 @@ qx.Class.define("osparc.node.slideshow.BaseNodeView", {
309309
return;
310310
},
311311

312-
/**
313-
* @abstract
314-
*/
315-
_openEditAccessLevel: function() {
316-
throw new Error("Abstract method called!");
317-
},
318-
319312
__areInputsReady: function() {
320313
const wb = this.getNode().getStudy().getWorkbench();
321314
const upstreamNodeIds = wb.getUpstreamCompNodes(this.getNode(), false);

services/static-webserver/client/source/class/osparc/node/slideshow/FilePickerView.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ qx.Class.define("osparc.node.slideshow.FilePickerView", {
4242
this.__buildMyLayout();
4343
},
4444

45-
// overridden
46-
_openEditAccessLevel: function() {
47-
return;
48-
},
49-
5045
// overridden
5146
_applyNode: function(node) {
5247
if (!node.isFilePicker()) {

services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,6 @@ qx.Class.define("osparc.node.slideshow.NodeView", {
121121
return this.__loggerPanel;
122122
},
123123

124-
// overridden
125-
_openEditAccessLevel: function() {
126-
const settingsEditorLayout = osparc.node.slideshow.BaseNodeView.createSettingsGroupBox(this.tr("Settings"));
127-
const propsFormEditor = this.getNode().getPropsFormEditor();
128-
settingsEditorLayout.add(propsFormEditor);
129-
const title = this.getNode().getLabel();
130-
osparc.ui.window.Window.popUpInWindow(settingsEditorLayout, title, 800, 600).set({
131-
autoDestroy: false
132-
});
133-
},
134-
135124
// overridden
136125
_applyNode: function(node) {
137126
this.base(arguments, node);

0 commit comments

Comments
 (0)