Skip to content

Commit ea69b41

Browse files
authored
🎨 [Frontend] Show warning message when no personal wallet is found (#8563)
1 parent 65d2a63 commit ea69b41

File tree

18 files changed

+35
-28
lines changed

18 files changed

+35
-28
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
119119
osparc.desktop.MainPageHandler.getInstance().startStudy(studyId);
120120
};
121121

122-
const walletsEnabled = osparc.desktop.credits.Utils.areWalletsEnabled();
122+
const walletsEnabled = osparc.store.StaticInfo.isBillableProduct();
123123
if (walletsEnabled) {
124124
Promise.all([
125125
osparc.store.Study.getInstance().getWallet(studyId),
@@ -767,7 +767,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
767767
const studyAlias = osparc.product.Utils.getStudyAlias({firstUpperCase: true});
768768
this._showLoadingPage(this.tr("Creating ") + (templateData.name || studyAlias));
769769

770-
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
770+
if (osparc.store.StaticInfo.isBillableProduct()) {
771771
const studyOptions = new osparc.study.StudyOptions();
772772
// they will be patched once the study is created
773773
studyOptions.setPatchStudy(false);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
523523
},
524524

525525
__addBillingPage: function() {
526-
if (!osparc.desktop.credits.Utils.areWalletsEnabled()) {
526+
if (!osparc.store.StaticInfo.isBillableProduct()) {
527527
return;
528528
}
529529
if (osparc.utils.Resources.isStudyLike(this.__resourceData) && !osparc.data.model.Study.canIWrite(this.__resourceData["accessRights"])) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
20742074
const studyDataButton = this.__getStudyDataMenuButton(card);
20752075
menu.add(studyDataButton);
20762076

2077-
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
2077+
if (osparc.store.StaticInfo.isBillableProduct()) {
20782078
const billingsSettingsButton = this.__getBillingMenuButton(card);
20792079
menu.add(billingsSettingsButton);
20802080
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ qx.Class.define("osparc.desktop.MainPage", {
6666

6767
const store = osparc.store.Store.getInstance();
6868
const preloadPromises = [];
69-
const walletsEnabled = osparc.desktop.credits.Utils.areWalletsEnabled();
69+
const walletsEnabled = osparc.store.StaticInfo.isBillableProduct();
7070
if (walletsEnabled) {
71-
preloadPromises.push(store.reloadCreditPrice());
72-
preloadPromises.push(store.reloadWallets());
71+
preloadPromises.push(store.fetchCreditPrice());
72+
preloadPromises.push(store.fetchWallets());
7373
}
7474
preloadPromises.push(store.getAllClassifiers(true));
7575
preloadPromises.push(osparc.store.Tags.getInstance().fetchTags());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ qx.Class.define("osparc.desktop.account.MyAccount", {
2929
this.__profilePage = this.__addProfilePage();
3030

3131
// 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()) {
32+
if (!osparc.store.StaticInfo.isBillableProduct()) {
3333
if (osparc.data.Permissions.getInstance().canDo("usage.all.read")) {
3434
this.__usagePage = this.__addUsagePage();
3535
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ qx.Class.define("osparc.desktop.credits.CurrentUsage", {
3939

4040
members: {
4141
__currentStudyChanged: function(currentStudy) {
42-
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
42+
if (osparc.store.StaticInfo.isBillableProduct()) {
4343
if (currentStudy) {
4444
const store = osparc.store.Store.getInstance();
4545
const contextWallet = store.getContextWallet();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ qx.Class.define("osparc.desktop.credits.ResourceInTableViewer", {
122122
}
123123
});
124124

125-
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
125+
if (osparc.store.StaticInfo.isBillableProduct()) {
126126
const store = osparc.store.Store.getInstance();
127127
store.getWallets().forEach(wallet => {
128128
walletSelectBox.add(new qx.ui.form.ListItem(wallet.getName(), null, wallet));
@@ -136,7 +136,7 @@ qx.Class.define("osparc.desktop.credits.ResourceInTableViewer", {
136136
},
137137

138138
_getSelectWalletId: function() {
139-
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
139+
if (osparc.store.StaticInfo.isBillableProduct()) {
140140
const walletSelectBox = this.getChildControl("wallet-selector");
141141
const selectedWallet = walletSelectBox.getSelection()[0].getModel();
142142
return selectedWallet.getWalletId();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ qx.Class.define("osparc.desktop.credits.UsageTable", {
3232

3333
columnModel.setDataCellRenderer(this.self().COLS.COST.column, new qx.ui.table.cellrenderer.Number());
3434

35-
if (!osparc.desktop.credits.Utils.areWalletsEnabled()) {
35+
if (!osparc.store.StaticInfo.isBillableProduct()) {
3636
columnModel.setColumnVisible(this.self().COLS.COST.column, false);
3737
columnModel.setColumnVisible(this.self().COLS.USER.column, false);
3838
}

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ qx.Class.define("osparc.desktop.credits.Utils", {
5050
};
5151
},
5252

53-
areWalletsEnabled: function() {
54-
return Boolean(osparc.store.StaticInfo.getValue("isPaymentEnabled"));
55-
},
56-
5753
getNoWriteAccessInformationLabel: function() {
5854
return new qx.ui.basic.Label().set({
5955
value: qx.locale.Manager.tr("You can't access this information"),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", {
2424

2525
this._setLayout(new qx.ui.layout.VBox(15));
2626

27-
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
27+
if (osparc.store.StaticInfo.isBillableProduct()) {
2828
this.__addCreditsIndicatorSettings();
2929
}
3030

@@ -33,7 +33,7 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", {
3333
this.__addLowDiskSpaceSetting();
3434
}
3535

36-
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
36+
if (osparc.store.StaticInfo.isBillableProduct()) {
3737
this.__addInactivitySetting();
3838
}
3939

0 commit comments

Comments
 (0)