Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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 @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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);
}
});
}
Expand All @@ -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);
Expand All @@ -551,7 +545,7 @@ qx.Class.define("osparc.workbench.NodeUI", {
});
}
} else {
label.setValue("");
linkLabel.setValue("");
}
},

Expand Down
Loading