Skip to content

Commit 50076aa

Browse files
authored
🐛 [Frontend] Fix probe (#6620)
1 parent fc1e2a7 commit 50076aa

File tree

2 files changed

+27
-30
lines changed

2 files changed

+27
-30
lines changed

services/static-webserver/client/source/class/osparc/ui/basic/LinkLabel.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,16 @@ qx.Class.define("osparc.ui.basic.LinkLabel", {
5454

5555
members: {
5656
__applyUrl: function(url) {
57-
this.set({
58-
url,
59-
cursor: "pointer",
60-
font: "link-label-12"
61-
});
62-
63-
this.addListener("click", this.__onClick);
57+
if (url) {
58+
this.set({
59+
cursor: "pointer",
60+
font: "link-label-12",
61+
});
62+
this.addListener("click", this.__onClick);
63+
} else {
64+
this.resetCursor();
65+
this.resetFont();
66+
}
6467
},
6568

6669
__onClick: function() {

services/static-webserver/client/source/class/osparc/workbench/NodeUI.js

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,15 @@ qx.Class.define("osparc.workbench.NodeUI", {
474474
const width = 150;
475475
this.__setNodeUIWidth(width);
476476

477-
const label = new qx.ui.basic.Label().set({
477+
const linkLabel = new osparc.ui.basic.LinkLabel().set({
478478
paddingLeft: 5,
479-
font: "text-18"
479+
font: "text-12"
480480
});
481481
const chipContainer = this.getChildControl("chips");
482-
chipContainer.add(label);
482+
chipContainer.add(linkLabel);
483483

484-
this.getNode().getPropsForm().addListener("linkFieldModified", () => this.__setProbeValue(label), this);
485-
this.__setProbeValue(label);
484+
this.getNode().getPropsForm().addListener("linkFieldModified", () => this.__setProbeValue(linkLabel), this);
485+
this.__setProbeValue(linkLabel);
486486
},
487487

488488
__checkTurnIntoIteratorUI: function() {
@@ -504,21 +504,19 @@ qx.Class.define("osparc.workbench.NodeUI", {
504504
}
505505
},
506506

507-
__setProbeValue: function(label) {
508-
const replaceByLinkLabel = val => {
507+
__setProbeValue: function(linkLabel) {
508+
const populateLinkLabel = linkInfo => {
509509
const download = true;
510-
const locationId = val.store;
511-
const fileId = val.path;
510+
const locationId = linkInfo.store;
511+
const fileId = linkInfo.path;
512512
osparc.store.Data.getInstance().getPresignedLink(download, locationId, fileId)
513513
.then(presignedLinkData => {
514514
if ("resp" in presignedLinkData && presignedLinkData.resp) {
515-
const filename = val.filename || osparc.file.FilePicker.getFilenameFromPath(val);
516-
const linkLabel = new osparc.ui.basic.LinkLabel(filename, presignedLinkData.resp.link).set({
517-
font: "link-label-12"
515+
const filename = linkInfo.filename || osparc.file.FilePicker.getFilenameFromPath(linkInfo);
516+
linkLabel.set({
517+
value: filename,
518+
url: presignedLinkData.resp.link
518519
});
519-
const chipContainer = this.getChildControl("chips");
520-
chipContainer.remove(label);
521-
chipContainer.add(linkLabel);
522520
}
523521
});
524522
}
@@ -529,19 +527,15 @@ qx.Class.define("osparc.workbench.NodeUI", {
529527
const portKey = link["output"];
530528
const inputNode = this.getNode().getWorkbench().getNode(inputNodeId);
531529
if (inputNode) {
532-
inputNode.bind("outputs", label, "value", {
530+
inputNode.bind("outputs", linkLabel, "value", {
533531
converter: outputs => {
534-
if (portKey in outputs && "value" in outputs[portKey]) {
532+
if (portKey in outputs && "value" in outputs[portKey] && outputs[portKey]["value"]) {
535533
const val = outputs[portKey]["value"];
536534
if (this.getNode().getMetaData()["key"].includes("probe/array")) {
537535
return "[" + val.join(",") + "]";
538536
} else if (this.getNode().getMetaData()["key"].includes("probe/file")) {
539537
const filename = val.filename || osparc.file.FilePicker.getFilenameFromPath(val);
540-
label.set({
541-
font: "text-12",
542-
rich: true
543-
});
544-
replaceByLinkLabel(val);
538+
populateLinkLabel(val);
545539
return filename;
546540
}
547541
return String(val);
@@ -551,7 +545,7 @@ qx.Class.define("osparc.workbench.NodeUI", {
551545
});
552546
}
553547
} else {
554-
label.setValue("");
548+
linkLabel.setValue("");
555549
}
556550
},
557551

0 commit comments

Comments
 (0)