Skip to content

🎨 [Frontend] Trash Enhancements #7029

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

Merged
merged 9 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -271,7 +271,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {

menu.addSeparator();

const trashButton = new qx.ui.menu.Button(this.tr("Trash"), "@FontAwesome5Solid/trash/12");
const trashButton = new qx.ui.menu.Button(this.tr("Move to Bin"), "@FontAwesome5Solid/trash/12");
trashButton.addListener("execute", () => this.fireDataEvent("trashFolderRequested", this.getFolderId()), this);
menu.add(trashButton);
} else if (studyBrowserContext === "trash") {
Expand Down Expand Up @@ -329,7 +329,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
const msg = this.tr("Are you sure you want to delete") + " <b>" + this.getTitle() + "</b>?";
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
caption: this.tr("Delete Folder"),
confirmText: this.tr("Delete"),
confirmText: this.tr("Delete permanently"),
confirmAction: "delete"
});
osparc.utils.Utils.setIdToWidget(confirmationWin.getConfirmButton(), "confirmDeleteFolderButton");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
const trashButton = this.__trashButton = new qx.ui.toolbar.RadioButton().set({
value: false,
appearance: "filter-toggle-button",
label: this.tr("Trash"),
icon: "@FontAwesome5Solid/trash/16",
label: this.tr("Bin"),
icon: "@FontAwesome5Solid/trash-alt/16",
paddingLeft: 10, // align it with the context
});
trashButton.addListener("changeValue", e => {
Expand Down Expand Up @@ -198,7 +198,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {

setTrashEmpty: function(isEmpty) {
this.__trashButton.set({
textColor: isEmpty ? "text" : "danger-red"
icon: isEmpty ? "@FontAwesome5Solid/trash-alt/16" : "@FontAwesome5Solid/trash/16"
});
},
/* /TRASH BIN */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
this.__setWorkspacesToList(workspaces);
if (this.getCurrentContext() === "trash") {
if (workspaces.length) {
this.__header.getChildControl("empty-trash-button").show();
// Not yet implemented
// this.__header.getChildControl("empty-trash-button").show();
}
}
})
Expand Down Expand Up @@ -243,7 +244,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
this.__setFoldersToList(folders);
if (this.getCurrentContext() === "trash") {
if (folders.length) {
this.__header.getChildControl("empty-trash-button").show();
// Not yet implemented
// this.__header.getChildControl("empty-trash-button").show();
}
}
})
Expand Down Expand Up @@ -311,7 +313,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {

if (this.getCurrentContext() === "trash") {
if (this._resourcesList.length) {
this.__header.getChildControl("empty-trash-button").show();
// Not yet implemented
// this.__header.getChildControl("empty-trash-button").show();
}
}

Expand Down Expand Up @@ -470,7 +473,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
osparc.store.Workspaces.getInstance().trashWorkspace(workspaceId)
.then(() => {
this.__reloadWorkspaces();
const msg = this.tr("Successfully moved to Trash");
const msg = this.tr("Successfully moved to Bin");
osparc.FlashMessenger.getInstance().logAs(msg, "INFO");
this._resourceFilter.setTrashEmpty(false);
})
Expand Down Expand Up @@ -608,7 +611,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
osparc.store.Folders.getInstance().trashFolder(folderId, this.getCurrentWorkspaceId())
.then(() => {
this.__reloadFolders();
const msg = this.tr("Successfully moved to Trash");
const msg = this.tr("Successfully moved to Bin");
osparc.FlashMessenger.getInstance().logAs(msg, "INFO");
this._resourceFilter.setTrashEmpty(false);
})
Expand All @@ -620,11 +623,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {

_trashFolderRequested: function(folderId) {
const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays();
let msg = this.tr("Are you sure you want to move the Folder and all its content to the trash?");
let msg = this.tr("Are you sure you want to move the Folder and all its content to the Bin?");
msg += "<br><br>" + this.tr("It will be permanently deleted after ") + trashDays + " days.";
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
caption: this.tr("Move to Trash"),
confirmText: this.tr("Move to Trash"),
caption: this.tr("Move to Bin"),
confirmText: this.tr("Move to Bin"),
confirmAction: "warning",
});
confirmationWin.center();
Expand Down Expand Up @@ -745,6 +748,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
delete reqParams["type"];
delete reqParams["limit"];
delete reqParams["offset"];
delete reqParams["filters"];

const cParams = this.__getRequestParams();
const currentParams = {};
Expand Down Expand Up @@ -1051,17 +1055,17 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {

studiesMoveButton.set({
visibility: selection.length && currentContext === "studiesAndFolders" ? "visible" : "excluded",
label: selection.length > 1 ? this.tr("Move selected")+" ("+selection.length+")" : this.tr("Move")
label: this.tr("Move") + (selection.length > 1 ? this.tr(" selected ") + `(${selection.length})` : ""),
});

studiesTrashButton.set({
visibility: selection.length && currentContext === "studiesAndFolders" ? "visible" : "excluded",
label: selection.length > 1 ? this.tr("Trash selected")+" ("+selection.length+")" : this.tr("Trash")
label: this.tr("Move to Bin") + (selection.length > 1 ? this.tr(" selected ") + `(${selection.length})` : ""),
});

studiesDeleteButton.set({
visibility: selection.length && currentContext === "trash" ? "visible" : "excluded",
label: selection.length > 1 ? this.tr("Delete selected")+" ("+selection.length+")" : this.tr("Delete")
label: this.tr("Delete permamently") + (selection.length > 1 ? this.tr(" selected ") + `(${selection.length})` : ""),
});
});

