From b89c76b3768c999b9f5619abcef2ab091230af78 Mon Sep 17 00:00:00 2001 From: Julian Jelfs Date: Mon, 1 Jul 2024 14:42:45 +0100 Subject: [PATCH] add token enable to admin screen (#5974) --- .../home/admin/OperatorFunctions.svelte | 36 +++++++++++++++++++ .../components/home/profile/Accounts.svelte | 14 ++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/frontend/app/src/components/home/admin/OperatorFunctions.svelte b/frontend/app/src/components/home/admin/OperatorFunctions.svelte index 02a033955c..03c89d6928 100644 --- a/frontend/app/src/components/home/admin/OperatorFunctions.svelte +++ b/frontend/app/src/components/home/admin/OperatorFunctions.svelte @@ -49,11 +49,14 @@ let currentFees: Record<"ICP" | "CHAT", Fees>; let originalFees: Record<"ICP" | "CHAT", DiamondMembershipFees>; let feesTab: "ICP" | "CHAT" = "ICP"; + let tokenLedger = ""; + let tokenEnabled = true; $: groupUpgradeConcurrencyInvalid = isNaN(parseInt(groupUpgradeConcurrency, 0)); $: communityUpgradeConcurrencyInvalid = isNaN(parseInt(communityUpgradeConcurrency, 0)); $: userUpgradeConcurrencyInvalid = isNaN(parseInt(userUpgradeConcurrency, 0)); $: exchangeIdInvalid = isNaN(parseInt(exchangeId, 0)); + $: tokenLedgerValid = tokenLedger.length > 0; onMount(() => { client.diamondMembershipFees().then((fees) => { @@ -265,6 +268,26 @@ }); } } + + function setTokenEnabled(): void { + error = undefined; + addBusy(6); + client + .setTokenEnabled(tokenLedger, tokenEnabled) + .then((success) => { + if (success) { + toastStore.showSuccessToast( + i18nKey(`Token enabled set successfully: ${tokenLedger}, ${tokenEnabled}`), + ); + } else { + error = i18nKey(`Failed to set token enabled: ${tokenLedger}, ${tokenEnabled}`); + toastStore.showFailureToast(error); + } + }) + .finally(() => { + removeBusy(6); + }); + }
@@ -452,6 +475,19 @@ on:click={updateMarketMakerConfig}>Apply +
+
Set token enabled
+ + + + + +
+

Pause event loop

diff --git a/frontend/app/src/components/home/profile/Accounts.svelte b/frontend/app/src/components/home/profile/Accounts.svelte index 2712940b25..a7690db2c4 100644 --- a/frontend/app/src/components/home/profile/Accounts.svelte +++ b/frontend/app/src/components/home/profile/Accounts.svelte @@ -146,7 +146,11 @@
- + {token.name}
{token.symbol}
@@ -200,7 +204,9 @@ slot="icon" />
+ resourceKey={i18nKey( + "cryptoAccount.swap", + )} />
{/if} @@ -324,6 +330,10 @@ border-radius: 50%; background-repeat: no-repeat; background-position: top; + + &.disabled { + filter: grayscale(1); + } } }