Skip to content

Commit 5f26f2a

Browse files
authored
Merge branch 'master' into 2025/upgrade/postgres
2 parents f53b3f8 + f0212cb commit 5f26f2a

File tree

13 files changed

+200
-157
lines changed

13 files changed

+200
-157
lines changed

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

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
148148
return false;
149149
},
150150

151-
populateShareIcon: async function(shareIcon, accessRights) {
151+
populateShareIcon: function(shareIcon, accessRights) {
152152
const gids = Object.keys(accessRights).map(key => parseInt(key));
153153

154154
const groupsStore = osparc.store.Groups.getInstance();
@@ -169,6 +169,17 @@ qx.Class.define("osparc.dashboard.CardBase", {
169169
}
170170

171171
// Tooltip
172+
const canIWrite = osparc.data.model.Study.canIWrite(accessRights);
173+
const myGroupId = groupsStore.getMyGroupId();
174+
if (gids.length === 0 || (gids.length === 1 && gids[0] === myGroupId)) {
175+
if (canIWrite) {
176+
shareIcon.set({
177+
toolTipText: qx.locale.Manager.tr("Share")
178+
});
179+
}
180+
return;
181+
}
182+
172183
const sharedGrps = [];
173184
const groups = [];
174185
groups.push(groupEveryone);
@@ -181,43 +192,44 @@ qx.Class.define("osparc.dashboard.CardBase", {
181192
gids.splice(idx, 1);
182193
}
183194
});
184-
// once the groups were removed, the remaining group ids are users' primary groups ids
185-
const usersStore = osparc.store.Users.getInstance();
186-
const myGroupId = groupsStore.getMyGroupId();
187-
for (let i=0; i<gids.length; i++) {
188-
const gid = gids[i];
189-
if (myGroupId !== gid) {
190-
const user = await usersStore.getUser(gid);
191-
if (user) {
192-
sharedGrps.push(user);
195+
196+
const hint = new osparc.ui.hint.Hint(shareIcon);
197+
shareIcon.addListener("mouseover", async () => {
198+
hint.show();
199+
200+
// lazy load tooltip, this can be an expensive call
201+
202+
// once the groups were removed, the remaining group ids are users' primary groups ids
203+
const usersStore = osparc.store.Users.getInstance();
204+
for (let i=0; i<gids.length; i++) {
205+
const gid = gids[i];
206+
if (myGroupId !== gid) {
207+
const user = await usersStore.getUser(gid);
208+
if (user) {
209+
sharedGrps.push(user);
210+
}
193211
}
194212
}
195-
}
196213

197-
const canIWrite = osparc.data.model.Study.canIWrite(accessRights);
198-
if (sharedGrps.length === 0) {
199-
if (canIWrite) {
200-
shareIcon.set({
201-
toolTipText: qx.locale.Manager.tr("Share")
202-
});
203-
}
204-
return;
205-
}
206-
const sharedGrpLabels = [];
207-
const maxItems = 6;
208-
for (let i=0; i<sharedGrps.length; i++) {
209-
if (i > maxItems) {
210-
sharedGrpLabels.push("...");
211-
break;
212-
}
213-
const sharedGrpLabel = sharedGrps[i].getLabel();
214-
if (!sharedGrpLabels.includes(sharedGrpLabel)) {
215-
sharedGrpLabels.push(sharedGrpLabel);
214+
if (hint.getText() === "") {
215+
const sharedGrpLabels = [];
216+
const maxItems = 6;
217+
for (let i=0; i<sharedGrps.length; i++) {
218+
if (i > maxItems) {
219+
sharedGrpLabels.push("...");
220+
break;
221+
}
222+
const sharedGrpLabel = sharedGrps[i].getLabel();
223+
if (!sharedGrpLabels.includes(sharedGrpLabel)) {
224+
sharedGrpLabels.push(sharedGrpLabel);
225+
}
226+
}
227+
const hintText = sharedGrpLabels.join("<br>");
228+
if (hintText) {
229+
hint.setText(hintText);
230+
}
216231
}
217-
}
218-
const hintText = sharedGrpLabels.join("<br>");
219-
const hint = new osparc.ui.hint.Hint(shareIcon, hintText);
220-
shareIcon.addListener("mouseover", () => hint.show(), this);
232+
}, this);
221233
shareIcon.addListener("mouseout", () => hint.exclude(), this);
222234
},
223235
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
271271

272272
menu.addSeparator();
273273

274-
const trashButton = new qx.ui.menu.Button(this.tr("Trash"), "@FontAwesome5Solid/trash/12");
274+
const trashButton = new qx.ui.menu.Button(this.tr("Move to Bin"), "@FontAwesome5Solid/trash/12");
275275
trashButton.addListener("execute", () => this.fireDataEvent("trashFolderRequested", this.getFolderId()), this);
276276
menu.add(trashButton);
277277
} else if (studyBrowserContext === "trash") {
@@ -329,7 +329,7 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
329329
const msg = this.tr("Are you sure you want to delete") + " <b>" + this.getTitle() + "</b>?";
330330
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
331331
caption: this.tr("Delete Folder"),
332-
confirmText: this.tr("Delete"),
332+
confirmText: this.tr("Delete permanently"),
333333
confirmAction: "delete"
334334
});
335335
osparc.utils.Utils.setIdToWidget(confirmationWin.getConfirmButton(), "confirmDeleteFolderButton");

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
105105
const trashButton = this.__trashButton = new qx.ui.toolbar.RadioButton().set({
106106
value: false,
107107
appearance: "filter-toggle-button",
108-
label: this.tr("Trash"),
109-
icon: "@FontAwesome5Solid/trash/16",
108+
label: this.tr("Bin"),
109+
icon: "@FontAwesome5Solid/trash-alt/16",
110110
paddingLeft: 10, // align it with the context
111111
});
112112
trashButton.addListener("changeValue", e => {
@@ -198,7 +198,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
198198

199199
setTrashEmpty: function(isEmpty) {
200200
this.__trashButton.set({
201-
textColor: isEmpty ? "text" : "danger-red"
201+
icon: isEmpty ? "@FontAwesome5Solid/trash-alt/16" : "@FontAwesome5Solid/trash/16"
202202
});
203203
},
204204
/* /TRASH BIN */

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

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
197197
this.__setWorkspacesToList(workspaces);
198198
if (this.getCurrentContext() === "trash") {
199199
if (workspaces.length) {
200-
this.__header.getChildControl("empty-trash-button").show();
200+
// Not yet implemented
201+
// this.__header.getChildControl("empty-trash-button").show();
201202
}
202203
}
203204
})
@@ -243,7 +244,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
243244
this.__setFoldersToList(folders);
244245
if (this.getCurrentContext() === "trash") {
245246
if (folders.length) {
246-
this.__header.getChildControl("empty-trash-button").show();
247+
// Not yet implemented
248+
// this.__header.getChildControl("empty-trash-button").show();
247249
}
248250
}
249251
})
@@ -311,7 +313,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
311313

