From b42621f0722468c4205cd881f8acb14136c912e6 Mon Sep 17 00:00:00 2001 From: yuda Date: Tue, 3 Jun 2025 13:46:11 +0900 Subject: [PATCH 1/4] fix: handle async timing issue (adjustment) Signed-off-by: yuda --- .../AdvancedSettingsSetAdjustmentsOverlay.vue | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue b/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue index 946f3de653..46747c2d26 100644 --- a/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue +++ b/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue @@ -222,34 +222,35 @@ const handleSave = async () => { try { // CUD Adjustment Policy const deletedPolicyIds = await deleteAdjustmentPolicy(); - await Promise.all(formPolicies.value.map(async (policy, idx) => { + const policyPromises = formPolicies.value.map(async (policy, idx) => { if (policy.id.startsWith('rap-')) { - await updateAdjustmentPolicy(policy, idx); - } else { - await createAdjustmentPolicy(policy, idx); + return updateAdjustmentPolicy(policy, idx); } - })); + return createAdjustmentPolicy(policy, idx); + }); + await Promise.all(policyPromises); // CUD Adjustment await deleteAdjustment(deletedPolicyIds); - await Promise.all(formPolicies.value.map(async (policy) => { + const adjustmentPromises = formPolicies.value.flatMap(async (policy) => { const adjustments = formAdjustments.value.filter((adjustment) => adjustment.policyId === policy.id); - await Promise.all(adjustments.map(async (adjustment, idx) => { + return adjustments.map(async (adjustment, idx) => { if (adjustment.id.startsWith('ra-')) { - await updateAdjustment(adjustment, idx); - } else { - await createAdjustment(adjustment, idx); + return updateAdjustment(adjustment, idx); } - })); - })); - - queryClient.invalidateQueries({ queryKey: rapQueryKey.value }); - queryClient.invalidateQueries({ queryKey: raQueryKey.value }); + return createAdjustment(adjustment, idx); + }); + }); + await Promise.all(adjustmentPromises.flat()); showSuccessMessage(i18n.t('COST_EXPLORER.ADVANCED_SETTINGS.ALT_S_SAVE_COST_REPORT_ADJUSTMENTS'), ''); } catch (error) { ErrorHandler.handleRequestError(error, i18n.t('COST_EXPLORER.ADVANCED_SETTINGS.ALT_E_SAVE_COST_REPORT_ADJUSTMENTS')); } finally { + await Promise.all([ + queryClient.invalidateQueries({ queryKey: rapQueryKey.value }), + queryClient.invalidateQueries({ queryKey: raQueryKey.value }), + ]); state.loading = false; } }; From cf51babf0bc99b158408c0ca5680b3b85c8291cc Mon Sep 17 00:00:00 2001 From: yuda Date: Wed, 4 Jun 2025 09:14:03 +0900 Subject: [PATCH 2/4] chore: set min value to adjustment amount Signed-off-by: yuda --- .../cost-explorer/components/AdvancedSettingsAdjustmentsForm.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web/src/services/cost-explorer/components/AdvancedSettingsAdjustmentsForm.vue b/apps/web/src/services/cost-explorer/components/AdvancedSettingsAdjustmentsForm.vue index 4f8cc91720..5fa65768ae 100644 --- a/apps/web/src/services/cost-explorer/components/AdvancedSettingsAdjustmentsForm.vue +++ b/apps/web/src/services/cost-explorer/components/AdvancedSettingsAdjustmentsForm.vue @@ -190,6 +190,7 @@ const handleUpdateAdjustment = (adjustmentId: string, selected: AdjustmentType) :placeholder="$t('COST_EXPLORER.ADVANCED_SETTINGS.AMOUNT')" :invalid="!item.amount" class="w-auto" + :min="0" >