Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Wallets: Update Status required #4592

Merged
merged 46 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
19ce282
adapt to new model
odeimaiz Aug 2, 2023
480bd56
more adaptations
odeimaiz Aug 2, 2023
d38eb47
walletTyoe out
odeimaiz Aug 2, 2023
4576c90
minors
odeimaiz Aug 2, 2023
70a2c01
[skip ci] minor
odeimaiz Aug 2, 2023
c1695a2
default thumbnail
odeimaiz Aug 2, 2023
b0f8cb5
wallets and access rights
odeimaiz Aug 2, 2023
15be2f8
loadWallets in Store
odeimaiz Aug 2, 2023
6ab985c
getWalletAccessRights
odeimaiz Aug 2, 2023
a17e2c7
Merge branch 'master' into feature/wallet-fe-ii
odeimaiz Aug 3, 2023
1deca24
Merge branch 'master' into feature/wallet-fe-ii
odeimaiz Aug 4, 2023
fc025eb
Merge branch 'master' into feature/wallet-fe-ii
odeimaiz Aug 4, 2023
16a17c6
Merge branch 'master' into feature/wallet-fe-ii
odeimaiz Aug 7, 2023
082cead
fix https://github.com/ITISFoundation/osparc-issues/issues/1050
odeimaiz Aug 7, 2023
114e2c5
call backend
odeimaiz Aug 7, 2023
1e520ee
minor
odeimaiz Aug 7, 2023
0302d3c
accessRights is an array
odeimaiz Aug 7, 2023
c933a40
access rights is an array II
odeimaiz Aug 7, 2023
110199a
minor
odeimaiz Aug 7, 2023
edf6b30
accessRights is an array III
odeimaiz Aug 7, 2023
2ac2010
getMyAccessRights
odeimaiz Aug 7, 2023
40d3f15
cleanup
odeimaiz Aug 7, 2023
f59443a
reuse getMyAccessRights
odeimaiz Aug 7, 2023
3ea1d61
minor
odeimaiz Aug 7, 2023
858923e
more adaptations
odeimaiz Aug 7, 2023
7197de7
step back
odeimaiz Aug 7, 2023
2a0703d
brute force
odeimaiz Aug 7, 2023
ac8378b
changeWallets
odeimaiz Aug 7, 2023
f0036fc
populateSelectBox
odeimaiz Aug 7, 2023
f5d4645
add members
odeimaiz Aug 7, 2023
5212f77
reloadWalletAccessRights
odeimaiz Aug 7, 2023
bdf87e8
more fixes
odeimaiz Aug 7, 2023
6a50108
mroe fixes
odeimaiz Aug 7, 2023
0567177
Merge branch 'master' into feature/wallet-fe-ii
odeimaiz Aug 8, 2023
5af879d
CRUD on wallet members
odeimaiz Aug 8, 2023
2f8d21f
useCache up
odeimaiz Aug 8, 2023
a453f5e
showNoWallets
odeimaiz Aug 8, 2023
b60b15c
updateWallet
odeimaiz Aug 8, 2023
1d31087
selectWallet
odeimaiz Aug 8, 2023
b05cab7
git pushMerge remote-tracking branch 'upstream/master' into feature/w…
odeimaiz Aug 8, 2023
1e07891
PUT with status
odeimaiz Aug 8, 2023
f338675
minro fix
odeimaiz Aug 8, 2023
48398dc
Merge branch 'master' into fix/update-wallet
odeimaiz Aug 8, 2023
4d44b72
Merge branch 'fix/update-wallet' of github.com:odeimaiz/osparc-simcor…
odeimaiz Aug 8, 2023
8fc816d
update state
odeimaiz Aug 8, 2023
4cb3c86
minors
odeimaiz Aug 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ qx.Class.define("osparc.component.study.ResourceSelector", {
const openButton = this.getChildControl("open-button");
openButton.addListener("execute", () => {
const selection = this.getChildControl("wallet-selector").getSelection();
if (selection.length) {
if (selection.length && selection[0]["walletId"]) {
const params = {
url: {
"studyId": this.__studyData["uuid"],
Expand All @@ -358,6 +358,9 @@ qx.Class.define("osparc.component.study.ResourceSelector", {
const msg = err.message || this.tr("Error selecting Wallet");
osparc.component.message.FlashMessenger.getInstance().logAs(msg, "ERROR");
});
} else {
store.setActiveWallet(this.getWallet());
this.fireEvent("startStudy");
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ qx.Class.define("osparc.data.model.Wallet", {
description: walletData["description"] ? walletData["description"] : null,
thumbnail: walletData["thumbnail"] ? walletData["thumbnail"] : null,
owner: walletData["owner"] ? walletData["owner"] : null,
status: walletData["status"] ? walletData["status"] : false,
status: walletData["status"] ? walletData["status"] : "INACTIVE",
creditsAvailable: walletData["available_credits"] ? walletData["available_credits"] : 20,
accessRights: walletData["accessRights"] ? walletData["accessRights"] : []
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ qx.Class.define("osparc.desktop.wallets.WalletDetails", {

__updateWallet: function(win, button, walletEditor) {
const walletId = walletEditor.getWalletId();
const name = walletEditor.getLabel();
const name = walletEditor.getName();
const description = walletEditor.getDescription();
const thumbnail = walletEditor.getThumbnail();
const params = {
Expand All @@ -119,25 +119,30 @@ qx.Class.define("osparc.desktop.wallets.WalletDetails", {
data: {
"name": name,
"description": description,
"thumbnail": thumbnail || null
"thumbnail": thumbnail || null,
"status": this.__walletModel.getStatus()
}
};
osparc.data.Resources.fetch("wallets", "put", params)
.then(() => {
osparc.component.message.FlashMessenger.getInstance().logAs(name + this.tr(" successfully edited"));
button.setFetching(false);
win.close();
osparc.store.Store.getInstance().reset("wallets");
osparc.store.Store.getInstance().invalidate("wallets");
const store = osparc.store.Store.getInstance();
store.reloadWallets();
this.__walletModel.set({
label: name,
name: name,
description: description,
thumbnail: thumbnail || null
});
})
.catch(err => {
osparc.component.message.FlashMessenger.getInstance().logAs(this.tr("Something went wrong editing ") + name, "ERROR");
button.setFetching(false);
console.error(err);
const msg = err.message || (this.tr("Something went wrong editing ") + name);
osparc.component.message.FlashMessenger.getInstance().logAs(msg, "ERROR");
})
.finally(() => {
button.setFetching(false);
win.close();
});
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,25 @@ qx.Class.define("osparc.desktop.wallets.WalletListItem", {
const found = store.getWallets().find(wallet => wallet.getWalletId() === parseInt(walletId));
if (found) {
// switch status
found.setStatus(found.getStatus() === "ACTIVE" ? "INACTIVE" : "ACTIVE");
const newStatus = found.getStatus() === "ACTIVE" ? "INACTIVE" : "ACTIVE";
const params = {
url: {
"walletId": walletId
},
data: {
"name": found.getName(),
"description": found.getDescription(),
"thumbnail": found.getThumbnail(),
"status": newStatus
}
};
osparc.data.Resources.fetch("wallets", "put", params)
.then(() => found.setStatus(newStatus))
.catch(err => {
console.error(err);
const msg = err.message || (this.tr("Something went wrong updating the state"));
osparc.component.message.FlashMessenger.getInstance().logAs(msg, "ERROR");
});
}
}, this);
this._add(control, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ qx.Class.define("osparc.desktop.wallets.WalletsList", {
data: {
"name": name,
"description": description || null,
"thumbnail": thumbnail || null
"thumbnail": thumbnail || null,
"status": found.getStatus()
}
};
osparc.data.Resources.fetch("wallets", "put", params)
Expand Down