Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix Frontend SharedResourceItem's icon #5732

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -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
Loading