Skip to content

Commit b5b4790

Browse files
committed
__guessIcon
1 parent f67fde5 commit b5b4790

File tree

1 file changed

+17
-26
lines changed
  • services/static-webserver/client/source/class/osparc/study

1 file changed

+17
-26
lines changed

services/static-webserver/client/source/class/osparc/study/Utils.js

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -358,42 +358,33 @@ qx.Class.define("osparc.study.Utils", {
358358
return ["UNKNOWN_SERVICES", false].includes(blocked);
359359
},
360360

361+
getNonFrontendNodes: function(studyData) {
362+
return Object.values(studyData["workbench"]).filter(node => !osparc.data.model.Node.isFrontend(node));
363+
},
364+
361365
guessIcon: function(studyData) {
362-
if (osparc.product.Utils.isProduct("osparc")) {
363-
return this.__guessOsparcIcon(studyData);
364-
}
365-
if (osparc.product.Utils.isS4LProduct() || osparc.product.Utils.isProduct("s4llite")) {
366-
return this.__guessS4LIcon(studyData);
367-
}
368366
if (osparc.product.Utils.isProduct("tis") || osparc.product.Utils.isProduct("tiplite")) {
369367
return this.__guessTIPIcon(studyData);
370368
}
371-
return osparc.dashboard.CardBase.PRODUCT_ICON;
372-
},
373-
374-
__guessOsparcIcon: function(studyData) {
375-
// the was to guess the TI type is to check the boot mode of the ti-postpro in the pipeline
376-
const wbServices = Object.values(studyData["workbench"]);
377-
if (wbServices.length > 1) {
378-
return "osparc/icons/diagram.png";
379-
}
380-
return osparc.dashboard.CardBase.PRODUCT_ICON;
369+
return this.__guessIcon(studyData);
381370
},
382371

383-
__guessS4LIcon: function(studyData) {
372+
__guessIcon: function(studyData) {
384373
// the was to guess the TI type is to check the boot mode of the ti-postpro in the pipeline
385-
const wbServices = Object.values(studyData["workbench"]);
374+
const wbServices = this.self().getNonFrontendNodes(studyData);
386375
if (wbServices.length === 1) {
387-
if (wbServices[0]["key"].includes("iseg")) {
388-
return "https://raw.githubusercontent.com/ITISFoundation/osparc-iseg/master/iSeg/images/isegicon.png";
389-
}
390-
if (wbServices[0]["key"].includes("jupyter")) {
391-
return "https://images.seeklogo.com/logo-png/35/1/jupyter-logo-png_seeklogo-354673.png";
392-
}
393-
if (wbServices[0]["key"].includes("s4l-ui")) {
394-
return "https://raw.githubusercontent.com/ZurichMedTech/s4l-assets/refs/heads/main/app/icons/s4l/Sim4Life.png";
376+
const wbService = wbServices[0];
377+
const allServices = osparc.store.Services.servicesCached;
378+
if (wbService.key in allServices && wbService.version in allServices[wbService.key]) {
379+
const serviceMetadata = allServices[wbService.key][wbService.version];
380+
if (serviceMetadata["icon"]) {
381+
return serviceMetadata["icon"];
382+
}
395383
}
396384
}
385+
if (wbServices.length > 1) {
386+
return "osparc/icons/diagram.png";
387+
}
397388
return osparc.dashboard.CardBase.PRODUCT_ICON;
398389
},
399390

0 commit comments

Comments
 (0)