From 03c8175067b12270ae32a917f67265236b8e48c5 Mon Sep 17 00:00:00 2001 From: Julian Querido Date: Mon, 20 Nov 2023 09:26:16 +0100 Subject: [PATCH 1/3] Only show total user's credit in the current wallet --- .../osparc/navigation/CreditsMenuButton.js | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js b/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js index 547ba46d4b3..d42e4214c3b 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js +++ b/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js @@ -108,24 +108,29 @@ qx.Class.define("osparc.navigation.CreditsMenuButton", { const wallet = store.getContextWallet(); if (wallet) { let text = "-"; - const currentUsage = this.getCurrentUsage(); - let used = null; - if (currentUsage) { - used = currentUsage.getUsedCredits(); - } + // Note - We should figure out a way to handle credits being used. + // We need to consider what happens if it's not your prefered wallet being debited. I.E The projects wallet + // Where is a good place to display the Burned credits for a project. + + // const currentUsage = this.getCurrentUsage(); + // let used = null; + debugger + // if (currentUsage) { + // used = currentUsage.getUsedCredits(); + // } const creditsLeft = wallet.getCreditsAvailable(); if (creditsLeft !== null) { text = "CREDITS
"; let nCreditsText = ""; - if (used !== null) { - nCreditsText += osparc.desktop.credits.Utils.creditsToFixed(used) + " / "; - } + // if (used !== null) { + // nCreditsText += osparc.desktop.credits.Utils.creditsToFixed(used) + " / "; + // } nCreditsText += osparc.desktop.credits.Utils.creditsToFixed(creditsLeft); text += `${nCreditsText}`; - this.set({ - minWidth: used ? 90 : null, - width: used ? 90 : null - }); + // this.set({ + // minWidth: used ? 90 : null, + // width: used ? 90 : null + // }); } this.set({ label: text, From ab2ba84f289adcec6c8d1622ed81d3ba2c9a5c71 Mon Sep 17 00:00:00 2001 From: Julian Querido Date: Mon, 20 Nov 2023 09:29:44 +0100 Subject: [PATCH 2/3] removed debugger --- .../client/source/class/osparc/navigation/CreditsMenuButton.js | 1 - 1 file changed, 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js b/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js index d42e4214c3b..b93fee197ea 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js +++ b/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js @@ -114,7 +114,6 @@ qx.Class.define("osparc.navigation.CreditsMenuButton", { // const currentUsage = this.getCurrentUsage(); // let used = null; - debugger // if (currentUsage) { // used = currentUsage.getUsedCredits(); // } From ed0ae1271626563556686a36a97d6a9c156a20a4 Mon Sep 17 00:00:00 2001 From: Julian Querido Date: Mon, 20 Nov 2023 12:33:48 +0100 Subject: [PATCH 3/3] Code review - Remove comments in code --- .../osparc/navigation/CreditsMenuButton.js | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js b/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js index b93fee197ea..2b5a4b8f744 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js +++ b/services/static-webserver/client/source/class/osparc/navigation/CreditsMenuButton.js @@ -84,7 +84,6 @@ qx.Class.define("osparc.navigation.CreditsMenuButton", { if (currentUsage) { currentUsage.addListener("changeUsedCredits", () => { this.__updateCredits(); - // this.__animate(); }); } }, @@ -97,39 +96,18 @@ qx.Class.define("osparc.navigation.CreditsMenuButton", { wallet.addListener("changeCreditsAvailable", () => this.__updateCredits()); } }, - // Note - Sometimes it doesn't work and it bring the credits indicator into a failed state - // __animate: function() { - // const label = this.getChildControl("label"); - // osparc.utils.Utils.animateUsage(label.getContentElement().getDomElement()); - // }, __updateCredits: function() { const store = osparc.store.Store.getInstance(); const wallet = store.getContextWallet(); if (wallet) { let text = "-"; - // Note - We should figure out a way to handle credits being used. - // We need to consider what happens if it's not your prefered wallet being debited. I.E The projects wallet - // Where is a good place to display the Burned credits for a project. - - // const currentUsage = this.getCurrentUsage(); - // let used = null; - // if (currentUsage) { - // used = currentUsage.getUsedCredits(); - // } const creditsLeft = wallet.getCreditsAvailable(); if (creditsLeft !== null) { text = "CREDITS
"; let nCreditsText = ""; - // if (used !== null) { - // nCreditsText += osparc.desktop.credits.Utils.creditsToFixed(used) + " / "; - // } nCreditsText += osparc.desktop.credits.Utils.creditsToFixed(creditsLeft); text += `${nCreditsText}`; - // this.set({ - // minWidth: used ? 90 : null, - // width: used ? 90 : null - // }); } this.set({ label: text,