Skip to content

Commit

Permalink
🐛 Fix Frontend SharedResourceItem's icon (#5732)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Apr 25, 2024
1 parent fb106a7 commit 63a3a61
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
NEW_ICON: "@FontAwesome5Solid/plus/",
LOADING_ICON: "@FontAwesome5Solid/circle-notch/",
// Get the default thumbnail for each product else add the image and extension osparc.product.Utils.getProductThumbUrl(Thumbnail-01.png)
STUDY_ICON: osparc.product.Utils.getProductThumbUrl(),
TEMPLATE_ICON: osparc.product.Utils.getProductThumbUrl(),
SERVICE_ICON: osparc.product.Utils.getProductThumbUrl(),
COMP_SERVICE_ICON: osparc.product.Utils.getProductThumbUrl(),
DYNAMIC_SERVICE_ICON: osparc.product.Utils.getProductThumbUrl(),
PRODUCT_ICON: osparc.product.Utils.getProductThumbUrl(),

CARD_PRIORITY: {
NEW: 0,
Expand Down Expand Up @@ -302,7 +298,6 @@ qx.Class.define("osparc.dashboard.CardBase", {
},

__applyResourceData: function(resourceData) {
let defaultThumbnail = "";
let uuid = null;
let owner = "";
let defaultHits = null;
Expand All @@ -311,25 +306,16 @@ qx.Class.define("osparc.dashboard.CardBase", {
case "study":
uuid = resourceData.uuid ? resourceData.uuid : uuid;
owner = resourceData.prjOwner ? resourceData.prjOwner : owner;
defaultThumbnail = this.self().STUDY_ICON;
workbench = resourceData.workbench ? resourceData.workbench : workbench;
break;
case "template":
uuid = resourceData.uuid ? resourceData.uuid : uuid;
owner = resourceData.prjOwner ? resourceData.prjOwner : owner;
defaultThumbnail = this.self().TEMPLATE_ICON;
workbench = resourceData.workbench ? resourceData.workbench : workbench;
break;
case "service":
uuid = resourceData.key ? resourceData.key : uuid;
owner = resourceData.owner ? resourceData.owner : owner;
defaultThumbnail = this.self().SERVICE_ICON;
if (osparc.data.model.Node.isComputational(resourceData)) {
defaultThumbnail = this.self().COMP_SERVICE_ICON;
}
if (osparc.data.model.Node.isDynamic(resourceData)) {
defaultThumbnail = this.self().DYNAMIC_SERVICE_ICON;
}
defaultHits = 0;
break;
}
Expand All @@ -342,7 +328,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
owner,
accessRights: resourceData.accessRights ? resourceData.accessRights : {},
lastChangeDate: resourceData.lastChangeDate ? new Date(resourceData.lastChangeDate) : null,
icon: resourceData.thumbnail || defaultThumbnail,
icon: resourceData.thumbnail || this.self().PRODUCT_ICON,
state: resourceData.state ? resourceData.state : {},
classifiers: resourceData.classifiers && resourceData.classifiers ? resourceData.classifiers : [],
quality: resourceData.quality ? resourceData.quality : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,8 @@ qx.Class.define("osparc.desktop.organizations.ServicesList", {
orgServices.forEach(orgService => {
const orgServiceCopy = osparc.utils.Utils.deepCloneObject(orgService);
orgServiceCopy["orgId"] = gid;
if (osparc.data.model.Node.isDynamic(orgServiceCopy)) {
orgServiceCopy["thumbnail"] = osparc.dashboard.CardBase.DYNAMIC_SERVICE_ICON+"24";
} else if (osparc.data.model.Node.isComputational(orgServiceCopy)) {
orgServiceCopy["thumbnail"] = osparc.dashboard.CardBase.COMP_SERVICE_ICON+"24";
} else {
orgServiceCopy["thumbnail"] = osparc.dashboard.CardBase.SERVICE_ICON+"24";
if (orgServiceCopy["thumbnail"] === null) {
orgServiceCopy["thumbnail"] = osparc.dashboard.CardBase.PRODUCT_ICON;
}
servicesModel.append(qx.data.marshal.Json.createModel(orgServiceCopy));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ qx.Class.define("osparc.info.ServiceUtils", {
createThumbnail: function(serviceData, maxWidth, maxHeight) {
const thumbnail = osparc.info.Utils.createThumbnail(maxWidth, maxHeight);
thumbnail.set({
source: "thumbnail" in serviceData && serviceData["thumbnail"] !== "" ? serviceData["thumbnail"] : osparc.dashboard.CardBase.SERVICE_ICON
source: "thumbnail" in serviceData && serviceData["thumbnail"] !== "" ? serviceData["thumbnail"] : osparc.dashboard.CardBase.PRODUCT_ICON
});
return thumbnail;
},
Expand Down

0 comments on commit 63a3a61

Please sign in to comment.