Expand Down Expand Up @@ -1320,8 +1324,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
},

__createTrashStudiesButton: function() {
const trashButton = new qx.ui.form.Button(this.tr("Trash"), "@FontAwesome5Solid/trash/14").set({
appearance: "danger-button",
const trashButton = new qx.ui.form.Button(this.tr("Move to Bin"), "@FontAwesome5Solid/trash/14").set({
appearance: "warning-button",
visibility: "excluded"
});
osparc.utils.Utils.setIdToWidget(trashButton, "deleteStudiesBtn");
Expand All @@ -1345,7 +1349,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
},

__createDeleteStudiesButton: function() {
const deleteButton = new qx.ui.form.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/14").set({
const deleteButton = new qx.ui.form.Button(this.tr("Delete permanently"), "@FontAwesome5Solid/trash/14").set({
appearance: "danger-button",
visibility: "excluded"
});
Expand Down Expand Up @@ -1828,7 +1832,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
},

__getTrashStudyMenuButton: function(studyData) {
const trashButton = new qx.ui.menu.Button(this.tr("Trash"), "@FontAwesome5Solid/trash/12");
const trashButton = new qx.ui.menu.Button(this.tr("Move to Bin"), "@FontAwesome5Solid/trash/12");
trashButton["trashButton"] = true;
trashButton.set({
appearance: "menu-button"
Expand All @@ -1849,7 +1853,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
},

__getDeleteStudyMenuButton: function(studyData) {
const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12");
const deleteButton = new qx.ui.menu.Button(this.tr("Delete permanently"), "@FontAwesome5Solid/trash/12");
deleteButton["deleteButton"] = true;
deleteButton.set({
appearance: "menu-button"
Expand Down Expand Up @@ -2029,7 +2033,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
osparc.store.Store.getInstance().trashStudy(studyData.uuid)
.then(() => {
this.__removeFromStudyList(studyData.uuid);
const msg = this.tr("Successfully moved to Trash");
const msg = this.tr("Successfully moved to Bin");
osparc.FlashMessenger.getInstance().logAs(msg, "INFO");
this._resourceFilter.setTrashEmpty(false);
})
Expand Down Expand Up @@ -2089,12 +2093,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
} else {
msg += ` '${studyNames[0]}' `;
}
msg += this.tr("to the Trash?");
msg += this.tr("to the Bin?");
const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays();
msg += "<br><br>" + (studyNames.length > 1 ? "They" : "It") + this.tr(` will be permanently deleted after ${trashDays} days.`);
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
caption: this.tr("Move to Trash"),
confirmText: this.tr("Move to Trash"),
caption: this.tr("Move to Bin"),
confirmText: this.tr("Move to Bin"),
confirmAction: "warning",
});
osparc.utils.Utils.setIdToWidget(confirmationWin.getConfirmButton(), "confirmDeleteStudyBtn");
Expand All @@ -2118,7 +2122,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
msg += (studyNames.length > 1 ? ` ${studyNames.length} ${studyAlias}?` : ` <b>${studyNames[0]}</b>?`);
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
caption: this.tr("Delete") + " " + studyAlias,
confirmText: this.tr("Delete"),
confirmText: this.tr("Delete permanently"),
confirmAction: "delete"
});
osparc.utils.Utils.setIdToWidget(confirmationWin.getConfirmButton(), "confirmDeleteStudyBtn");
Expand All @@ -2129,7 +2133,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
const msg = this.tr("Items in the bin will be permanently deleted");
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
caption: this.tr("Delete"),
confirmText: this.tr("Delete forever"),
confirmText: this.tr("Delete permanently"),
confirmAction: "delete"
});
return confirmationWin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", {
break;
}
case "empty-trash-button": {
control = new qx.ui.form.Button(this.tr("Empty Trash"), "@FontAwesome5Solid/trash/14").set({
control = new qx.ui.form.Button(this.tr("Empty Bin"), "@FontAwesome5Solid/trash/14").set({
appearance: "danger-button",
allowGrowY: false,
alignY: "middle",
visibility: "excluded", // Not yet implemented
});
control.addListener("execute", () => this.fireEvent("emptyTrashRequested"));
this._addAt(control, this.self().POS.EMPTY_TRASH_BUTTON);
Expand Down Expand Up @@ -233,7 +234,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", {
const roleWorkspaceLayout = this.getChildControl("role-layout").set({
visibility: "excluded"
});

const description = this.getChildControl("description").set({
visibility: "excluded"
});
Expand Down Expand Up @@ -275,10 +276,10 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", {
break;
case "trash": {
this.__setIcon("@FontAwesome5Solid/trash/20");
title.setValue(this.tr("Trash"));
title.setValue(this.tr("Bin"));
const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays();
description.set({
value: this.tr(`Items in the bin will be permanently deleted after ${trashDays} days.`),
value: this.tr(`Items in the Bin will be permanently deleted after ${trashDays} days.`),
visibility: "visible",
});
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", {

menu.addSeparator();

const trashButton = new qx.ui.menu.Button(this.tr("Trash"), "@FontAwesome5Solid/trash/12");
const trashButton = new qx.ui.menu.Button(this.tr("Move to Bin"), "@FontAwesome5Solid/trash/12");
trashButton.addListener("execute", () => this.__trashWorkspaceRequested(), this);
menu.add(trashButton);
} else if (studyBrowserContext === "trash") {
Expand All @@ -220,7 +220,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", {

menu.addSeparator();

const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12");
const deleteButton = new qx.ui.menu.Button(this.tr("Delete permanently"), "@FontAwesome5Solid/trash/12");
osparc.utils.Utils.setIdToWidget(deleteButton, "deleteWorkspaceMenuItem");
deleteButton.addListener("execute", () => this.__deleteWorkspaceRequested(), this);
menu.add(deleteButton);
Expand Down Expand Up @@ -270,11 +270,11 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", {

__trashWorkspaceRequested: function() {
const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays();
let msg = this.tr("Are you sure you want to move the Workspace and all its content to the trash?");
let msg = this.tr("Are you sure you want to move the Workspace and all its content to the Bin?");
msg += "<br><br>" + this.tr("It will be permanently deleted after ") + trashDays + " days.";
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
caption: this.tr("Move to Trash"),
confirmText: this.tr("Move to Trash"),
caption: this.tr("Move to Bin"),
confirmText: this.tr("Move to Bin"),
confirmAction: "delete"
});
confirmationWin.center();
Expand All @@ -291,7 +291,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", {
msg += "<br>" + this.tr("All the content of the workspace will be deleted.");
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
caption: this.tr("Delete Workspace"),
confirmText: this.tr("Delete"),
confirmText: this.tr("Delete permanently"),
confirmAction: "delete"
});
osparc.utils.Utils.setIdToWidget(confirmationWin.getConfirmButton(), "confirmDeleteWorkspaceButton");
Expand Down
Loading