From 0b0168fbef49bdaaaee5997227bd9b4e3941d7d0 Mon Sep 17 00:00:00 2001 From: AlaaElattar Date: Mon, 13 May 2024 14:27:31 +0300 Subject: [PATCH 1/3] add limitation for node fee && close dialog after success of failure --- packages/grid_client/src/modules/contracts.ts | 2 +- .../playground/src/dashboard/components/set_extra_fee.vue | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/grid_client/src/modules/contracts.ts b/packages/grid_client/src/modules/contracts.ts index 6742ca305a..b47cbcb0b5 100644 --- a/packages/grid_client/src/modules/contracts.ts +++ b/packages/grid_client/src/modules/contracts.ts @@ -118,7 +118,7 @@ class Contracts { @expose @validateInput async getDedicatedNodeExtraFee(options: GetDedicatedNodePriceModel) { - return await this.client.contracts.getDedicatedNodeExtraFee(options); + return (await this.client.contracts.getDedicatedNodeExtraFee(options)) * 1000; } @expose diff --git a/packages/playground/src/dashboard/components/set_extra_fee.vue b/packages/playground/src/dashboard/components/set_extra_fee.vue index 40b926f02a..25875130ca 100644 --- a/packages/playground/src/dashboard/components/set_extra_fee.vue +++ b/packages/playground/src/dashboard/components/set_extra_fee.vue @@ -33,6 +33,7 @@ validators.required('Fee is required.'), validators.isNumeric('Fee must be a valid number.'), validators.min('Fee must be a 0 or more.', 0), + validators.max('Maximum allowed fee is 1000000000000000', 1000000000000000), ]" #="{ props }" > @@ -116,7 +117,7 @@ export default { isSetting.value = true; await gridStore.grid.contracts.setDedicatedNodeExtraFee({ nodeId: props.nodeId, - extraFee: +fee.value, + extraFee: +fee.value / 1000, }); createCustomToast("Additional fee is set successfully.", ToastType.success); await getExtraFee(); @@ -124,6 +125,7 @@ export default { createCustomToast("Failed to set additional fees!", ToastType.danger); } finally { isSetting.value = false; + showDialogue.value = false; } } From e748a673982afa2b8fbc30829d298911e1809c0b Mon Sep 17 00:00:00 2001 From: AlaaElattar Date: Mon, 13 May 2024 15:41:28 +0300 Subject: [PATCH 2/3] remove division and multiplication --- packages/grid_client/src/modules/contracts.ts | 2 +- packages/playground/src/dashboard/components/set_extra_fee.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/grid_client/src/modules/contracts.ts b/packages/grid_client/src/modules/contracts.ts index b47cbcb0b5..6742ca305a 100644 --- a/packages/grid_client/src/modules/contracts.ts +++ b/packages/grid_client/src/modules/contracts.ts @@ -118,7 +118,7 @@ class Contracts { @expose @validateInput async getDedicatedNodeExtraFee(options: GetDedicatedNodePriceModel) { - return (await this.client.contracts.getDedicatedNodeExtraFee(options)) * 1000; + return await this.client.contracts.getDedicatedNodeExtraFee(options); } @expose diff --git a/packages/playground/src/dashboard/components/set_extra_fee.vue b/packages/playground/src/dashboard/components/set_extra_fee.vue index 25875130ca..84224af77e 100644 --- a/packages/playground/src/dashboard/components/set_extra_fee.vue +++ b/packages/playground/src/dashboard/components/set_extra_fee.vue @@ -117,7 +117,7 @@ export default { isSetting.value = true; await gridStore.grid.contracts.setDedicatedNodeExtraFee({ nodeId: props.nodeId, - extraFee: +fee.value / 1000, + extraFee: +fee.value, }); createCustomToast("Additional fee is set successfully.", ToastType.success); await getExtraFee(); From 4ad1cf47b9e26f18959f950f7f31e26479aa9b94 Mon Sep 17 00:00:00 2001 From: AlaaElattar Date: Tue, 14 May 2024 09:38:39 +0300 Subject: [PATCH 3/3] change limit to 1 million or less --- packages/playground/src/dashboard/components/set_extra_fee.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playground/src/dashboard/components/set_extra_fee.vue b/packages/playground/src/dashboard/components/set_extra_fee.vue index 84224af77e..947f74689c 100644 --- a/packages/playground/src/dashboard/components/set_extra_fee.vue +++ b/packages/playground/src/dashboard/components/set_extra_fee.vue @@ -33,7 +33,7 @@ validators.required('Fee is required.'), validators.isNumeric('Fee must be a valid number.'), validators.min('Fee must be a 0 or more.', 0), - validators.max('Maximum allowed fee is 1000000000000000', 1000000000000000), + validators.max('Maximum allowed fee is 1000000', 10000000), ]" #="{ props }" >