Skip to content

Commit

Permalink
dateBy
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Jan 17, 2025
1 parent 1f62068 commit d70c956
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ qx.Class.define("osparc.dashboard.CardBase", {
nullable: true
},

trashedBy: {
check: "Number",
apply: "_applyTrashedBy",
nullable: true
},

classifiers: {
check: "Array"
},
Expand Down Expand Up @@ -544,6 +550,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
throw new Error("Abstract method called!");
},

_applyTrashedBy: function(value, old) {
throw new Error("Abstract method called!");
},

_applyAccessRights: function(value, old) {
throw new Error("Abstract method called!");
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,8 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
layout.add(control, {flex: 1});
break;
}
case "date-text":
control = new qx.ui.basic.Label().set({
textColor: "contrasted-text-dark",
alignY: "middle",
rich: true,
font: "text-12",
allowGrowY: false
});
case "date-by":
control = new osparc.ui.basic.DateAndBy();
layout = this.getChildControl("footer");
layout.add(control, this.self().FPOS.MODIFIED);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,28 +178,38 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
_applyLastChangeDate: function(value, old) {
if (value) {
if (this.isResourceType("study") || this.isResourceType("template")) {
const label = this.getChildControl("date-text");
label.set({
value: osparc.utils.Utils.formatDateAndTime(value),
const dateBy = this.getChildControl("date-by");
dateBy.set({
date: value,
toolTipText: this.tr("Last modified"),
});
}
}
},

// overridden
_applyTrasehdAt: function(value, old) {
_applyTrasehdAt: function(value) {
if (value && value.getTime() !== new Date(0).getTime()) {
if (this.isResourceType("study") || this.isResourceType("template")) {
const label = this.getChildControl("date-text");
label.set({
value: osparc.utils.Utils.formatDateAndTime(value),
const dateBy = this.getChildControl("date-by");
dateBy.set({
date: value,
toolTipText: this.tr("Moved to the bin"),
});
}
}
},

// overridden
_applyTrashedBy: function(gid) {
if (gid) {
if (this.isResourceType("study") || this.isResourceType("template")) {
const dateBy = this.getChildControl("date-by");
dateBy.setGroupId(gid);
}
}
},

__createOwner: function(label) {
if (label === osparc.auth.Data.getInstance().getEmail()) {
const resourceAlias = osparc.utils.Utils.resourceTypeToAlias(this.getResourceType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,28 +194,38 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
_applyLastChangeDate: function(value, old) {
if (value) {
if (this.isResourceType("study") || this.isResourceType("template")) {
const label = this.getChildControl("date-text");
label.set({
value: osparc.utils.Utils.formatDateAndTime(value),
const dateBy = this.getChildControl("date-by");
dateBy.set({
date: value,
toolTipText: this.tr("Last modified"),
});
}
}
},

// overridden
_applyTrasehdAt: function(value, old) {
_applyTrasehdAt: function(value) {
if (value && value.getTime() !== new Date(0).getTime()) {
if (this.isResourceType("study") || this.isResourceType("template")) {
const label = this.getChildControl("date-text");
label.set({
value: osparc.utils.Utils.formatDateAndTime(value),
const dateBy = this.getChildControl("date-by");
dateBy.set({
date: value,
toolTipText: this.tr("Moved to the bin"),
});
}
}
},

// overridden
_applyTrashedBy: function(gid) {
if (gid) {
if (this.isResourceType("study") || this.isResourceType("template")) {
const dateBy = this.getChildControl("date-by");
dateBy.setGroupId(gid);
}
}
},

__createOwner: function(label) {
if (label === osparc.auth.Data.getInstance().getEmail()) {
const resourceAlias = osparc.utils.Utils.resourceTypeToAlias(this.getResourceType());
Expand Down

0 comments on commit d70c956

Please sign in to comment.