Skip to content

Commit

Permalink
🐛 [Frontend] Reopening running study breaks the connections (#6259)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored and matusdrobuliak66 committed Aug 30, 2024
1 parent 400e0b5 commit 14b7797
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
},

/**
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
},
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 = {
Expand Down Expand Up @@ -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);
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ qx.Class.define("osparc.node.slideshow.FilePickerView", {
this.__buildMyLayout();
},

// overridden
_openEditAccessLevel: function() {
return;
},

// overridden
_applyNode: function(node) {
if (!node.isFilePicker()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 14b7797

Please sign in to comment.