Skip to content

🐛 [Frontend] Reopening running study breaks the connections #6259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 28, 2024
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
Loading