Skip to content

Commit

Permalink
Merge pull request #5090 from yuda110/feature/fix-cost-analysis
Browse files Browse the repository at this point in the history
fix: listCostQueryList() after update querySet & calculate group-by items with appropriate types
  • Loading branch information
yuda110 authored Nov 26, 2024
2 parents 01609a8 + 5918a82 commit ee08396
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ const { metadataAdditionalInfoItems } = useCostDataSourceFilterMenuItems({
costDataSource: computed(() => storeState.costDataSource[costAnalysisPageGetters.selectedDataSourceId ?? '']),
});
const state = reactive({
groupByItems: computed<SelectDropdownMenuItem[]>(() => [...costAnalysisPageGetters.visibleGroupByItems, ...state.selectedAdditionalGroupByMenu]),
groupByItems: computed<SelectDropdownMenuItem[]>(() => {
const _allGroupByItems = [...costAnalysisPageGetters.visibleGroupByItems, ...state.selectedAdditionalGroupByMenu];
return _allGroupByItems.map((d) => {
if (GROUP_BY_ITEM_MAP[d.name]) return GROUP_BY_ITEM_MAP[d.name];
return { name: d.name, label: d.label };
});
}),
selectedGroupByItems: computed<SelectDropdownMenuItem[]>(() => costAnalysisPageState.groupBy.map((d) => {
if (GROUP_BY_ITEM_MAP[d]) return GROUP_BY_ITEM_MAP[d];
return { name: d, label: d.split('.')[1] };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ const handleClickEditQuery = (id: string) => {
};
const handleUpdateQuery = () => {
costAnalysisPageStore.getCostQueryList();
costAnalysisPageStore.listCostQueryList();
};
const handleDeleteQueryConfirm = async () => {
state.queryDeleteModalVisible = false;
try {
await SpaceConnector.clientV2.costAnalysis.costQuerySet.delete<CostQuerySetDeleteParameters>({ cost_query_set_id: state.itemIdForDeleteQuery });
await costAnalysisPageStore.getCostQueryList();
await costAnalysisPageStore.listCostQueryList();
showSuccessMessage(i18n.t('BILLING.COST_MANAGEMENT.COST_ANALYSIS.ALT_S_DELETE_QUERY'), '');
await SpaceRouter.router.push(getProperRouteLocation({
name: COST_EXPLORER_ROUTE.COST_ANALYSIS.QUERY_SET._NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const handleSaveQuerySet = async () => {
metadata: { filters_schema: { enabled_properties: costAnalysisPageState.enabledFiltersProperties ?? [] } },
},
});
await costAnalysisPageStore.listCostQueryList();
showSuccessMessage(i18n.t('BILLING.COST_MANAGEMENT.COST_ANALYSIS.ALT_S_SAVE_QUERY'), '');
} catch (e) {
ErrorHandler.handleRequestError(e, i18n.t('BILLING.COST_MANAGEMENT.COST_ANALYSIS.ALT_E_SAVED_QUERY'));
Expand All @@ -152,7 +153,7 @@ const handleClickSaveAsButton = () => {
state.queryFormModalVisible = true;
};
const handleUpdateQuery = async (updatedQueryId: string) => {
await costAnalysisPageStore.getCostQueryList();
await costAnalysisPageStore.listCostQueryList();
await costAnalysisPageStore.selectQueryId(updatedQueryId);
await SpaceRouter.router.push(getProperRouteLocation({
name: COST_EXPLORER_ROUTE.COST_ANALYSIS.QUERY_SET._NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export const useCostAnalysisPageStore = defineStore('page-cost-analysis', () =>
}
return updatedQueryData;
};
const getCostQueryList = async () => {
const listCostQueryList = async () => {
await costQuerySetStore.listCostQuerySets();
};

Expand All @@ -290,7 +290,7 @@ export const useCostAnalysisPageStore = defineStore('page-cost-analysis', () =>
saveQuery,
selectQueryId,
editQuery,
getCostQueryList,
listCostQueryList,
};
const mutations = {
setChartGroupBy,
Expand Down

0 comments on commit ee08396

Please sign in to comment.