Skip to content

Commit bfac718

Browse files
committed
minor
1 parent c1905f9 commit bfac718

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,24 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
157157
}
158158
});
159159
} else {
160-
openStudy();
160+
// Check if I have access to the current wallet. If I don't, I won't be able to open it
161+
const found = osparc.store.Store.getInstance().getWallets().find(w => w.getWalletId() === wallet["walletId"]);
162+
if (found) {
163+
// switch to the wallet and inform the user
164+
if (osparc.store.Store.getInstance().getContextWallet() !== found) {
165+
const text = qx.locale.Manager.tr("Switched to Credit Account") + " '" + found.getName() + "'";
166+
osparc.FlashMessenger.logAs(text);
167+
}
168+
osparc.store.Store.getInstance().setActiveWallet(found);
169+
openStudy();
170+
} else {
171+
// cancel and explain the user why
172+
const msg = qx.locale.Manager.tr("You can't join the project because you don't have access to the Credit Account associated with it. Please contact the project owner.");
173+
osparc.FlashMessenger.logAs(msg, "ERROR");
174+
if (cancelCB) {
175+
cancelCB();
176+
}
177+
}
161178
}
162179
});
163180
} else {
@@ -203,7 +220,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
203220
let openText = qx.locale.Manager.tr("New") + " " + studyAlias;
204221
if (resourceData["resourceType"] === "study") {
205222
// if it's in use call it join
206-
if (osparc.study.Utils.state.getCurrentGroupIds(resourceData["state"])) {
223+
if (osparc.study.Utils.state.getCurrentGroupIds(resourceData["state"]).length) {
207224
openText = qx.locale.Manager.tr("Join");
208225
} else {
209226
openText = qx.locale.Manager.tr("Open");

0 commit comments

Comments
 (0)