From 919766d637e02e7276a8d2bea37a159443a2be4d Mon Sep 17 00:00:00 2001 From: Dahyun Yu Date: Mon, 2 Jun 2025 13:44:08 +0900 Subject: [PATCH 1/3] fix: hide 'reissue' button when not in admin mode & etc (#5903) * fix: hide 'reissue' button when not in admin mode Signed-off-by: yuda * feat: add currency field to cost report settings section Signed-off-by: yuda * feat: include `currency` in adjustment creation request Signed-off-by: yuda * chore: update language Signed-off-by: yuda --------- Signed-off-by: yuda --- ...dvancedSettingsCostReportConfiguration.vue | 16 +++++++ .../AdvancedSettingsCurrencyConverter.vue | 2 +- .../AdvancedSettingsSetAdjustmentsOverlay.vue | 1 + .../CostReportUpcomingReportCard.vue | 4 ++ .../console-translation-2.8.babel | 42 +++++++++++++++++++ packages/language-pack/en.json | 2 + packages/language-pack/ja.json | 2 + packages/language-pack/ko.json | 4 +- 8 files changed, 71 insertions(+), 2 deletions(-) diff --git a/apps/web/src/services/cost-explorer/components/AdvancedSettingsCostReportConfiguration.vue b/apps/web/src/services/cost-explorer/components/AdvancedSettingsCostReportConfiguration.vue index 23cc4a986f..ea74c1cb6c 100644 --- a/apps/web/src/services/cost-explorer/components/AdvancedSettingsCostReportConfiguration.vue +++ b/apps/web/src/services/cost-explorer/components/AdvancedSettingsCostReportConfiguration.vue @@ -24,6 +24,8 @@ import type { CostReportConfigUpdateParameters } from '@/api-clients/cost-analys import { useServiceQueryKey } from '@/query/query-key/use-service-query-key'; import { i18n } from '@/translations'; +import { CURRENCY, CURRENCY_SYMBOL } from '@/store/display/constant'; +import type { Currency } from '@/store/display/type'; import { languages } from '@/store/user/constant'; import type { LanguageCode } from '@/store/user/type'; @@ -45,6 +47,7 @@ const queryClient = useQueryClient(); const state = reactive({ // Base Settings selectedLanguage: undefined as LanguageCode | undefined, + selectedCurrency: undefined as Currency | undefined, lastDayOfMonth: false, // Auto Apply Adjustments enableAdjustments: false as boolean, @@ -60,6 +63,7 @@ const isSaveDisabled = computed(() => { if (!costReportConfig.value?.cost_report_config_id) return true; return !isAllValid.value; }); +const currencyMenuList = Object.values(CURRENCY).map((currency) => ({ label: `${CURRENCY_SYMBOL[currency]} ${currency}`, name: currency })); const { forms: { @@ -130,6 +134,7 @@ const handleSave = () => { enabled: state.enableAdjustments, period: manualAdjustablePeriod.value, }, + currency: state.selectedCurrency, }); }; @@ -147,6 +152,7 @@ const handleOpenAdjustmentsOverlay = () => { watch(() => costReportConfig.value, (val) => { if (val) { state.selectedLanguage = val.language; + state.selectedCurrency = val.currency; setForm('issueDate', val.issue_day); if (!val.is_last_day) { setForm('issueDate', val.issue_day); @@ -179,6 +185,16 @@ watch(() => costReportConfig.value, (val) => { /> + + + + state.originUnifiedCostConfig, (unifiedCostConfig) => { > {{ $t('COST_EXPLORER.CURRENCY_CONVERTER_PAGE.NOTIFICATION') }} - { value: adjustment.adjustment.includes('DEDUCTION') ? -adjustment.amount : adjustment.amount, description: adjustment.description, order: idx + 1, + currency: costReportConfig.value?.currency, }); }; const updateAdjustment = async (adjustment: AdjustmentData, idx: number) => { diff --git a/apps/web/src/services/cost-explorer/components/CostReportUpcomingReportCard.vue b/apps/web/src/services/cost-explorer/components/CostReportUpcomingReportCard.vue index 233c2a4852..5c8bd458b6 100644 --- a/apps/web/src/services/cost-explorer/components/CostReportUpcomingReportCard.vue +++ b/apps/web/src/services/cost-explorer/components/CostReportUpcomingReportCard.vue @@ -11,6 +11,7 @@ import { import { useCostReportConfigApi } from '@/api-clients/cost-analysis/cost-report-config/composables/use-cost-report-config-api'; import { i18n } from '@/translations'; +import { useAppContextStore } from '@/store/app-context/app-context-store'; import { languages } from '@/store/user/constant'; import { showSuccessMessage } from '@/lib/helper/notice-alert-helper'; @@ -23,7 +24,9 @@ import { getUpcomingIssueDate, getUpcomingConfirmationDate } from '@/services/co const { costReportConfig, isLoading: isCostReportConfigLoading } = useCostReportConfigQuery(); const { costReportConfigAPI } = useCostReportConfigApi(); +const appContextStore = useAppContextStore(); +const isAdminMode = computed(() => appContextStore.getters.isAdminMode); const issueDate = computed(() => costReportConfig.value?.issue_day); const lastDayOfMonth = computed(() => costReportConfig.value?.is_last_day || false); const enableAdjustments = computed(() => costReportConfig.value?.adjustment_options?.enabled || false); @@ -44,6 +47,7 @@ const reportDateRange = computed(() => { return `${startOfNextMonth.format('YYYY-MM-DD')} ~ ${endOfNextMonth.format('YYYY-MM-DD')}`; }); const showReissueButton = computed(() => { + if (!isAdminMode.value) return false; if (!upcomingReportDate.value || !confirmationDate.value) return false; const todayDay = dayjs.utc().date(); const issueDay = dayjs(upcomingReportDate.value).date(); diff --git a/packages/language-pack/console-translation-2.8.babel b/packages/language-pack/console-translation-2.8.babel index 9839335927..9143303031 100644 --- a/packages/language-pack/console-translation-2.8.babel +++ b/packages/language-pack/console-translation-2.8.babel @@ -38970,6 +38970,27 @@ + + COST_REPORT_CURRENCY + false + + + + + + en-US + false + + + ja-JP + false + + + ko-KR + false + + + CURRENCY_CONVERTER false @@ -39788,6 +39809,27 @@ + + COST_ANALYSIS_CURRENCY + false + + + + + + en-US + false + + + ja-JP + false + + + ko-KR + false + + + CURRENCY_CONVERTER false diff --git a/packages/language-pack/en.json b/packages/language-pack/en.json index 4de5b5b1d3..0d739fde2e 100644 --- a/packages/language-pack/en.json +++ b/packages/language-pack/en.json @@ -2127,6 +2127,7 @@ "CONFIRM_DATE_EXCEEDS_MONTH_END": "The confirmation date cannot exceed the last day of the month.", "COST_REPORT_ADJUSTMENTS": "Cost Report Adjustments", "COST_REPORT_CONFIGURATION": "Cost Report Configuration", + "COST_REPORT_CURRENCY": "Cost Report Currency", "CURRENCY_CONVERTER": "Currency Converter", "DAYS_AFTER_REPORT": "Days After Report Issuance", "DESCRIPTION": "Description", @@ -2173,6 +2174,7 @@ "CURRENCY_CONVERTER": "Currency Converter", "CURRENCY_CONVERTER_PAGE": { "AGGREGATION_DATE": "Aggregation Date", + "COST_ANALYSIS_CURRENCY": "Cost Analysis Currency", "CURRENCY_CONVERTER": "Currency Converter", "EXCHANGE_RATE_SOURCE": "Exchange Rate Source", "LAST_DAY_OF_THE_MONTH": "Last day of the month", diff --git a/packages/language-pack/ja.json b/packages/language-pack/ja.json index 7fd17ceb8c..1a97444f4e 100644 --- a/packages/language-pack/ja.json +++ b/packages/language-pack/ja.json @@ -2127,6 +2127,7 @@ "CONFIRM_DATE_EXCEEDS_MONTH_END": "確定日はその月の最終日を超えることはできません。", "COST_REPORT_ADJUSTMENTS": "コストレポート調整", "COST_REPORT_CONFIGURATION": "コストレポート設定", + "COST_REPORT_CURRENCY": "コストレポート通貨", "CURRENCY_CONVERTER": "為替レート設定", "DAYS_AFTER_REPORT": "日 (レポート発行日後)", "DESCRIPTION": "説明", @@ -2173,6 +2174,7 @@ "CURRENCY_CONVERTER": "為替レート設定", "CURRENCY_CONVERTER_PAGE": { "AGGREGATION_DATE": "集計日", + "COST_ANALYSIS_CURRENCY": "コスト分析通貨", "CURRENCY_CONVERTER": "為替レート設定", "EXCHANGE_RATE_SOURCE": "為替基準", "LAST_DAY_OF_THE_MONTH": "月末", diff --git a/packages/language-pack/ko.json b/packages/language-pack/ko.json index 223f3740b1..0be6cd948e 100644 --- a/packages/language-pack/ko.json +++ b/packages/language-pack/ko.json @@ -930,7 +930,7 @@ "EMAIL_INVALID": "잘못된 이메일 형식입니다.", "GREATER_THAN_OR_EQUAL_TO_1": "1 이상으로 설정해주세요.", "HIDE": "숨기기", - "ISSUE_DATE": "발행일자 ", + "ISSUE_DATE": "발행일", "ISSUE_DAY": "발행일(매월)", "LANGUAGE": "언어", "LAST_12_MONTHS": "최근 12개월", @@ -2127,6 +2127,7 @@ "CONFIRM_DATE_EXCEEDS_MONTH_END": "확정일은 해당 월의 마지막 일을 초과할 수 없습니다.", "COST_REPORT_ADJUSTMENTS": "비용 리포트 조정", "COST_REPORT_CONFIGURATION": "비용 리포트 설정", + "COST_REPORT_CURRENCY": "비용 리포트 통화", "CURRENCY_CONVERTER": "환율 설정", "DAYS_AFTER_REPORT": "일 (리포트 발행일 이후)", "DESCRIPTION": "설명", @@ -2173,6 +2174,7 @@ "CURRENCY_CONVERTER": "환율 설정", "CURRENCY_CONVERTER_PAGE": { "AGGREGATION_DATE": "집계 날짜", + "COST_ANALYSIS_CURRENCY": "비용 분석 통화", "CURRENCY_CONVERTER": "환율 설정", "EXCHANGE_RATE_SOURCE": "환율 기준", "LAST_DAY_OF_THE_MONTH": "매월 마지막일 ", From b6f32a22fe194f25fdc16e456a2452a4bb8fa001 Mon Sep 17 00:00:00 2001 From: Dahyun Yu Date: Mon, 2 Jun 2025 15:22:57 +0900 Subject: [PATCH 2/3] fix: incorrect policy id in adjustment creation request (#5905) * feat: disable 'Set Adjustment' button when auto-apply is turned off Signed-off-by: yuda * fix: incorrect policy id in adjustment creation request Signed-off-by: yuda * chore: add comment Signed-off-by: yuda --------- Signed-off-by: yuda --- .../components/AdvancedSettingsCostReportConfiguration.vue | 1 + .../components/AdvancedSettingsSetAdjustmentsOverlay.vue | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/src/services/cost-explorer/components/AdvancedSettingsCostReportConfiguration.vue b/apps/web/src/services/cost-explorer/components/AdvancedSettingsCostReportConfiguration.vue index ea74c1cb6c..342b18c6f2 100644 --- a/apps/web/src/services/cost-explorer/components/AdvancedSettingsCostReportConfiguration.vue +++ b/apps/web/src/services/cost-explorer/components/AdvancedSettingsCostReportConfiguration.vue @@ -271,6 +271,7 @@ watch(() => costReportConfig.value, (val) => { {{ $t('COST_EXPLORER.ADVANCED_SETTINGS.SET_ADJUSTMENTS') }} diff --git a/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue b/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue index 8a566f5e8d..d5a3c6a4f5 100644 --- a/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue +++ b/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue @@ -51,6 +51,7 @@ const { key: raQueryKey } = useServiceQueryKey('cost-analysis', 'report-adjustme const state = reactive({ loading: false, + createdPolicyIdMap: new Map(), // Map to store new policy IDs }); const workspaceReferenceMap = computed(() => allReferenceStore.getters.workspace); const isAllValid = computed(() => advancedSettingsPageStore.isAdjustmentPolicyValid && advancedSettingsPageStore.isAdjustmentValid); @@ -123,13 +124,14 @@ const deleteAdjustmentPolicy = async (): Promise => { return deletedPolicyIds; }; const createAdjustmentPolicy = async (policy: AdjustmentPolicyData, idx: number) => { - await reportAdjustmentPolicyAPI.create({ + const createdPolicy = await reportAdjustmentPolicyAPI.create({ cost_report_config_id: costReportConfigId.value, policy_filter: { workspace_ids: policy.workspaceMenuItems?.map((item) => item.name) || [], }, order: idx + 1, }); + state.createdPolicyIdMap.set(policy.id, createdPolicy.report_adjustment_policy_id); }; const updateAdjustmentPolicy = async (policy: AdjustmentPolicyData, idx: number) => { const oldPolicy = originalPolicies.value.find((p) => p.report_adjustment_policy_id === policy.id); @@ -168,8 +170,9 @@ const deleteAdjustment = async (deletedPolicyIds: string[]) => { }); }; const createAdjustment = async (adjustment: AdjustmentData, idx: number) => { + const createdPolicyId = state.createdPolicyIdMap.get(adjustment.policyId) || adjustment.policyId; await reportAdjustmentAPI.create({ - report_adjustment_policy_id: adjustment.policyId, + report_adjustment_policy_id: createdPolicyId, name: adjustment.name, provider: adjustment.provider, unit: adjustment.adjustment.includes('PERCENT') ? 'PERCENT' : 'FIXED', From 36bf8108f63299806ecde4a16c7821d8832e75e3 Mon Sep 17 00:00:00 2001 From: Dahyun Yu Date: Mon, 2 Jun 2025 15:40:01 +0900 Subject: [PATCH 3/3] chore: clear createdPolicyIdMap (#5907) * chore: clear createdPolicyIdMap Signed-off-by: yuda * chore: clear createdPolicyIdMap in watch Signed-off-by: yuda --------- Signed-off-by: yuda --- .../components/AdvancedSettingsSetAdjustmentsOverlay.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue b/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue index d5a3c6a4f5..946f3de653 100644 --- a/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue +++ b/apps/web/src/services/cost-explorer/components/AdvancedSettingsSetAdjustmentsOverlay.vue @@ -1,5 +1,7 @@