Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: apply additional feedback #5100

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ watch(() => workspaceState.selectedItems, (selectedItems) => {
parent-id="workspace-role-form"
show-select-marker
show-select-header
is-fixed-width
is-filterable
show-delete-all-button
class="workspace-select-dropdown"
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/schema/inventory/metric/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface MetricModel {
name: string;
metric_type: MetricType;
resource_type: string;
resource_group: 'DOMAIN' | 'WORKSPACE',
query_options: Record<string, any>;
date_field: string;
unit: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ watch([() => state.menuIds, () => state.isSelectDropdownVisible], async (menuIds
use-fixed-menu-style
show-select-marker
disable-handler
is-fixed-width
:visible-menu.sync="state.isSelectDropdownVisible"
:menu="menuList"
:selected.sync="selectedItems"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ watch([() => state.menuIds, () => state.isSelectDropdownVisible], async (menuIds
use-fixed-menu-style
show-select-marker
disable-handler
is-fixed-width
:visible-menu.sync="state.isSelectDropdownVisible"
:menu="menuList"
:selected.sync="selectedItems"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ watch(() => domainConfigGetters.language, (val) => {
:selected.sync="state.selectedTimezone"
:page-size="10"
:disabled="!state.hasReadWriteAccess"
is-fixed-width
is-filterable
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,6 @@ onMounted(() => {
required
>
<workspace-select-dropdown class="action-workspace"
is-fixed-width
:selected-workspace-ids="state.selectedWorkspaceId"
@update:selected-workspace-ids="handleSelectWorkspaceId"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<div class="dropdown-container">
<p-select-dropdown :selected="state.selectedProvider"
:menu="state.providerList"
is-fixed-width
class="select-dropdown"
@update:selected="handleChangeProvider"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<p-select-dropdown :selected="state.selectedProvider"
:menu="state.providerList"
class="select-dropdown"
is-fixed-width
@update:selected="handleChangeProvider"
>
<template #dropdown-button="item">
Expand Down Expand Up @@ -91,6 +92,7 @@
<div class="repository">
<p-select-dropdown :selected.sync="state.selectedRepository"
:menu="state.repositoryList"
is-fixed-width
class="select-dropdown"
>
<template #dropdown-button="item">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useWindowSize } from '@vueuse/core';
import type { TranslateResult } from 'vue-i18n';

import {
PButton, PHeading, PIconButton, screens,
PButton, PHeading, PIconButton, screens, PHeadingLayout,
} from '@cloudforet/mirinae';

const props = defineProps<{
Expand All @@ -24,12 +24,14 @@ const handleClickEdit = () => {
</script>

<template>
<p-heading class="pt-8 px-4 pb-4"
:title="props.title"
heading-type="sub"
:use-total-count="props.totalCount !== undefined"
:total-count="props.totalCount"
>
<p-heading-layout class="pt-8 px-4 pb-4">
<template #heading>
<p-heading :title="props.title"
heading-type="sub"
:use-total-count="props.totalCount !== undefined"
:total-count="props.totalCount"
/>
</template>
<template v-if="!props.editMode && !props.hideEditButton"
#extra
>
Expand All @@ -49,5 +51,5 @@ const handleClickEdit = () => {
@click="handleClickEdit"
/>
</template>
</p-heading>
</p-heading-layout>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ const handleOpenEditQuery = () => {
>
{{ $t('INVENTORY.METRIC_EXPLORER.DUPLICATE') }}
</p-button>
<p-button style-type="tertiary"
<p-button v-if="!storeState.isAdminMode"
style-type="tertiary"
icon-left="ic_plus_bold"
@click="handleOpenAddExampleModal"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ watch(() => route.params, async () => {
const targetNamespace = namespaceState.namespaces.find((item) => item.key === namespaceState.selectedMetric?.data.namespace_id);
metricExplorerPageStore.setSelectedNamespace({
label: targetNamespace?.name,
name: namespaceState.selectedMetric.data.namespace_id,
name: namespaceState.selectedMetric?.data.namespace_id,
group: targetNamespace?.data.group,
category: targetNamespace.data.category,
icon: targetNamespace.data.group === 'common' ? 'COMMON' : targetNamespace.data.icon,
Expand Down Expand Up @@ -311,7 +311,8 @@ watch(() => storeState.selectedNamespace, (selectedNamespace) => {
<p-tooltip v-for="(item, idx) of state.starredMenuSet"
:key="`asset-analysis-starred-${idx}`"
position="bottom"
:contents="item.favoriteOptions?.type === FAVORITE_TYPE.METRIC_EXAMPLE ? `${storeState.metrics[item.to?.params?.metricId || '']?.name} > ${item.label}` : item.label"
:contents="item.favoriteOptions?.type === FAVORITE_TYPE.METRIC_EXAMPLE ? `${storeState.metrics[item.to?.params?.metricId
|| '']?.name} > ${item.label}` : item.label"
>
<l-s-b-router-menu-item :item="item"
:idx="idx"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ const state = reactive({
}),
hasReadWriteAccess: computed<boolean|undefined>(() => storeState.pageAccessPermissionMap[state.selectedMenuId]?.write),
selectedId: computed<string|undefined>(() => {
const routeName = getProperRouteLocation({ name: ASSET_INVENTORY_ROUTE.METRIC_EXPLORER.DETAIL._NAME }).name;
if (!props.isDetailPage) return undefined;
if (route.name === ASSET_INVENTORY_ROUTE.METRIC_EXPLORER.DETAIL._NAME) return route.params.metricId;
if (route.name === routeName) return route.params.metricId;
return route.params.metricExampleId;
}),
inputValue: '',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
<script setup lang="ts">

import {
computed, reactive, watchEffect, ref, watch,
} from 'vue';

import { PTreeView, PI, PTextHighlighting } from '@cloudforet/mirinae';
import type { TreeDisplayMap, TreeNode } from '@cloudforet/mirinae/src/data-display/tree/tree-view/type';

import { useAppContextStore } from '@/store/app-context/app-context-store';

import FavoriteButton from '@/common/modules/favorites/favorite-button/FavoriteButton.vue';
import { FAVORITE_TYPE } from '@/common/modules/favorites/favorite-button/type';

import { gray } from '@/styles/colors';


const appContextStore = useAppContextStore();

interface Props {
metricItems: TreeNode[];
selectedId?: string;
Expand All @@ -18,10 +25,37 @@ interface Props {

const props = defineProps<Props>();

const storeState = reactive({
isAdminMode: computed<boolean>(() => appContextStore.getters.isAdminMode),
});

const filteredMetricItems = ref<TreeNode[]>([]);

watch(() => props.metricItems, (updatedMetricItems) => {
filteredMetricItems.value = updatedMetricItems.filter(((metricItem) => {
if (metricItem.data.is_managed) {
return true;
}
if (storeState.isAdminMode) {
return metricItem.data.data.resource_group === 'DOMAIN';
}
return metricItem.data.data.resource_group === 'WORKSPACE';
}));
}, { immediate: true, deep: true });

watchEffect(() => {
if (storeState.isAdminMode) {
props.metricItems.forEach((metricItem: TreeNode) => {
if (Object.keys(metricItem).includes(('children'))) {
delete metricItem.children;
}
});
}
});
</script>

<template>
<p-tree-view :tree-data="props.metricItems"
<p-tree-view :tree-data="filteredMetricItems"
:selected-id="props.selectedId"
:tree-display-map="props.treeDisplayMap"
use-default-indent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ watch(() => state.searchText, debounce(async (searchText) => {
:selected="state.selected"
disable-handler
use-fixed-menu-style
is-fixed-width
is-filterable
@click-button="handleClickCreateButton"
@click-show-more="handleClickShowMore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import type { NamespaceReferenceMap } from '@/store/reference/namespace-referenc
import { queryStringToArray, queryStringToObject, queryStringToString } from '@/lib/router-query-string';

import { useBreadcrumbs } from '@/common/composables/breadcrumbs';
import { useProperRouteLocation } from '@/common/composables/proper-route-location';
import type { FavoriteOptions } from '@/common/modules/favorites/favorite-button/type';
import { FAVORITE_TYPE } from '@/common/modules/favorites/favorite-button/type';
import { useGnbStore } from '@/common/modules/navigations/stores/gnb-store';
Expand All @@ -36,7 +35,6 @@ import type { MetricExplorerPageUrlQuery } from '@/services/asset-inventory/type

const gnbStore = useGnbStore();
const { breadcrumbs } = useBreadcrumbs();
const { getProperRouteLocation } = useProperRouteLocation();
const route = useRoute();
const router = useRouter();

Expand All @@ -56,10 +54,10 @@ const state = reactive({
const _targetMetric = metricExplorerPageState.metric;
return [
...(breadcrumbs.value.slice(0, breadcrumbs.value.length - 1)),
getProperRouteLocation({
{
name: `[${targetNamespace?.name}] ${state.currentMetricExample?.name ?? _targetMetric?.name}`,
path: state.currentMetricExampleId ? ASSET_INVENTORY_ROUTE.METRIC_EXPLORER.DETAIL.EXAMPLE._NAME : ASSET_INVENTORY_ROUTE.METRIC_EXPLORER.DETAIL._NAME,
}),
},
];
}),
metricFavoriteOptions: computed<FavoriteOptions>(() => ({
Expand Down
7 changes: 0 additions & 7 deletions apps/web/src/services/asset-inventory/routes/admin/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,6 @@ const adminAssetInventoryRoute: RouteConfig = {
props: true,
component: MetricExplorerDetailPage as any,
},
{
path: ':metricExampleId',
name: makeAdminRouteName(ASSET_INVENTORY_ROUTE.METRIC_EXPLORER.DETAIL.EXAMPLE._NAME),
meta: { label: ({ params }) => params.metricExampleId, lsbVisible: true },
props: true,
component: MetricExplorerDetailPage as any,
},
],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const workspaceMenuHandler: AutocompleteHandler = async (inputText: string, page
:search-text.sync="dropdownState.searchText"
show-select-marker
is-filterable
is-fixed-width
:handler="workspaceMenuHandler"
class="workspace-select-dropdown"
@select="handleSelectDropdownItem"
Expand All @@ -161,7 +162,7 @@ const workspaceMenuHandler: AutocompleteHandler = async (inputText: string, page
:theme="getWorkspaceInfo(dropdownState.selectedMenuId)?.tags?.theme"
size="xs"
/>
<span>{{ getWorkspaceInfo(dropdownState.selectedMenuId)?.name || '' }}</span>
<span class="label">{{ getWorkspaceInfo(dropdownState.selectedMenuId)?.name || '' }}</span>
</div>
<span v-else
class="select"
Expand All @@ -173,7 +174,7 @@ const workspaceMenuHandler: AutocompleteHandler = async (inputText: string, page
:theme="getWorkspaceInfo(item.name)?.tags?.theme"
size="xs"
/>
<span>{{ item.label }}</span>
<span class="label">{{ item.label }}</span>
<span class="state"
:class="[getWorkspaceInfo(item.name)?.state.toLowerCase()]"
/>
Expand Down Expand Up @@ -202,7 +203,11 @@ const workspaceMenuHandler: AutocompleteHandler = async (inputText: string, page
.workspace-select-dropdown {
.workspace-wrapper {
@apply flex items-center;
width: 100%;
gap: 0.25rem;
.label {
@apply truncate;
}
}
.select {
@apply text-gray-600;
Expand All @@ -221,6 +226,10 @@ const workspaceMenuHandler: AutocompleteHandler = async (inputText: string, page
@apply bg-gray-300;
}
}
.label {
@apply truncate;
max-width: 21rem;
}
.description {
@apply text-label-md text-gray-500;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getApiQueryWithToolboxOptions } from '@cloudforet/core-lib/component-ut
import type { ConsoleFilter } from '@cloudforet/core-lib/query/type';
import { ApiQueryHelper } from '@cloudforet/core-lib/space-connector/helper';
import {
PButton, PHeading,
PButton, PHeading, PHeadingLayout,
} from '@cloudforet/mirinae';
import type { ToolboxOptions } from '@cloudforet/mirinae/types/controls/toolbox/type';

Expand Down Expand Up @@ -152,14 +152,16 @@ onUnmounted(() => {

<template>
<div class="data-source-management-tab-linked-account">
<p-heading heading-type="sub"
use-total-count
use-selected-count
:selected-count="storeState.selectedLinkedAccountsIndices.length"
:title="$t('BILLING.COST_MANAGEMENT.DATA_SOURCES.TAB_LINKED_ACCOUNT_TITLE')"
:total-count="storeState.linkedAccountsTotalCount"
class="pt-8 px-4 pb-4"
>
<p-heading-layout class="pt-8 px-4 pb-4">
<template #heading>
<p-heading heading-type="sub"
use-total-count
use-selected-count
:selected-count="storeState.selectedLinkedAccountsIndices.length"
:title="$t('BILLING.COST_MANAGEMENT.DATA_SOURCES.TAB_LINKED_ACCOUNT_TITLE')"
:total-count="storeState.linkedAccountsTotalCount"
/>
</template>
<template v-if="props.hasReadWriteAccess"
#extra
>
Expand All @@ -178,7 +180,7 @@ onUnmounted(() => {
</p-button>
</div>
</template>
</p-heading>
</p-heading-layout>
<data-source-management-tab-linked-account-table :has-read-write-access="props.hasReadWriteAccess"
@confirm="handleChangeLinkedAccountToolbox"
@select-filter="handleChangedSelectFilter"
Expand All @@ -191,13 +193,9 @@ onUnmounted(() => {

<style lang="postcss" scoped>
.data-source-management-tab-linked-account {
.title {
@apply items-center;
margin-bottom: 0;
.extra-wrapper {
@apply flex;
gap: 0.5rem;
}
.extra-wrapper {
@apply flex;
gap: 0.5rem;
}
}
</style>
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/services/info/components/NoticeForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ watch([() => noticeDetailState.post, () => noticeDetailState.loading], async ([n
<notice-workspace-dropdown v-if="workspaceState.selectedRadioIdx === 1"
:selected-items.sync="workspaceState.selectedItems"
:type="props.type"
class="workspace-dropdown"
/>
</p-field-group>
<p-field-group class="notice-label-wrapper"
Expand Down Expand Up @@ -293,6 +294,10 @@ watch([() => noticeDetailState.post, () => noticeDetailState.loading], async ([n
.notice-create-options-wrapper {
@apply flex flex-col gap-2;
}

.workspace-dropdown {
width: 50%;
}
}
.notice-create-buttons-wrapper {
@apply inline-flex float-right mt-4;
Expand Down
Loading
Loading