diff --git a/services/static-webserver/client/source/class/osparc/ui/basic/LinkLabel.js b/services/static-webserver/client/source/class/osparc/ui/basic/LinkLabel.js index ea126f1d6d1..5a44617d4d0 100644 --- a/services/static-webserver/client/source/class/osparc/ui/basic/LinkLabel.js +++ b/services/static-webserver/client/source/class/osparc/ui/basic/LinkLabel.js @@ -54,13 +54,16 @@ qx.Class.define("osparc.ui.basic.LinkLabel", { members: { __applyUrl: function(url) { - this.set({ - url, - cursor: "pointer", - font: "link-label-12" - }); - - this.addListener("click", this.__onClick); + if (url) { + this.set({ + cursor: "pointer", + font: "link-label-12", + }); + this.addListener("click", this.__onClick); + } else { + this.resetCursor(); + this.resetFont(); + } }, __onClick: function() { diff --git a/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js b/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js index 9d8a5f83b27..ce0bdb71043 100644 --- a/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js +++ b/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js @@ -474,15 +474,15 @@ qx.Class.define("osparc.workbench.NodeUI", { const width = 150; this.__setNodeUIWidth(width); - const label = new qx.ui.basic.Label().set({ + const linkLabel = new osparc.ui.basic.LinkLabel().set({ paddingLeft: 5, - font: "text-18" + font: "text-12" }); const chipContainer = this.getChildControl("chips"); - chipContainer.add(label); + chipContainer.add(linkLabel); - this.getNode().getPropsForm().addListener("linkFieldModified", () => this.__setProbeValue(label), this); - this.__setProbeValue(label); + this.getNode().getPropsForm().addListener("linkFieldModified", () => this.__setProbeValue(linkLabel), this); + this.__setProbeValue(linkLabel); }, __checkTurnIntoIteratorUI: function() { @@ -504,21 +504,19 @@ qx.Class.define("osparc.workbench.NodeUI", { } }, - __setProbeValue: function(label) { - const replaceByLinkLabel = val => { + __setProbeValue: function(linkLabel) { + const populateLinkLabel = linkInfo => { const download = true; - const locationId = val.store; - const fileId = val.path; + const locationId = linkInfo.store; + const fileId = linkInfo.path; osparc.store.Data.getInstance().getPresignedLink(download, locationId, fileId) .then(presignedLinkData => { if ("resp" in presignedLinkData && presignedLinkData.resp) { - const filename = val.filename || osparc.file.FilePicker.getFilenameFromPath(val); - const linkLabel = new osparc.ui.basic.LinkLabel(filename, presignedLinkData.resp.link).set({ - font: "link-label-12" + const filename = linkInfo.filename || osparc.file.FilePicker.getFilenameFromPath(linkInfo); + linkLabel.set({ + value: filename, + url: presignedLinkData.resp.link }); - const chipContainer = this.getChildControl("chips"); - chipContainer.remove(label); - chipContainer.add(linkLabel); } }); } @@ -529,19 +527,15 @@ qx.Class.define("osparc.workbench.NodeUI", { const portKey = link["output"]; const inputNode = this.getNode().getWorkbench().getNode(inputNodeId); if (inputNode) { - inputNode.bind("outputs", label, "value", { + inputNode.bind("outputs", linkLabel, "value", { converter: outputs => { - if (portKey in outputs && "value" in outputs[portKey]) { + if (portKey in outputs && "value" in outputs[portKey] && outputs[portKey]["value"]) { const val = outputs[portKey]["value"]; if (this.getNode().getMetaData()["key"].includes("probe/array")) { return "[" + val.join(",") + "]"; } else if (this.getNode().getMetaData()["key"].includes("probe/file")) { const filename = val.filename || osparc.file.FilePicker.getFilenameFromPath(val); - label.set({ - font: "text-12", - rich: true - }); - replaceByLinkLabel(val); + populateLinkLabel(val); return filename; } return String(val); @@ -551,7 +545,7 @@ qx.Class.define("osparc.workbench.NodeUI", { }); } } else { - label.setValue(""); + linkLabel.setValue(""); } },