Skip to content

Commit 7c68dc8

Browse files
authored
🎨 [Frontend] UX: Disable Delete button (#8082)
1 parent 4c5a0f3 commit 7c68dc8

File tree

6 files changed

+40
-22
lines changed

6 files changed

+40
-22
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
10641064

10651065
openData: function() {
10661066
const resourceData = this.getResourceData();
1067-
osparc.widget.StudyDataManager.popUpInWindow(resourceData["uuid"]);
1067+
osparc.widget.StudyDataManager.popUpInWindow(resourceData);
10681068
},
10691069

10701070
openBilling: function() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
924924
gap: 14,
925925
cursor: "pointer",
926926
});
927-
dataAccess.addListener("tap", () => osparc.widget.StudyDataManager.popUpInWindow(resourceData["uuid"], null, title));
927+
dataAccess.addListener("tap", () => osparc.widget.StudyDataManager.popUpInWindow(resourceData, null, title));
928928
this.addWidgetToTabs(dataAccess);
929929

930930
if (resourceData["resourceType"] === "study") {

services/static-webserver/client/source/class/osparc/desktop/WorkbenchView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
5555
},
5656

5757
openNodeDataManager: function(node) {
58-
const win = osparc.widget.StudyDataManager.popUpInWindow(node.getStudy().getUuid(), node.getNodeId(), node.getLabel());
58+
const win = osparc.widget.StudyDataManager.popUpInWindow(node.getStudy().serialize(), node.getNodeId(), node.getLabel());
5959
const closeBtn = win.getChildControl("close-button");
6060
osparc.utils.Utils.setIdToWidget(closeBtn, "nodeDataManagerCloseBtn");
6161
}

services/static-webserver/client/source/class/osparc/file/FileLabelWithActions.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
6565
event: "changeMultiSelect",
6666
apply: "__changeMultiSelection",
6767
},
68+
69+
deleteEnabled: {
70+
check: "Boolean",
71+
init: true,
72+
nullable: true,
73+
apply: "__applyDeleteEnabled",
74+
},
6875
},
6976

7077
members: {
@@ -106,11 +113,17 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
106113
}
107114
},
108115

116+
__applyDeleteEnabled: function(value) {
117+
if (value === false) {
118+
this.getChildControl("delete-button").setEnabled(false);
119+
}
120+
},
121+
109122
setItemSelected: function(selectedItem) {
110123
if (selectedItem) {
111124
this.__selection = [selectedItem];
112-
this.getChildControl("download-button").setEnabled(true); // folders can also be downloaded
113-
this.getChildControl("delete-button").setEnabled(true); // folders can also be deleted
125+
this.getChildControl("download-button").setEnabled(true);
126+
this.getChildControl("delete-button").setEnabled(this.isDeleteEnabled());
114127
this.getChildControl("selected-label").setValue(selectedItem.getLabel());
115128
} else {
116129
this.resetSelection();
@@ -136,7 +149,7 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
136149
resetSelection: function() {
137150
this.__selection = [];
138151
this.getChildControl("download-button").setEnabled(false);
139-
this.getChildControl("delete-button").setEnabled(false);
152+
this.getChildControl("delete-button").setEnabled(this.isDeleteEnabled());
140153
this.getChildControl("selected-label").resetValue();
141154
},
142155

services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
1919
showMaximize: false,
2020
autoDestroy: true,
2121
modal: true,
22-
width: 330,
22+
width: 430,
2323
maxHeight: 500,
2424
clickAwayClose: true
2525
});
@@ -76,9 +76,9 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
7676
switch (id) {
7777
case "intro-text": {
7878
let text = this.__showOrganizations ?
79-
this.tr("Select users or organizations from the list below.") :
80-
this.tr("Select users from the list below.");
81-
text += this.tr("<br>Search them if they aren't listed.");
79+
this.tr("Select organizations or users from the list or search by name, username or email.") :
80+
this.tr("Select users from the list or search by name, username or email.");
81+
text += "<br>" + this.tr("Keep in mind that users are only searchable based on the information they've chosen to make visible. To make yourself easier to find, adjust your visibility settings in My Account → Privacy.");
8282
control = new qx.ui.basic.Label().set({
8383
value: text,
8484
rich: true,

services/static-webserver/client/source/class/osparc/widget/StudyDataManager.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ qx.Class.define("osparc.widget.StudyDataManager", {
3434
extend: qx.ui.core.Widget,
3535

3636
/**
37-
* @param studyId {String} StudyId
37+
* @param studyData {Object} Study Data
3838
* @param nodeId {String} NodeId
3939
*/
40-
construct: function(studyId, nodeId) {
40+
construct: function(studyData, nodeId) {
4141
this.base(arguments);
4242

4343
this._setLayout(new qx.ui.layout.VBox(10));
4444

45-
this.setStudyId(studyId);
45+
this.setStudyData(studyData);
4646

4747
if (nodeId) {
4848
this.setNodeId(nodeId);
@@ -53,8 +53,8 @@ qx.Class.define("osparc.widget.StudyDataManager", {
5353
},
5454

5555
statics: {
56-
popUpInWindow: function(studyId, nodeId, title) {
57-
const studyDataManager = new osparc.widget.StudyDataManager(studyId, nodeId);
56+
popUpInWindow: function(studyData, nodeId, title) {
57+
const studyDataManager = new osparc.widget.StudyDataManager(studyData, nodeId);
5858
if (!title) {
5959
title = osparc.product.Utils.getStudyAlias({firstUpperCase: true}) + qx.locale.Manager.tr(" Files");
6060
}
@@ -63,8 +63,8 @@ qx.Class.define("osparc.widget.StudyDataManager", {
6363
},
6464

6565
properties: {
66-
studyId: {
67-
check: "String",
66+
studyData: {
67+
check: "Object",
6868
init: null,
6969
nullable: false
7070
},
@@ -82,6 +82,10 @@ qx.Class.define("osparc.widget.StudyDataManager", {
8282
switch (id) {
8383
case "tree-folder-view":
8484
control = new osparc.file.TreeFolderView();
85+
control
86+
.getChildControl("folder-viewer")
87+
.getChildControl("selected-file-layout")
88+
.setDeleteEnabled(osparc.data.model.Study.canIDelete(this.getStudyData()["accessRights"]));
8589
this._add(control, {
8690
flex: 1
8791
});
@@ -102,14 +106,15 @@ qx.Class.define("osparc.widget.StudyDataManager", {
102106
__reloadTree: function() {
103107
const treeFolderView = this.getChildControl("tree-folder-view");
104108

109+
const studyId = this.getStudyData()["uuid"];
105110
const foldersTree = treeFolderView.getChildControl("folder-tree");
106111
foldersTree.resetCache();
107112
if (this.getNodeId()) {
108-
foldersTree.populateNodeTree(this.getStudyId(), this.getNodeId());
109-
treeFolderView.requestSize(this.getStudyId(), this.getNodeId());
110-
} else if (this.getStudyId()) {
111-
foldersTree.populateStudyTree(this.getStudyId());
112-
treeFolderView.requestSize(this.getStudyId());
113+
foldersTree.populateNodeTree(studyId, this.getNodeId());
114+
treeFolderView.requestSize(studyId, this.getNodeId());
115+
} else if (studyId) {
116+
foldersTree.populateStudyTree(studyId);
117+
treeFolderView.requestSize(studyId);
113118
}
114119

115120
const folderViewer = treeFolderView.getChildControl("folder-viewer");

0 commit comments

Comments
 (0)