Skip to content

Commit 9ec7616

Browse files
committed
request the presigned link only when the widget is shown
1 parent 09947bd commit 9ec7616

File tree

1 file changed

+12
-9
lines changed
  • services/static-webserver/client/source/class/osparc/widget

1 file changed

+12
-9
lines changed

services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,21 @@ qx.Class.define("osparc.widget.NodeOutputs", {
198198
valueWidget = new osparc.ui.basic.LinkLabel();
199199
if ("store" in value) {
200200
// it's a file
201-
const download = true;
202-
const locationId = value.store;
203-
const fileId = value.path;
204201
const filename = value.filename || osparc.file.FilePicker.getFilenameFromPath(value);
205202
valueWidget.setValue(filename);
206203
valueWidget.eTag = value["eTag"];
207-
osparc.store.Data.getInstance().getPresignedLink(download, locationId, fileId)
208-
.then(presignedLinkData => {
209-
if ("resp" in presignedLinkData && presignedLinkData.resp) {
210-
valueWidget.setUrl(presignedLinkData.resp.link);
211-
}
212-
});
204+
const download = true;
205+
const locationId = value.store;
206+
const fileId = value.path;
207+
// request the presigned link only when the widget is shown
208+
valueWidget.addListenerOnce("appear", () => {
209+
osparc.store.Data.getInstance().getPresignedLink(download, locationId, fileId)
210+
.then(presignedLinkData => {
211+
if ("resp" in presignedLinkData && presignedLinkData.resp) {
212+
valueWidget.setUrl(presignedLinkData.resp.link);
213+
}
214+
});
215+
});
213216
} else if ("downloadLink" in value) {
214217
// it's a link
215218
const filename = (value.filename && value.filename.length > 0) ? value.filename : osparc.file.FileDownloadLink.extractLabelFromLink(value["downloadLink"]);

0 commit comments

Comments
 (0)