Skip to content

Commit

Permalink
fix: fix qa issues (unified-cost) (#4865)
Browse files Browse the repository at this point in the history
* fix: fix currency load logic for userMode

Signed-off-by: sulmo <[email protected]>

* feat: update unifiedCost resource Id

Signed-off-by: sulmo <[email protected]>

* feat: add unified cost icon to header

Signed-off-by: sulmo <[email protected]>

* fix: fix z-index bug & fix ui bug

Signed-off-by: sulmo <[email protected]>

---------

Signed-off-by: sulmo <[email protected]>
  • Loading branch information
sulmoJ authored Oct 17, 2024
1 parent 9dd6a3e commit cfa1206
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ watch(() => state.userId, (userId) => {
position: fixed;
width: 100%;
height: $top-bar-height;
z-index: 100;
z-index: 1030;
flex-shrink: 0;
top: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const handleCloseClick = () => {
<template>
<div class="scoped-notification"
:class="{info: props.type==='info', waring: props.type ==='warning', danger: props.type ==='danger', 'in-section': props.layout === 'in-section'}"
:class="{info: props.type==='info', waring: props.type ==='warning', danger: props.type ==='danger', 'in-section': props.layout === 'in-section', 'items-center': props.noTitle}"
>
<p-i v-if="props.titleIcon"
class="left-icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ onBeforeMount(async () => {

<style scoped lang="postcss">
.gnb {
z-index: 50;
z-index: 1020;
.g-n-b-item {
@apply absolute flex border-gray-200;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { useRoute, useRouter } from 'vue-router/composables';
import type { CostQuerySetModel } from '@/schema/cost-analysis/cost-query-set/model';
import { usePreferencesStore } from '@/store/preferences/preferences-store';
import {
queryStringToArray,
queryStringToObject,
Expand All @@ -32,7 +30,6 @@ const router = useRouter();
const costAnalysisPageStore = useCostAnalysisPageStore();
const costAnalysisPageGetters = costAnalysisPageStore.getters;
const domainConfigStore = usePreferencesStore();
/* util */
const getQueryOptionsFromUrlQuery = (urlQuery: CostAnalysisPageUrlQuery): CostQuerySetModel['options'] => ({
Expand All @@ -58,9 +55,6 @@ watch(() => costAnalysisPageGetters.selectedQuerySet, async (selectedQuerySet) =
}
}, { immediate: true });
(() => {
domainConfigStore.fetchPreferences();
})();
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,16 @@ watch(() => state.favoriteOptions, async (favoriteOptions) => {
<p-heading :title="state.title">
<template #title-left-extra>
<div class="title-left-extra">
<p-lazy-img :src="state.dataSourceImage"
<p-lazy-img v-if="state.dataSourceImage"
:src="state.dataSourceImage"
width="2rem"
height="2rem"
/>
<p-i v-else
name="ic_unified-cost"
width="2rem"
height="2rem"
/>
<p-i v-if="state.managedCostQuerySetList.some((item) => item.name === (state.title || ''))"
name="ic_main-filled"
width="1rem"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { i18n } from '@/translations';
import { makeAdminRouteName } from '@/router/helpers/route-helper';
import { useAppContextStore } from '@/store/app-context/app-context-store';
import { useDomainStore } from '@/store/domain/domain-store';
import { CURRENCY, CURRENCY_SYMBOL } from '@/store/modules/display/config';
import { usePreferencesStore } from '@/store/preferences/preferences-store';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
import type { CostDataSourceReferenceMap } from '@/store/reference/cost-data-source-reference-store';
import type { PluginReferenceMap } from '@/store/reference/plugin-reference-store';
Expand Down Expand Up @@ -53,8 +53,8 @@ const costQuerySetState = costQuerySetStore.state;
const allReferenceStore = useAllReferenceStore();
const favoriteStore = useFavoriteStore();
const favoriteGetters = favoriteStore.getters;
const domainConfigStore = usePreferencesStore();
const domainConfigGetters = domainConfigStore.getters;
const domainStore = useDomainStore();
const domainGetters = domainStore.getters;
const router = useRouter();
const route = useRoute();
Expand All @@ -68,7 +68,7 @@ const storeState = reactive({
favoriteItems: computed(() => favoriteGetters.costAnalysisItems),
plugins: computed<PluginReferenceMap>(() => allReferenceStore.getters.plugin),
dataSourceMap: computed<CostDataSourceReferenceMap>(() => allReferenceStore.getters.costDataSource),
unifiedCostCurrency: computed(() => domainConfigGetters.unifiedCostConfig?.currency ?? DEFAULT_UNIFIED_COST_CURRENCY),
unifiedCostCurrency: computed(() => domainGetters.domainUnifiedCostCurrency ?? DEFAULT_UNIFIED_COST_CURRENCY),
isAdminUser: computed(() => store.state.user.roleType === 'DOMAIN_ADMIN'),
});
const state = reactive({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ onMounted(async () => {
.cost-analysis-query-section {
position: relative;
margin-top: 1.5rem;
z-index: 1;
.scope-wrapper {
margin-bottom: 1rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ watch(() => props.visible, (visible) => {
:disabled="state.enableLastDay"
type="number"
class="input-field"
min="1"
max="31"
@update:value="setForm('issueDay', $event)"
/>
<p-checkbox class="checkbox"
Expand Down Expand Up @@ -195,19 +197,11 @@ watch(() => props.visible, (visible) => {
</p-button-modal>
</template>
<style lang="scss" scoped>
<style lang="postcss" scoped>
.input-field {
width: 10rem;
}
/* custom design-system component - p-text-input */
:deep(.p-text-input) {
.input-container {
.tag-container {
width: 90%;
}
}
}
.checkbox {
padding-left: 0.5rem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ export const FILTER = {
} as const;

export const DEFAULT_UNIFIED_COST_CURRENCY = CURRENCY.KRW;
export const UNIFIED_COST_KEY = 'unifiedCost';
export const UNIFIED_COST_KEY = 'unified-cost-data-source';
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import type { WorkspaceModel } from '@/schema/identity/workspace/model';

import { useAppContextStore } from '@/store/app-context/app-context-store';
import { useUserWorkspaceStore } from '@/store/app-context/workspace/user-workspace-store';
import { useDomainStore } from '@/store/domain/domain-store';
import type { Currency } from '@/store/modules/display/type';
import { usePreferencesStore } from '@/store/preferences/preferences-store';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';


Expand Down Expand Up @@ -54,8 +54,8 @@ export const useCostAnalysisPageStore = defineStore('page-cost-analysis', () =>
const appContextStore = useAppContextStore();
const userWorkspaceStore = useUserWorkspaceStore();
const workspaceStoreGetters = userWorkspaceStore.getters;
const domainConfigStore = usePreferencesStore();
const domainConfigGetters = domainConfigStore.getters;
const domainStore = useDomainStore();
const domainGetters = domainStore.getters;

const _state = reactive({
isAdminMode: computed(() => appContextStore.getters.isAdminMode),
Expand Down Expand Up @@ -84,7 +84,7 @@ export const useCostAnalysisPageStore = defineStore('page-cost-analysis', () =>
currency: computed<Currency>(() => {
if (costQuerySetState.selectedDataSourceId) {
const targetDataSource = allReferenceStore.getters.costDataSource[costQuerySetState.selectedDataSourceId ?? ''];
if (costQuerySetState.selectedDataSourceId === UNIFIED_COST_KEY) return (domainConfigGetters.unifiedCostConfig?.currency ?? DEFAULT_UNIFIED_COST_CURRENCY);
if (costQuerySetState.selectedDataSourceId === UNIFIED_COST_KEY) return (domainGetters.domainUnifiedCostCurrency ?? DEFAULT_UNIFIED_COST_CURRENCY);
return targetDataSource?.data?.plugin_info?.metadata?.currency ?? 'USD';
}
return 'USD';
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/store/domain/domain-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {

import type { ExtendedAuthType, ExtraMenuSet } from '@/store/domain/type';
import { DOMAIN_CONFIG_TYPE } from '@/store/domain/type';
import type { Currency } from '@/store/modules/display/type';

import config from '@/lib/config';

Expand Down Expand Up @@ -78,6 +79,7 @@ export const useDomainStore = defineStore('domain-store', () => {

return undefined;
}),
domainUnifiedCostCurrency: computed<Currency|undefined>(() => state.config?.settings?.unified_cost_config?.currency),
});

/* Mutation */
Expand Down

0 comments on commit cfa1206

Please sign in to comment.