312314
if (this.getCurrentContext() === "trash") {
313315
if (this._resourcesList.length) {
314-
this.__header.getChildControl("empty-trash-button").show();
316+
// Not yet implemented
317+
// this.__header.getChildControl("empty-trash-button").show();
315318
}
316319
}
317320

@@ -470,7 +473,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
470473
osparc.store.Workspaces.getInstance().trashWorkspace(workspaceId)
471474
.then(() => {
472475
this.__reloadWorkspaces();
473-
const msg = this.tr("Successfully moved to Trash");
476+
const msg = this.tr("Successfully moved to Bin");
474477
osparc.FlashMessenger.getInstance().logAs(msg, "INFO");
475478
this._resourceFilter.setTrashEmpty(false);
476479
})
@@ -608,7 +611,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
608611
osparc.store.Folders.getInstance().trashFolder(folderId, this.getCurrentWorkspaceId())
609612
.then(() => {
610613
this.__reloadFolders();
611-
const msg = this.tr("Successfully moved to Trash");
614+
const msg = this.tr("Successfully moved to Bin");
612615
osparc.FlashMessenger.getInstance().logAs(msg, "INFO");
613616
this._resourceFilter.setTrashEmpty(false);
614617
})
@@ -620,11 +623,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
620623

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

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

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

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

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

@@ -1320,8 +1324,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
13201324
},
13211325

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

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

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

