Skip to content

Commit 05eea4b

Browse files
authored
🎨 [Frontend] Enh: Merge Preferences into My Account (#7173)
1 parent 1b17b3d commit 05eea4b

File tree

7 files changed

+54
-154
lines changed

7 files changed

+54
-154
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
419419
appearance: "filter-toggle-button"
420420
});
421421
editTagsButton.addListener("execute", () => {
422-
const preferencesWindow = osparc.desktop.preferences.PreferencesWindow.openWindow();
423-
preferencesWindow.openTags();
422+
const myAccountWindow = osparc.desktop.account.MyAccountWindow.openWindow();
423+
myAccountWindow.openTags();
424424
});
425425
layout.add(editTagsButton);
426426

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

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,20 @@ qx.Class.define("osparc.desktop.account.MyAccount", {
2828

2929
this.__profilePage = this.__addProfilePage();
3030

31-
if (osparc.data.Permissions.getInstance().canDo("usage.all.read")) {
32-
this.__usagePage = this.__addUsagePage();
31+
// show Usage in My Account if wallets are not enabled. If they are enabled it will be in the BIlling Center
32+
if (!osparc.desktop.credits.Utils.areWalletsEnabled()) {
33+
if (osparc.data.Permissions.getInstance().canDo("usage.all.read")) {
34+
this.__usagePage = this.__addUsagePage();
35+
}
36+
}
37+
38+
this.__addGeneralSettings();
39+
this.__addConfirmationSettings();
40+
if (osparc.product.Utils.showPreferencesTokens()) {
41+
this.__addTokensPage();
42+
}
43+
if (osparc.data.Permissions.getInstance().canDo("user.tag")) {
44+
this.__addTagsPage();
3345
}
3446
},
3547

@@ -96,6 +108,7 @@ qx.Class.define("osparc.desktop.account.MyAccount", {
96108
members: {
97109
__profilePage: null,
98110
__usagePage: null,
111+
__tagsPage: null,
99112

100113
__addProfilePage: function() {
101114
const title = this.tr("Profile");
@@ -112,10 +125,39 @@ qx.Class.define("osparc.desktop.account.MyAccount", {
112125
const page = this.addTab(title, iconSrc, usageOverview);
113126
return page;
114127
},
128+
__addGeneralSettings: function() {
129+
const title = this.tr("Settings");
130+
const iconSrc = "@FontAwesome5Solid/cogs/22";
131+
const generalPage = new osparc.desktop.preferences.pages.GeneralPage();
132+
this.addTab(title, iconSrc, generalPage);
133+
},
115134

116-
openProfile: function() {
117-
this._openPage(this.__profilePage);
118-
return true;
119-
}
135+
__addConfirmationSettings: function() {
136+
const title = this.tr("Confirmations");
137+
const iconSrc = "@FontAwesome5Solid/question-circle/22";
138+
const confirmPage = new osparc.desktop.preferences.pages.ConfirmationsPage();
139+
this.addTab(title, iconSrc, confirmPage);
140+
},
141+
142+
__addTokensPage: function() {
143+
const title = this.tr("API Keys/Tokens");
144+
const iconSrc = "@FontAwesome5Solid/exchange-alt/22";
145+
const tokensPage = new osparc.desktop.preferences.pages.TokensPage();
146+
this.addTab(title, iconSrc, tokensPage);
147+
},
148+
149+
__addTagsPage: function() {
150+
const title = this.tr("Create/Edit Tags");
151+
const iconSrc = "@FontAwesome5Solid/tags/22";
152+
const tagsPage = new osparc.desktop.preferences.pages.TagsPage();
153+
const page = this.__tagsPage = this.addTab(title, iconSrc, tagsPage);
154+
osparc.utils.Utils.setIdToWidget(page.getChildControl("button"), "preferencesTagsTabBtn");
155+
},
156+
157+
openTags: function() {
158+
if (this.__tagsPage) {
159+
this._openPage(this.__tagsPage);
160+
}
161+
},
120162
}
121163
});

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ qx.Class.define("osparc.desktop.account.MyAccountWindow", {
2121
construct: function() {
2222
this.base(arguments, "credits", this.tr("My Account"));
2323

24-
const width = 900;
24+
const width = 990;
2525
const height = 700;
2626
const maxHeight = 700;
2727
this.set({
@@ -46,8 +46,8 @@ qx.Class.define("osparc.desktop.account.MyAccountWindow", {
4646
members: {
4747
__myAccount: null,
4848

49-
openProfile: function() {
50-
return this.__myAccount.openProfile();
51-
}
49+
openTags: function() {
50+
this.__myAccount.openTags();
51+
},
5252
}
5353
});

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

Lines changed: 0 additions & 73 deletions
This file was deleted.

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

Lines changed: 0 additions & 54 deletions
This file was deleted.

services/static-webserver/client/source/class/osparc/navigation/UserMenu.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ qx.Class.define("osparc.navigation.UserMenu", {
7777
}, this);
7878
this.add(control);
7979
break;
80-
case "preferences":
81-
control = new qx.ui.menu.Button(this.tr("Preferences"));
82-
control.addListener("execute", () => osparc.navigation.UserMenuButton.openPreferences(), this);
83-
osparc.utils.Utils.setIdToWidget(control, "userMenuPreferencesBtn");
84-
this.add(control);
85-
break;
8680
case "organizations":
8781
control = new qx.ui.menu.Button(this.tr("Organizations")).set({
8882
visibility: osparc.data.Permissions.getInstance().canDo("user.organizations.create") ? "visible" :"excluded"
@@ -162,7 +156,6 @@ qx.Class.define("osparc.navigation.UserMenu", {
162156
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
163157
this.getChildControl("billing-center");
164158
}
165-
this.getChildControl("preferences");
166159
this.getChildControl("organizations");
167160
}
168161
this.addSeparator();
@@ -217,7 +210,6 @@ qx.Class.define("osparc.navigation.UserMenu", {
217210
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
218211
this.getChildControl("billing-center");
219212
}
220-
this.getChildControl("preferences");
221213
this.getChildControl("organizations");
222214
}
223215
this.addSeparator();

services/static-webserver/client/source/class/osparc/navigation/UserMenuButton.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@ qx.Class.define("osparc.navigation.UserMenuButton", {
7070
});
7171
},
7272

73-
statics: {
74-
openPreferences: function() {
75-
const preferencesWindow = osparc.desktop.preferences.PreferencesWindow.openWindow();
76-
return preferencesWindow;
77-
}
78-
},
79-
8073
members: {
8174
__forceNullColor: null,
8275

0 commit comments

Comments
 (0)