Skip to content

Commit 3b872d0

Browse files
committed
Folder toTtrash: ask for confirmation
1 parent 5494956 commit 3b872d0

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

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

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
272272
menu.addSeparator();
273273

274274
const trashButton = new qx.ui.menu.Button(this.tr("Trash"), "@FontAwesome5Solid/trash/12");
275-
trashButton.addListener("execute", () => this.__trashFolderRequested(), this);
275+
trashButton.addListener("execute", () => this.fireDataEvent("trashFolderRequested", this.getFolderId()), this);
276276
menu.add(trashButton);
277277
} else if (studyBrowserContext === "trash") {
278278
const restoreButton = new qx.ui.menu.Button(this.tr("Restore"), "@MaterialIcons/restore_from_trash/16");
@@ -325,24 +325,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
325325
folderEditor.addListener("cancel", () => win.close());
326326
},
327327

328-
__trashFolderRequested: function() {
329-
const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays();
330-
let msg = this.tr("Are you sure you want to move the Folder and all its content to the trash?");
331-
msg += "<br><br>" + this.tr("It will be permanently deleted after ") + trashDays + " days.";
332-
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
333-
caption: this.tr("Move to Trash"),
334-
confirmText: this.tr("Move to Trash"),
335-
confirmAction: "delete"
336-
});
337-
confirmationWin.center();
338-
confirmationWin.open();
339-
confirmationWin.addListener("close", () => {
340-
if (confirmationWin.getConfirmed()) {
341-
this.fireDataEvent("trashFolderRequested", this.getFolderId());
342-
}
343-
}, this);
344-
},
345-
346328
__deleteFolderRequested: function() {
347329
const msg = this.tr("Are you sure you want to delete") + " <b>" + this.getTitle() + "</b>?";
348330
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
606606
this.__doMoveFolder(folderId, destWorkspaceId, destFolderId);
607607
},
608608

609-
_trashFolderRequested: function(folderId) {
609+
__folderToTrash: function(folderId) {
610610
osparc.store.Folders.getInstance().trashFolder(folderId, this.getCurrentWorkspaceId())
611611
.then(() => {
612612
this.__reloadFolders();
@@ -620,6 +620,24 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
620620
})
621621
},
622622

623+
_trashFolderRequested: function(folderId) {
624+
const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays();
625+
let msg = this.tr("Are you sure you want to move the Folder and all its content to the trash?");
626+
msg += "<br><br>" + this.tr("It will be permanently deleted after ") + trashDays + " days.";
627+
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
628+
caption: this.tr("Move to Trash"),
629+
confirmText: this.tr("Move to Trash"),
630+
confirmAction: "delete"
631+
});
632+
confirmationWin.center();
633+
confirmationWin.open();
634+
confirmationWin.addListener("close", () => {
635+
if (confirmationWin.getConfirmed()) {
636+
this.__folderToTrash(folderId);
637+
}
638+
}, this);
639+
},
640+
623641
_untrashFolderRequested: function(folder) {
624642
osparc.store.Folders.getInstance().untrashFolder(folder)
625643
.then(() => {

0 commit comments

Comments
 (0)