Skip to content

Studies of one node open directly in fullscreen view instead displaying the pipeline #1316

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 14 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,20 @@ qx.Class.define("osparc.component.workbench.SvgWidget", {
this.__svgWrapper = new osparc.wrapper.Svg();
this.__svgWrapper.addListener(("svgLibReady"), () => {
this.__canvas = this.__svgWrapper.createEmptyCanvas(svgLayerId);
this.setReady(true);
this.fireDataEvent("SvgWidgetReady", true);
});
this.__svgWrapper.init();
});
},

properties: {
ready: {
check: "Boolean",
init: false
}
},

events: {
"SvgWidgetReady": "qx.event.type.Data"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", {
this.__desktopCanvas.add(this.__startHint);

this.__svgWidgetLinks = new osparc.component.workbench.SvgWidget("SvgWidget_Links");
// this gets fired once the widget has appeared and the library has been loaded
// due to the qx rendering, this will always happen after setup, so we are
// sure to catch this event
this.__svgWidgetLinks.addListenerOnce("SvgWidgetReady", () => {
// Will be called only the first time Svg lib is loaded
this.loadModel(workbench);
const study = osparc.store.Store.getInstance().getCurrentStudy();
this.__nodeSelected(study.getUuid());
});

this.__desktop.add(this.__svgWidgetLinks, {
left: 0,
top: 0,
Expand Down Expand Up @@ -761,6 +751,16 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", {
},

loadModel: function(model) {
if (this.__svgWidgetLinks.getReady()) {
this.__loadModel(model);
} else {
this.__svgWidgetLinks.addListenerOnce("SvgWidgetReady", () => {
this.__loadModel(model);
}, this);
}
},

__loadModel: function(model) {
this.clearAll();
this.resetSelectedNodes();
this.__currentModel = model;
Expand Down
6 changes: 4 additions & 2 deletions services/web/client/source/class/osparc/data/model/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ qx.Class.define("osparc.data.model.Node", {
if (this.__outputWidget) {
this.__outputWidget.populatePortsData();
}

if (this.isDynamic()) {
this.__showLoadingIFrame();
}
},

giveUniqueName: function() {
Expand Down Expand Up @@ -775,8 +779,6 @@ qx.Class.define("osparc.data.model.Node", {
}, this);
restartBtn.setEnabled(false);
this.setRestartIFrameButton(restartBtn);

this.__showLoadingIFrame();
}
},

Expand Down
24 changes: 21 additions & 3 deletions services/web/client/source/class/osparc/desktop/StudyEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,28 @@ qx.Class.define("osparc.desktop.StudyEditor", {
osparc.store.Store.getInstance().setCurrentStudy(study);
study.buildWorkbench();
study.openStudy();
this.__initDefault();
this.__initViews();
this.__connectEvents();
this.__startAutoSaveTimer();

this.__openOneNode();
},

__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]);
} else {
this.nodeSelected(this.getStudy().getUuid());
}
},

/**
Expand All @@ -87,7 +106,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
this.__stopAutoSaveTimer();
},

__initDefault: function() {
__initViews: function() {
const study = this.getStudy();

const nodesTree = this.__nodesTree = new osparc.component.widget.NodesTree(study);
Expand All @@ -112,7 +131,6 @@ qx.Class.define("osparc.desktop.StudyEditor", {
const edgeId = e.getData();
this.__removeEdge(edgeId);
}, this);
this.showInMainView(workbenchUI, study.getUuid());

this.__nodeView = new osparc.component.node.NodeView().set({
minHeight: 200
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ qx.Class.define("osparc.desktop.preferences.Preferences", {
init: false,
check: "Boolean",
event: "changeAutoConnectPorts"
},

autoOpenNode: {
nullable: false,
init: true,
check: "Boolean",
event: "changeAutoOpenNode"
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,16 @@ qx.Class.define("osparc.desktop.preferences.pages.ExperimentalPage", {

const preferencesSettings = osparc.desktop.preferences.Preferences.getInstance();

const cbAutoPorts = new qx.ui.form.CheckBox("Auto Connect Ports");
const cbAutoPorts = new qx.ui.form.CheckBox(this.tr("Connect ports automatically"));
preferencesSettings.bind("autoConnectPorts", cbAutoPorts, "value");
cbAutoPorts.bind("value", preferencesSettings, "autoConnectPorts");

box.add(cbAutoPorts);

const cbAutoOpenNode = new qx.ui.form.CheckBox(this.tr("Open node automatically when opening studies with a single node"));
preferencesSettings.bind("autoOpenNode", cbAutoOpenNode, "value");
cbAutoOpenNode.bind("value", preferencesSettings, "autoOpenNode");
box.add(cbAutoOpenNode);

return box;
}
}
Expand Down