18511855
__getDeleteStudyMenuButton: function(studyData) {
1852-
const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12");
1856+
const deleteButton = new qx.ui.menu.Button(this.tr("Delete permanently"), "@FontAwesome5Solid/trash/12");
18531857
deleteButton["deleteButton"] = true;
18541858
deleteButton.set({
18551859
appearance: "menu-button"
@@ -2029,7 +2033,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
20292033
osparc.store.Store.getInstance().trashStudy(studyData.uuid)
20302034
.then(() => {
20312035
this.__removeFromStudyList(studyData.uuid);
2032-
const msg = this.tr("Successfully moved to Trash");
2036+
const msg = this.tr("Successfully moved to Bin");
20332037
osparc.FlashMessenger.getInstance().logAs(msg, "INFO");
20342038
this._resourceFilter.setTrashEmpty(false);
20352039
})
@@ -2089,12 +2093,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
20892093
} else {
20902094
msg += ` '${studyNames[0]}' `;
20912095
}
2092-
msg += this.tr("to the Trash?");
2096+
msg += this.tr("to the Bin?");
20932097
const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays();
20942098
msg += "<br><br>" + (studyNames.length > 1 ? "They" : "It") + this.tr(` will be permanently deleted after ${trashDays} days.`);
20952099
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
2096-
caption: this.tr("Move to Trash"),
2097-
confirmText: this.tr("Move to Trash"),
2100+
caption: this.tr("Move to Bin"),
2101+
confirmText: this.tr("Move to Bin"),
20982102
confirmAction: "warning",
20992103
});
21002104
osparc.utils.Utils.setIdToWidget(confirmationWin.getConfirmButton(), "confirmDeleteStudyBtn");
@@ -2118,7 +2122,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21182122
msg += (studyNames.length > 1 ? ` ${studyNames.length} ${studyAlias}?` : ` <b>${studyNames[0]}</b>?`);
21192123
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
21202124
caption: this.tr("Delete") + " " + studyAlias,
2121-
confirmText: this.tr("Delete"),
2125+
confirmText: this.tr("Delete permanently"),
21222126
confirmAction: "delete"
21232127
});
21242128
osparc.utils.Utils.setIdToWidget(confirmationWin.getConfirmButton(), "confirmDeleteStudyBtn");
@@ -2129,7 +2133,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21292133
const msg = this.tr("Items in the bin will be permanently deleted");
21302134
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
21312135
caption: this.tr("Delete"),
2132-
confirmText: this.tr("Delete forever"),
2136+
confirmText: this.tr("Delete permanently"),
21332137
confirmAction: "delete"
21342138
});
21352139
return confirmationWin;

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,11 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", {
193193
break;
194194
}
195195
case "empty-trash-button": {
196-
control = new qx.ui.form.Button(this.tr("Empty Trash"), "@FontAwesome5Solid/trash/14").set({
196+
control = new qx.ui.form.Button(this.tr("Empty Bin"), "@FontAwesome5Solid/trash/14").set({
197197
appearance: "danger-button",
198198
allowGrowY: false,
199199
alignY: "middle",
200+
visibility: "excluded", // Not yet implemented
200201
});
201202
control.addListener("execute", () => this.fireEvent("emptyTrashRequested"));
202203
this._addAt(control, this.self().POS.EMPTY_TRASH_BUTTON);
@@ -233,7 +234,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", {
233234
const roleWorkspaceLayout = this.getChildControl("role-layout").set({
234235
visibility: "excluded"
235236
});
236-
237+
237238
const description = this.getChildControl("description").set({
238239
visibility: "excluded"
239240
});
@@ -275,10 +276,10 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", {
275276
break;
276277
case "trash": {
277278
this.__setIcon("@FontAwesome5Solid/trash/20");
278-
title.setValue(this.tr("Trash"));
279+
title.setValue(this.tr("Bin"));
279280
const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays();
280281
description.set({
281-
value: this.tr(`Items in the bin will be permanently deleted after ${trashDays} days.`),
282+
value: this.tr(`Items in the Bin will be permanently deleted after ${trashDays} days.`),
282283
visibility: "visible",
283284
});
284285
break;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", {
210210

211211
menu.addSeparator();
212212

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

221221
menu.addSeparator();
222222

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

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

0 commit comments

Comments
 (0)