Skip to content

Commit

Permalink
🎨 Notification in bell: "you don't have access anymore" (#4558)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Jul 28, 2023
1 parent ecf6f9a commit 52ca6b4
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,17 @@ qx.Class.define("osparc.component.notification.NotificationUI", {
case "NEW_ORGANIZATION": {
const items = actionablePath.split("/");
const orgId = items.pop();
const orgsWindow = osparc.desktop.organizations.OrganizationsWindow.openWindow();
orgsWindow.openOrganizationDetails(parseInt(orgId));
// make sure org is available
osparc.store.Store.getInstance().getGroup(orgId)
.then(org => {
if (org) {
const orgsWindow = osparc.desktop.organizations.OrganizationsWindow.openWindow();
orgsWindow.openOrganizationDetails(parseInt(orgId));
} else {
const msg = this.tr("You don't have access anymore");
osparc.component.message.FlashMessenger.getInstance().logAs(msg, "WARNING");
}
});
break;
}
case "TEMPLATE_SHARED":
Expand All @@ -209,6 +218,11 @@ qx.Class.define("osparc.component.notification.NotificationUI", {
const win = osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts);
moreOpts.addListener("openingStudy", () => win.close());
}
})
.catch(err => {
console.error(err);
const msg = this.tr("You don't have access anymore");
osparc.component.message.FlashMessenger.getInstance().logAs(msg, "WARNING");
});
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ qx.Class.define("osparc.component.widget.PreparingInputs", {
const fetching = [
"PUBLISHED",
"PENDING",
"STARTED",
"WAITING_FOR_RESOURCES"
"WAITING_FOR_RESOURCES",
"STARTED"
].includes(nodeRunningStatus);
rerunBtn.setFetching(fetching);
const rerunnable = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,7 @@ qx.Class.define("osparc.data.Resources", {
},

getWallets: function() {
const myGid = osparc.auth.Data.getInstance().getGroupId();
return new Promise(resolve => {
resolve({
wallets: [{
Expand All @@ -1142,9 +1143,9 @@ qx.Class.define("osparc.data.Resources", {
description: "Personal Wallet",
thumbnail: null,
type: "personal",
owner: 2,
owner: myGid,
accessRights: {
2: {
[myGid]: {
delete: true,
write: true,
read: true
Expand All @@ -1160,14 +1161,14 @@ qx.Class.define("osparc.data.Resources", {
description: "Organization wide Wallet",
thumbnail: null,
type: "shared",
owner: 2,
owner: myGid,
accessRights: {
2: {
[myGid]: {
delete: false,
write: true,
read: true
},
10: {
417: {
delete: false,
write: false,
read: true
Expand All @@ -1183,21 +1184,16 @@ qx.Class.define("osparc.data.Resources", {
description: "Organization wide Wallet 2",
thumbnail: null,
type: "shared",
owner: 4,
owner: 417,
accessRights: {
2: {
delete: false,
write: false,
read: true
},
10: {
delete: false,
417: {
delete: true,
write: true,
read: true
},
11: {
delete: true,
write: true,
[myGid]: {
delete: false,
write: false,
read: true
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ qx.Class.define("osparc.data.model.NodeStatus", {
},

running: {
check: ["UNKNOWN", "NOT_STARTED", "PUBLISHED", "PENDING", "STARTED", "RETRY", "SUCCESS", "FAILED", "ABORTED", "WAITING_FOR_RESOURCES"],
check: ["UNKNOWN", "NOT_STARTED", "PUBLISHED", "PENDING", "WAITING_FOR_RESOURCES", "STARTED", "RETRY", "SUCCESS", "FAILED", "ABORTED"],
nullable: true,
init: null,
event: "changeRunning",
Expand Down Expand Up @@ -117,7 +117,7 @@ qx.Class.define("osparc.data.model.NodeStatus", {

isComputationalRunning(node) {
if (node && node.isComputational()) {
return ["PUBLISHED", "PENDING", "STARTED", "WAITING_FOR_RESOURCES"].includes(node.getStatus().getRunning());
return ["PUBLISHED", "PENDING", "WAITING_FOR_RESOURCES", "STARTED"].includes(node.getStatus().getRunning());
}
return false;
},
Expand Down Expand Up @@ -177,7 +177,7 @@ qx.Class.define("osparc.data.model.NodeStatus", {
const hasOutputs = this.getHasOutputs();
const modified = this.getModified();
const hasDependencies = this.hasDependencies();
if (["PUBLISHED", "PENDING", "STARTED", "WAITING_FOR_RESOURCES"].includes(compRunning)) {
if (["PUBLISHED", "PENDING", "WAITING_FOR_RESOURCES", "STARTED"].includes(compRunning)) {
this.setOutput("busy");
} else if ([null, false].includes(hasOutputs)) {
this.setOutput("not-available");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ qx.Class.define("osparc.data.model.Study", {
return [
"PUBLISHED",
"PENDING",
"WAITING_FOR_RESOURCES",
"STARTED",
"RETRY",
"WAITING_FOR_RESOURCES"
"RETRY"
].includes(state);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,12 @@ qx.Class.define("osparc.desktop.credits.BuyCredits", {

walletSelector.addListener("changeSelection", e => {
const selection = e.getData();
const store = osparc.store.Store.getInstance();
const found = store.getWallets().find(wallet => wallet.getWalletId() === parseInt(selection[0].walletId));
if (found) {
this.setWallet(found);
if (selection.length) {
const store = osparc.store.Store.getInstance();
const found = store.getWallets().find(wallet => wallet.getWalletId() === parseInt(selection[0].walletId));
if (found) {
this.setWallet(found);
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ qx.Class.define("osparc.ui.basic.NodeStatusUI", {
converter: state => {
if (state) {
this.show();
const labelValue = osparc.utils.StatusUI.getLabelValue(state);
let labelValue = osparc.utils.StatusUI.getLabelValue(state);
labelValue = labelValue.replaceAll("_", " ");
return qx.lang.String.firstUp(labelValue.toLowerCase());
}
this.exclude();
Expand All @@ -83,11 +84,11 @@ qx.Class.define("osparc.ui.basic.NodeStatusUI", {
osparc.utils.Utils.removeClass(this.getChildControl("icon").getContentElement(), "rotate");
target.setTextColor(osparc.utils.StatusUI.getColor(state));
return;
case "PENDING":
case "PUBLISHED":
case "PENDING":
case "WAITING_FOR_RESOURCES":
case "STARTED":
case "RETRY":
case "WAITING_FOR_RESOURCES":
osparc.utils.Utils.addClass(this.getChildControl("icon").getContentElement(), "rotate");
target.setTextColor(osparc.utils.StatusUI.getColor(state));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ qx.Class.define("osparc.utils.StatusUI", {
return "";
case "PUBLISHED":
case "PENDING":
case "WAITING_FOR_RESOURCES":
case "STARTED":
case "RETRY":
case "WAITING_FOR_RESOURCES":
return "@FontAwesome5Solid/circle-notch/"+size;
case "SUCCESS":
return "@FontAwesome5Solid/check/"+size;
Expand Down Expand Up @@ -154,9 +154,9 @@ qx.Class.define("osparc.utils.StatusUI", {
return "ready-green";
case "PUBLISHED":
case "PENDING":
case "WAITING_FOR_RESOURCES":
case "STARTED":
case "RETRY":
case "WAITING_FOR_RESOURCES":
return "busy-orange";
case "FAILED":
case "ABORTED":
Expand Down Expand Up @@ -208,9 +208,9 @@ qx.Class.define("osparc.utils.StatusUI", {
return "border-error";
case "PUBLISHED":
case "PENDING":
case "WAITING_FOR_RESOURCES":
case "STARTED":
case "RETRY":
case "WAITING_FOR_RESOURCES":
return "border-busy";
case "UNKNOWN":
case "NOT_STARTED":
Expand Down

0 comments on commit 52ca6b4

Please sign in to comment.