Skip to content

Commit 7d4ff8c

Browse files
committed
trashedAt in study cards
1 parent ace6b69 commit 7d4ff8c

File tree

4 files changed

+43
-7
lines changed

4 files changed

+43
-7
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,12 @@ qx.Class.define("osparc.dashboard.CardBase", {
308308
nullable: true
309309
},
310310

311+
trashedAt: {
312+
check: "Date",
313+
apply: "_applyTrasehdAt",
314+
nullable: true
315+
},
316+
311317
classifiers: {
312318
check: "Array"
313319
},
@@ -457,6 +463,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
457463
owner,
458464
accessRights: resourceData.accessRights ? resourceData.accessRights : {},
459465
lastChangeDate: resourceData.lastChangeDate ? new Date(resourceData.lastChangeDate) : null,
466+
trashedAt: resourceData.trashedAt ? new Date(resourceData.trashedAt) : null,
460467
icon: resourceData.thumbnail || this.self().PRODUCT_ICON,
461468
state: resourceData.state ? resourceData.state : {},
462469
classifiers: resourceData.classifiers && resourceData.classifiers ? resourceData.classifiers : [],
@@ -523,6 +530,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
523530
throw new Error("Abstract method called!");
524531
},
525532

533+
_applyTrasehdAt: function(value, old) {
534+
throw new Error("Abstract method called!");
535+
},
536+
526537
_applyAccessRights: function(value, old) {
527538
throw new Error("Abstract method called!");
528539
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
251251
layout.add(control, {flex: 1});
252252
break;
253253
}
254-
case "modified-text":
254+
case "date-text":
255255
control = new qx.ui.basic.Label().set({
256256
textColor: "contrasted-text-dark",
257257
alignY: "middle",

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,21 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
176176

177177
// overridden
178178
_applyLastChangeDate: function(value, old) {
179-
if (value && (this.isResourceType("study") || this.isResourceType("template"))) {
180-
const label = this.getChildControl("modified-text");
181-
label.setValue(osparc.utils.Utils.formatDateAndTime(value));
179+
if (value) {
180+
if (this.isResourceType("study") || this.isResourceType("template")) {
181+
const label = this.getChildControl("date-text");
182+
label.setValue(osparc.utils.Utils.formatDateAndTime(value));
183+
}
184+
}
185+
},
186+
187+
// overridden
188+
_applyTrasehdAt: function(value, old) {
189+
if (value && value.getTime() !== new Date(0).getTime()) {
190+
if (this.isResourceType("study") || this.isResourceType("template")) {
191+
const label = this.getChildControl("date-text");
192+
label.setValue(osparc.utils.Utils.formatDateAndTime(value));
193+
}
182194
}
183195
},
184196

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
6868
column: osparc.dashboard.ListButtonBase.POS.SHARED
6969
});
7070
break;
71-
case "last-change":
71+
case "date-text":
7272
control = new qx.ui.basic.Label().set({
7373
anonymous: true,
7474
font: "text-13",
@@ -191,10 +191,23 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
191191
return control || this.base(arguments, id);
192192
},
193193

194+
// overridden
194195
_applyLastChangeDate: function(value, old) {
195196
if (value) {
196-
const label = this.getChildControl("last-change");
197-
label.setValue(osparc.utils.Utils.formatDateAndTime(value));
197+
if (this.isResourceType("study") || this.isResourceType("template")) {
198+
const label = this.getChildControl("date-text");
199+
label.setValue(osparc.utils.Utils.formatDateAndTime(value));
200+
}
201+
}
202+
},
203+
204+
// overridden
205+
_applyTrasehdAt: function(value, old) {
206+
if (value && value.getTime() !== new Date(0).getTime()) {
207+
if (this.isResourceType("study") || this.isResourceType("template")) {
208+
const label = this.getChildControl("date-text");
209+
label.setValue(osparc.utils.Utils.formatDateAndTime(value));
210+
}
198211
}
199212
},
200213

0 commit comments

Comments
 (0)