Skip to content

Commit ae40a2d

Browse files
committed
[skip ci] Distinguish between thumbnail and icon
1 parent 0d451b9 commit ae40a2d

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

services/static-webserver/client/source/class/osparc/dashboard/CardBase.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ qx.Class.define("osparc.dashboard.CardBase", {
269269
apply: "_applyIcon",
270270
},
271271

272+
thumbnail: {
273+
check: "String",
274+
init: null,
275+
nullable: true,
276+
apply: "_applyThumbnail",
277+
},
278+
272279
resourceData: {
273280
check: "Object",
274281
nullable: false,
@@ -482,6 +489,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
482489
trashedAt: resourceData.trashedAt ? new Date(resourceData.trashedAt) : null,
483490
trashedBy: resourceData.trashedBy || null,
484491
icon: resourceData.thumbnail || this.self().PRODUCT_ICON,
492+
thumbnail: resourceData.thumbnail || this.self().PRODUCT_ICON,
485493
state: resourceData.state ? resourceData.state : {},
486494
classifiers: resourceData.classifiers && resourceData.classifiers ? resourceData.classifiers : [],
487495
quality: resourceData.quality ? resourceData.quality : null,
@@ -531,6 +539,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
531539
throw new Error("Abstract method called!");
532540
},
533541

542+
_applyThumbnail: function(value, old) {
543+
throw new Error("Abstract method called!");
544+
},
545+
534546
_applyTitle: function(value, old) {
535547
throw new Error("Abstract method called!");
536548
},

services/static-webserver/client/source/class/osparc/dashboard/GridButtonBase.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,23 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
251251
layout.add(control, {flex: 1});
252252
break;
253253
}
254+
case "thumbnail": {
255+
layout = this.getChildControl("body");
256+
const maxWidth = this.self().ITEM_WIDTH;
257+
control = new osparc.ui.basic.Thumbnail(null, maxWidth, 124);
258+
control.getChildControl("image").set({
259+
anonymous: true,
260+
alignY: "middle",
261+
alignX: "center",
262+
allowGrowX: true,
263+
allowGrowY: true
264+
});
265+
layout.getContentElement().setStyles({
266+
"border-width": "0px"
267+
});
268+
layout.add(control, {flex: 1});
269+
break;
270+
}
254271
case "date-by":
255272
control = new osparc.ui.basic.DateAndBy();
256273
layout = this.getChildControl("footer");
@@ -276,9 +293,14 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
276293

277294
// overridden
278295
_applyIcon: function(value, old) {
296+
console.log("show icon", value);
297+
},
298+
299+
// overridden
300+
_applyThumbnail: function(value, old) {
279301
if (value.includes("@FontAwesome5Solid/")) {
280302
value += this.self().ICON_SIZE;
281-
const image = this.getChildControl("icon").getChildControl("image");
303+
const image = this.getChildControl("thumbnail").getChildControl("image");
282304
image.set({
283305
source: value
284306
});

services/static-webserver/client/source/class/osparc/dashboard/ListButtonBase.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,18 @@ qx.Class.define("osparc.dashboard.ListButtonBase", {
144144
});
145145
},
146146

147+
_applyThumbnail: function(value, old) {
148+
// do not shot thumbnail in list button, icon takes over
149+
return;
150+
},
151+
147152
_applyTitle: function(value, old) {
148153
const label = this.getChildControl("title");
149154
label.setValue(value);
150155
},
151156

152157
_applyDescription: function(value, old) {
153-
return
158+
return;
154159
}
155160
},
156161

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,5 +353,16 @@ qx.Class.define("osparc.study.Utils", {
353353
const blocked = this.__getBlockedState(studyData);
354354
return ["UNKNOWN_SERVICES", false].includes(blocked);
355355
},
356+
357+
suggestIcon: function(studyData) {
358+
if (osparc.product.Utils.isProduct("tis") || osparc.product.Utils.isProduct("tiplite")) {
359+
return "https://images.seeklogo.com/logo-png/35/1/jupyter-logo-png_seeklogo-354673.png";
360+
}
361+
const uiMode = this.self().getUiMode(studyData);
362+
if (uiMode === "standalone") {
363+
return "https://raw.githubusercontent.com/ITISFoundation/osparc-iseg/master/iSeg/images/isegicon.png";
364+
}
365+
return osparc.dashboard.CardBase.PRODUCT_ICON;
366+
},
356367
}
357368
});

0 commit comments

Comments
 (0)