From e160ec78aba91dd7b6ecd89c50a9350ce1c0774f Mon Sep 17 00:00:00 2001 From: nayeongkim Date: Tue, 10 Dec 2024 11:30:05 +0900 Subject: [PATCH 1/4] feat: create current menu id custom hook Signed-off-by: NaYeong,Kim --- .../composables/current-menu-id/index.ts | 19 +++++++++++++++++++ .../navigations/gnb/GNBNavigationRail.vue | 14 +++----------- .../top-bar-header/TopBarWorkspaces.vue | 9 +++------ .../web/src/services/advanced/AdvancedLSB.vue | 13 +++---------- .../asset-inventory/AssetInventoryLSB.vue | 13 +++---------- .../cost-explorer/CostExplorerLSB.vue | 12 +++--------- 6 files changed, 34 insertions(+), 46 deletions(-) create mode 100644 apps/web/src/common/composables/current-menu-id/index.ts diff --git a/apps/web/src/common/composables/current-menu-id/index.ts b/apps/web/src/common/composables/current-menu-id/index.ts new file mode 100644 index 0000000000..b34a729948 --- /dev/null +++ b/apps/web/src/common/composables/current-menu-id/index.ts @@ -0,0 +1,19 @@ +import { useRoute } from 'vue-router/composables'; + +import { clone } from 'lodash'; + +import { MENU_ID } from '@/lib/menu/config'; + + +import { COST_EXPLORER_ROUTE } from '@/services/cost-explorer/routes/route-constant'; + +export const useCurrentMenuId = (): string => { + const route = useRoute(); + const reversedMatched = clone(route.matched).reverse(); + const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); + const targetMenuId = closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; + if (route.name === COST_EXPLORER_ROUTE.LANDING._NAME) { + return ''; + } + return targetMenuId; +}; diff --git a/apps/web/src/common/modules/navigations/gnb/GNBNavigationRail.vue b/apps/web/src/common/modules/navigations/gnb/GNBNavigationRail.vue index d2104c5241..3a370213dd 100644 --- a/apps/web/src/common/modules/navigations/gnb/GNBNavigationRail.vue +++ b/apps/web/src/common/modules/navigations/gnb/GNBNavigationRail.vue @@ -5,7 +5,7 @@ import { } from 'vue'; import { useRoute, useRouter } from 'vue-router/composables'; -import { clone, isEmpty } from 'lodash'; +import { isEmpty } from 'lodash'; import { PI, screens, PButton, PTextButton, PTooltip, @@ -24,6 +24,7 @@ import { MENU_ID } from '@/lib/menu/config'; import BetaMark from '@/common/components/marks/BetaMark.vue'; import NewMark from '@/common/components/marks/NewMark.vue'; import UpdateMark from '@/common/components/marks/UpdateMark.vue'; +import { useCurrentMenuId } from '@/common/composables/current-menu-id'; import { useProperRouteLocation } from '@/common/composables/proper-route-location'; import { useGnbStore } from '@/common/modules/navigations/stores/gnb-store'; @@ -88,15 +89,6 @@ const state = reactive({ }); return result; }), - selectedMenuId: computed(() => { - const reversedMatched = clone(route.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - const targetMenuId: string = closestRoute?.name || closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; - if (route.name === COST_EXPLORER_ROUTE.LANDING._NAME) { - return ''; - } - return targetMenuId; - }), }); const handleMouseEvent = (value: boolean) => { @@ -165,7 +157,7 @@ onMounted(async () => { :to="(item.type === 'header' && item.subMenuList?.length > 0) ? '' : item.to" class="service-menu" :class="{ - 'is-selected': state.selectedMenuId.split('.').includes(item.id) && item.type !== 'header', + 'is-selected': useCurrentMenuId().split('.').includes(item.id) && item.type !== 'header', 'is-only-label': item.type === 'header' && item.subMenuList?.length > 0 }" > diff --git a/apps/web/src/common/modules/navigations/top-bar/modules/top-bar-header/TopBarWorkspaces.vue b/apps/web/src/common/modules/navigations/top-bar/modules/top-bar-header/TopBarWorkspaces.vue index 3d8d6cc4e6..0ac1cff949 100644 --- a/apps/web/src/common/modules/navigations/top-bar/modules/top-bar-header/TopBarWorkspaces.vue +++ b/apps/web/src/common/modules/navigations/top-bar/modules/top-bar-header/TopBarWorkspaces.vue @@ -5,7 +5,7 @@ import { import type { Location } from 'vue-router'; import { useRouter } from 'vue-router/composables'; -import { clone, sortBy } from 'lodash'; +import { sortBy } from 'lodash'; import { PSelectDropdown, PTooltip, PI, PButton, PTextHighlighting, PEmpty, @@ -21,10 +21,9 @@ import { useUserWorkspaceStore } from '@/store/app-context/workspace/user-worksp import type { ReferenceData } from '@/lib/helper/config-data-helper'; import { convertWorkspaceConfigToReferenceData } from '@/lib/helper/config-data-helper'; -import type { MenuId } from '@/lib/menu/config'; -import { MENU_ID } from '@/lib/menu/config'; import { MENU_INFO_MAP } from '@/lib/menu/menu-info'; +import { useCurrentMenuId } from '@/common/composables/current-menu-id'; import FavoriteButton from '@/common/modules/favorites/favorite-button/FavoriteButton.vue'; import { useFavoriteStore } from '@/common/modules/favorites/favorite-button/store/favorite-store'; import type { FavoriteItem } from '@/common/modules/favorites/favorite-button/type'; @@ -80,9 +79,7 @@ const selectWorkspace = (name: string): void => { if (!workspaceId || workspaceId === storeState.currentWorkspaceId) return; appContextStore.setGlobalGrantLoading(true); - const reversedMatched = clone(router.currentRoute.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - const targetMenuId: MenuId = closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; + const targetMenuId: string = useCurrentMenuId(); userWorkspaceStore.setCurrentWorkspace(workspaceId); router.push({ name: MENU_INFO_MAP[targetMenuId].routeName, params: { workspaceId } }).catch(() => {}); }; diff --git a/apps/web/src/services/advanced/AdvancedLSB.vue b/apps/web/src/services/advanced/AdvancedLSB.vue index 4842eec352..1225523c98 100644 --- a/apps/web/src/services/advanced/AdvancedLSB.vue +++ b/apps/web/src/services/advanced/AdvancedLSB.vue @@ -1,22 +1,15 @@ diff --git a/apps/web/src/services/asset-inventory/AssetInventoryLSB.vue b/apps/web/src/services/asset-inventory/AssetInventoryLSB.vue index 0655e639af..b4415e126a 100644 --- a/apps/web/src/services/asset-inventory/AssetInventoryLSB.vue +++ b/apps/web/src/services/asset-inventory/AssetInventoryLSB.vue @@ -1,23 +1,16 @@ diff --git a/apps/web/src/services/cost-explorer/CostExplorerLSB.vue b/apps/web/src/services/cost-explorer/CostExplorerLSB.vue index 1e4a608375..5082482e96 100644 --- a/apps/web/src/services/cost-explorer/CostExplorerLSB.vue +++ b/apps/web/src/services/cost-explorer/CostExplorerLSB.vue @@ -2,23 +2,17 @@ import { computed, reactive } from 'vue'; import { useRoute } from 'vue-router/composables'; -import { clone } from 'lodash'; - -import type { MenuId } from '@/lib/menu/config'; import { MENU_ID } from '@/lib/menu/config'; +import { useCurrentMenuId } from '@/common/composables/current-menu-id'; + import CostAdvancedSettingsLSB from '@/services/cost-explorer/components/CostAdvancedSettingsLSB.vue'; import CostAnalysisLSB from '@/services/cost-explorer/components/CostAnalysisLSB.vue'; const route = useRoute(); const state = reactive({ - selectedMenuId: computed(() => { - const reversedMatched = clone(route.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - const targetMenuId: MenuId = closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; - return targetMenuId; - }), + selectedMenuId: computed(() => useCurrentMenuId()), }); From ee75237c2a9f03dc756bb7aed05db05947764c52 Mon Sep 17 00:00:00 2001 From: nayeongkim Date: Tue, 10 Dec 2024 11:30:40 +0900 Subject: [PATCH 2/4] feat: create page editable status custom hook Signed-off-by: NaYeong,Kim --- .../composables/page-editable-status/index.ts | 18 +++++ .../components/BookmarkDetailContainer.vue | 24 +----- .../BookmarkManagementDetailTable.vue | 23 +----- .../components/WorkspaceGroupTabGroupUser.vue | 20 +---- .../components/WorkspaceGroupTabWorkspace.vue | 19 +---- .../pages/admin/AdminBookmarkPage.vue | 26 +------ .../AdminDomainSettingsAppearancePage.vue | 30 +------ ...nSettingsAutoDormancyConfigurationPage.vue | 26 +------ ...minDomainSettingsDomainInformationPage.vue | 26 +------ .../pages/admin/AdminWorkspaceGroupPage.vue | 21 +---- .../pages/admin/AdminWorkspacesPage.vue | 26 +------ .../alert-manager/pages/AlertDetailPage.vue | 27 +------ .../pages/EscalationPolicyPage.vue | 25 +----- .../CloudServiceHistoryDetailNoteTab.vue | 28 +------ .../components/CollectorMainContents.vue | 23 +----- .../components/MetricExplorerHeader.vue | 22 +----- .../components/MetricExplorerLSBMetric.vue | 23 +----- .../pages/CollectorDetailPage.vue | 27 +------ .../pages/ServiceAccountDetailPage.vue | 24 +----- .../pages/ServiceAccountPage.vue | 19 +---- .../pages/admin/AdminCollectorDetailPage.vue | 32 +------- .../components/BudgetDetailHeading.vue | 23 +----- .../components/CostAnalysisHeader.vue | 24 +----- .../components/CostAnalysisQuerySection.vue | 25 +----- .../components/DataSourceManagementTabs.vue | 25 +----- .../cost-explorer/pages/BudgetMainPage.vue | 22 +----- .../cost-explorer/pages/CostReportPage.vue | 28 +------ ...tingsAnomalyDetectionConfigurationPage.vue | 78 +++++++------------ .../pages/admin/AdminBudgetMainPage.vue | 27 +------ .../src/services/dashboards/DashboardsLSB.vue | 16 +--- .../dashboards/pages/DashboardsMainPage.vue | 20 +---- .../src/services/iam/pages/AppMainPage.vue | 24 +----- .../src/services/iam/pages/UserMainPage.vue | 23 +----- .../iam/pages/admin/AdminRolePage.vue | 29 +------ .../pages/admin/AdminNoticeDetailPage.vue | 23 +----- .../info/pages/admin/AdminNoticeMainPage.vue | 22 +----- .../components/DomainLandingStartBanner.vue | 17 +--- .../workspace-landing/LandingContents.vue | 24 +----- 38 files changed, 141 insertions(+), 818 deletions(-) create mode 100644 apps/web/src/common/composables/page-editable-status/index.ts diff --git a/apps/web/src/common/composables/page-editable-status/index.ts b/apps/web/src/common/composables/page-editable-status/index.ts new file mode 100644 index 0000000000..ccf767d09a --- /dev/null +++ b/apps/web/src/common/composables/page-editable-status/index.ts @@ -0,0 +1,18 @@ +import { computed, reactive } from 'vue'; + +import { useUserStore } from '@/store/user/user-store'; + +import type { PageAccessMap } from '@/lib/access-control/config'; + +import { useCurrentMenuId } from '@/common/composables/current-menu-id'; + +export const usePageEditableStatus = (): boolean|undefined => { + const userStore = useUserStore(); + const userGetters = userStore.getters; + + const storeState = reactive({ + pageAccessPermissionMap: computed(() => userGetters.pageAccessPermissionMap), + }); + + return storeState.pageAccessPermissionMap[useCurrentMenuId()]?.write; +}; diff --git a/apps/web/src/services/advanced/components/BookmarkDetailContainer.vue b/apps/web/src/services/advanced/components/BookmarkDetailContainer.vue index dbec189d9e..811035b1ab 100644 --- a/apps/web/src/services/advanced/components/BookmarkDetailContainer.vue +++ b/apps/web/src/services/advanced/components/BookmarkDetailContainer.vue @@ -6,7 +6,7 @@ import { import type { TranslateResult } from 'vue-i18n'; import { useRoute, useRouter } from 'vue-router/composables'; -import { at, clone } from 'lodash'; +import { at } from 'lodash'; import { PHeading, PButton, PContextMenu, PI, PIconButton, PStatus, PHeadingLayout, @@ -18,15 +18,10 @@ import { i18n } from '@/translations'; import { makeAdminRouteName } from '@/router/helpers/route-helper'; -import { useUserStore } from '@/store/user/user-store'; - -import type { PageAccessMap } from '@/lib/access-control/config'; -import type { MenuId } from '@/lib/menu/config'; -import { MENU_ID } from '@/lib/menu/config'; - import { BOOKMARK_MODAL_TYPE } from '@/common/components/bookmark/constant/constant'; import { useBookmarkStore } from '@/common/components/bookmark/store/bookmark-store'; import type { BookmarkModalType, BookmarkItem } from '@/common/components/bookmark/type/type'; +import { usePageEditableStatus } from '@/common/composables/page-editable-status'; import WorkspaceLogoIcon from '@/common/modules/navigations/top-bar/modules/top-bar-header/WorkspaceLogoIcon.vue'; import { gray } from '@/styles/colors'; @@ -35,11 +30,8 @@ import { getWorkspaceInfo, workspaceStateFormatter } from '@/services/advanced/c import { WORKSPACE_STATE } from '@/services/advanced/constants/workspace-constant'; import { ADVANCED_ROUTE } from '@/services/advanced/routes/route-constant'; import { useBookmarkPageStore } from '@/services/advanced/store/bookmark-page-store'; -import { COST_EXPLORER_ROUTE } from '@/services/cost-explorer/routes/route-constant'; import { WORKSPACE_HOME_ROUTE } from '@/services/workspace-home/routes/route-constant'; - -const userStore = useUserStore(); const bookmarkStore = useBookmarkStore(); const bookmarkState = bookmarkStore.state; const bookmarkPageStore = useBookmarkPageStore(); @@ -56,7 +48,6 @@ const storeState = reactive({ selectedIndices: computed(() => bookmarkPageState.selectedIndices), bookmarkFolderList: computed(() => bookmarkPageState.bookmarkFolderList), bookmarkList: computed(() => bookmarkPageGetters.bookmarkList), - pageAccessPermissionMap: computed(() => userStore.getters.pageAccessPermissionMap), }); const state = reactive({ visibleMenu: false, @@ -83,16 +74,7 @@ const state = reactive({ return state.workspaceInfo?.name || ''; }), workspaceInfo: computed(() => getWorkspaceInfo(state.group, storeState.workspaceList)), - selectedMenuId: computed(() => { - const reversedMatched = clone(route.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - const targetMenuId: MenuId = closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; - if (route.name === COST_EXPLORER_ROUTE.LANDING._NAME) { - return ''; - } - return targetMenuId; - }), - hasReadWriteAccess: computed(() => storeState.pageAccessPermissionMap[state.selectedMenuId]?.write), + hasReadWriteAccess: computed(() => usePageEditableStatus()), }); const hideMenu = () => { diff --git a/apps/web/src/services/advanced/components/BookmarkManagementDetailTable.vue b/apps/web/src/services/advanced/components/BookmarkManagementDetailTable.vue index c9ab3362b1..c8043a2e15 100644 --- a/apps/web/src/services/advanced/components/BookmarkManagementDetailTable.vue +++ b/apps/web/src/services/advanced/components/BookmarkManagementDetailTable.vue @@ -2,8 +2,6 @@ import { computed, reactive, watch } from 'vue'; import { useRoute, useRouter } from 'vue-router/composables'; -import { clone } from 'lodash'; - import type { ConsoleFilter } from '@cloudforet/core-lib/query/type'; import { PToolboxTable, PLazyImg, PI, PDataLoader, PSelectStatus, PSelectDropdown, @@ -20,15 +18,10 @@ import { i18n } from '@/translations'; import { makeAdminRouteName } from '@/router/helpers/route-helper'; -import { useUserStore } from '@/store/user/user-store'; - -import type { PageAccessMap } from '@/lib/access-control/config'; -import type { MenuId } from '@/lib/menu/config'; -import { MENU_ID } from '@/lib/menu/config'; - import { BOOKMARK_MODAL_TYPE } from '@/common/components/bookmark/constant/constant'; import { useBookmarkStore } from '@/common/components/bookmark/store/bookmark-store'; import type { BookmarkItem } from '@/common/components/bookmark/type/type'; +import { usePageEditableStatus } from '@/common/composables/page-editable-status'; import { gray } from '@/styles/colors'; @@ -36,13 +29,11 @@ import { makeSearchQueryTagsHandler, makeValueHandler } from '@/services/advance import { BOOKMARK_TYPE, PageSizeOptions } from '@/services/advanced/constants/bookmark-constant'; import { ADVANCED_ROUTE } from '@/services/advanced/routes/route-constant'; import { useBookmarkPageStore } from '@/services/advanced/store/bookmark-page-store'; -import { COST_EXPLORER_ROUTE } from '@/services/cost-explorer/routes/route-constant'; const bookmarkStore = useBookmarkStore(); const bookmarkPageStore = useBookmarkPageStore(); const bookmarkPageState = bookmarkPageStore.state; const bookmarkPageGetters = bookmarkPageStore.getters; -const userStore = useUserStore(); const route = useRoute(); const router = useRouter(); @@ -57,21 +48,11 @@ const storeState = reactive({ loading: computed(() => bookmarkPageState.loading), selectedType: computed(() => bookmarkPageState.selectedType), searchFilter: computed(() => bookmarkPageState.searchFilter), - pageAccessPermissionMap: computed(() => userStore.getters.pageAccessPermissionMap), }); const state = reactive({ group: computed(() => route.params.group), folder: computed(() => route.params.folder), - selectedMenuId: computed(() => { - const reversedMatched = clone(route.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - const targetMenuId: MenuId = closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; - if (route.name === COST_EXPLORER_ROUTE.LANDING._NAME) { - return ''; - } - return targetMenuId; - }), - hasReadWriteAccess: computed(() => storeState.pageAccessPermissionMap[state.selectedMenuId]?.write), + hasReadWriteAccess: computed(() => usePageEditableStatus()), }); const tableState = reactive({ fields: computed(() => [ diff --git a/apps/web/src/services/advanced/components/WorkspaceGroupTabGroupUser.vue b/apps/web/src/services/advanced/components/WorkspaceGroupTabGroupUser.vue index b78a120a35..888bcd4917 100644 --- a/apps/web/src/services/advanced/components/WorkspaceGroupTabGroupUser.vue +++ b/apps/web/src/services/advanced/components/WorkspaceGroupTabGroupUser.vue @@ -2,9 +2,6 @@ import { reactive, watch, onUnmounted, computed, } from 'vue'; -import { useRoute } from 'vue-router/composables'; - -import { clone } from 'lodash'; import { SpaceConnector } from '@cloudforet/core-lib/space-connector'; import { @@ -21,12 +18,10 @@ import type { WorkspaceGroupUpdateRoleParameters } from '@/schema/identity/works import type { WorkspaceUser } from '@/schema/identity/workspace-group/model'; import { i18n } from '@/translations'; -import { useUserStore } from '@/store/user/user-store'; - -import type { PageAccessMap } from '@/lib/access-control/config'; import { showSuccessMessage } from '@/lib/helper/notice-alert-helper'; import ErrorHandler from '@/common/composables/error/errorHandler'; +import { usePageEditableStatus } from '@/common/composables/page-editable-status'; import { useRoleFormatter, groupUserStateFormatter } from '@/services/advanced/composables/refined-table-data'; import { useSelectDropDownList } from '@/services/advanced/composables/use-select-drop-down-list'; @@ -37,22 +32,11 @@ const workspaceGroupPageStore = useWorkspaceGroupPageStore(); const workspaceGroupPageState = workspaceGroupPageStore.state; const userTabState = workspaceGroupPageStore.userTabState; const workspaceGroupPageGetters = workspaceGroupPageStore.getters; -const userStore = useUserStore(); - -const route = useRoute(); const emit = defineEmits<{(e: 'refresh', payload: { isGroupUser?: boolean, isWorkspace?: boolean }): void; }>(); -const storeState = reactive({ - pageAccessPermissionMap: computed(() => userStore.getters.pageAccessPermissionMap), -}); const state = reactive({ - selectedMenuId: computed(() => { - const reversedMatched = clone(route.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - return closestRoute?.meta?.menuId; - }), - hasReadWriteAccess: computed(() => storeState.pageAccessPermissionMap[state.selectedMenuId]?.write), + hasReadWriteAccess: computed(() => usePageEditableStatus()), }); const tableState = reactive({ fields: computed(() => { diff --git a/apps/web/src/services/advanced/components/WorkspaceGroupTabWorkspace.vue b/apps/web/src/services/advanced/components/WorkspaceGroupTabWorkspace.vue index 703f4741f1..f6e7b72ad2 100644 --- a/apps/web/src/services/advanced/components/WorkspaceGroupTabWorkspace.vue +++ b/apps/web/src/services/advanced/components/WorkspaceGroupTabWorkspace.vue @@ -2,10 +2,8 @@ import { computed, onMounted, reactive, watch, } from 'vue'; -import { useRoute } from 'vue-router/composables'; import dayjs from 'dayjs'; -import { clone } from 'lodash'; import { PButton, PHeading, PI, PLink, PStatus, PToolboxTable, PTooltip, PHeadingLayout, @@ -22,8 +20,7 @@ import { useAllReferenceStore } from '@/store/reference/all-reference-store'; import type { WorkspaceReferenceMap } from '@/store/reference/workspace-reference-store'; import { useUserStore } from '@/store/user/user-store'; -import type { PageAccessMap } from '@/lib/access-control/config'; - +import { usePageEditableStatus } from '@/common/composables/page-editable-status'; import WorkspaceLogoIcon from '@/common/modules/navigations/top-bar/modules/top-bar-header/WorkspaceLogoIcon.vue'; import { gray } from '@/styles/colors'; @@ -35,7 +32,6 @@ import { ASSET_INVENTORY_ROUTE } from '@/services/asset-inventory/routes/route-c import { IAM_ROUTE } from '@/services/iam/routes/route-constant'; import { WORKSPACE_HOME_ROUTE } from '@/services/workspace-home/routes/route-constant'; - const workspaceGroupPageStore = useWorkspaceGroupPageStore(); const workspaceGroupPageState = workspaceGroupPageStore.state; const workspaceTabState = workspaceGroupPageStore.workspaceTabState; @@ -43,23 +39,12 @@ const workspaceGroupPageGetters = workspaceGroupPageStore.getters; const allReferenceStore = useAllReferenceStore(); const userStore = useUserStore(); -const route = useRoute(); - -const storeState = reactive({ - pageAccessPermissionMap: computed(() => userStore.getters.pageAccessPermissionMap), -}); - interface WorkspaceTableItem extends WorkspaceModel { remove_button: WorkspaceModel; } const state = reactive({ - selectedMenuId: computed(() => { - const reversedMatched = clone(route.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - return closestRoute?.meta?.menuId; - }), - hasReadWriteAccess: computed(() => storeState.pageAccessPermissionMap[state.selectedMenuId]?.write), + hasReadWriteAccess: computed(() => usePageEditableStatus()), currency: computed(() => workspaceGroupPageGetters.currency), }); const tableState = reactive({ diff --git a/apps/web/src/services/advanced/pages/admin/AdminBookmarkPage.vue b/apps/web/src/services/advanced/pages/admin/AdminBookmarkPage.vue index 62599bc5a7..2445f6e040 100644 --- a/apps/web/src/services/advanced/pages/admin/AdminBookmarkPage.vue +++ b/apps/web/src/services/advanced/pages/admin/AdminBookmarkPage.vue @@ -3,9 +3,8 @@ import { vOnClickOutside } from '@vueuse/components'; import { computed, reactive, } from 'vue'; -import { useRoute } from 'vue-router/composables'; -import { at, clone } from 'lodash'; +import { at } from 'lodash'; import { PHeading, PButton, PContextMenu, PHeadingLayout, @@ -14,28 +13,19 @@ import type { MenuItem } from '@cloudforet/mirinae/src/controls/context-menu/typ import { i18n } from '@/translations'; -import { useUserStore } from '@/store/user/user-store'; - -import type { PageAccessMap } from '@/lib/access-control/config'; -import type { MenuId } from '@/lib/menu/config'; -import { MENU_ID } from '@/lib/menu/config'; - import { BOOKMARK_MODAL_TYPE } from '@/common/components/bookmark/constant/constant'; import { useBookmarkStore } from '@/common/components/bookmark/store/bookmark-store'; import type { BookmarkModalType, BookmarkItem } from '@/common/components/bookmark/type/type'; +import { usePageEditableStatus } from '@/common/composables/page-editable-status'; import BookmarkManagementTable from '@/services/advanced/components/BookmarkManagementTable.vue'; import { useBookmarkPageStore } from '@/services/advanced/store/bookmark-page-store'; -import { COST_EXPLORER_ROUTE } from '@/services/cost-explorer/routes/route-constant'; const bookmarkStore = useBookmarkStore(); const bookmarkState = bookmarkStore.state; const bookmarkPageStore = useBookmarkPageStore(); const bookmarkPageState = bookmarkPageStore.state; const bookmarkPageGetters = bookmarkPageStore.getters; -const userStore = useUserStore(); - -const route = useRoute(); const storeState = reactive({ modalType: computed(() => bookmarkState.modal.type), @@ -43,7 +33,6 @@ const storeState = reactive({ bookmarkFolderList: computed(() => bookmarkPageState.bookmarkFolderList), bookmarkList: computed(() => bookmarkPageGetters.bookmarkList), selectedIndices: computed(() => bookmarkPageGetters.selectedIndices), - pageAccessPermissionMap: computed(() => userStore.getters.pageAccessPermissionMap), }); const state = reactive({ visibleMenu: false, @@ -57,16 +46,7 @@ const state = reactive({ name: BOOKMARK_MODAL_TYPE.FOLDER, }, ])), - selectedMenuId: computed(() => { - const reversedMatched = clone(route.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - const targetMenuId: MenuId = closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; - if (route.name === COST_EXPLORER_ROUTE.LANDING._NAME) { - return ''; - } - return targetMenuId; - }), - hasReadWriteAccess: computed(() => storeState.pageAccessPermissionMap[state.selectedMenuId]?.write), + hasReadWriteAccess: computed(() => usePageEditableStatus()), }); const hideMenu = () => { diff --git a/apps/web/src/services/advanced/pages/admin/AdminDomainSettingsAppearancePage.vue b/apps/web/src/services/advanced/pages/admin/AdminDomainSettingsAppearancePage.vue index 03742c58fa..d16345bdfc 100644 --- a/apps/web/src/services/advanced/pages/admin/AdminDomainSettingsAppearancePage.vue +++ b/apps/web/src/services/advanced/pages/admin/AdminDomainSettingsAppearancePage.vue @@ -1,8 +1,6 @@ diff --git a/apps/web/src/services/landing/components/workspace-landing/LandingContents.vue b/apps/web/src/services/landing/components/workspace-landing/LandingContents.vue index 7e177184b8..a904319ca0 100644 --- a/apps/web/src/services/landing/components/workspace-landing/LandingContents.vue +++ b/apps/web/src/services/landing/components/workspace-landing/LandingContents.vue @@ -3,9 +3,9 @@ import { useWindowSize } from '@vueuse/core'; import { computed, onMounted, onUnmounted, reactive, } from 'vue'; -import { useRoute, useRouter } from 'vue-router/composables'; +import { useRouter } from 'vue-router/composables'; -import { clone, sortBy } from 'lodash'; +import { sortBy } from 'lodash'; import { PButton, PDataLoader, PDivider, screens, @@ -18,10 +18,7 @@ import { makeAdminRouteName } from '@/router/helpers/route-helper'; import { useUserWorkspaceStore } from '@/store/app-context/workspace/user-workspace-store'; import { useUserStore } from '@/store/user/user-store'; -import type { PageAccessMap } from '@/lib/access-control/config'; -import type { MenuId } from '@/lib/menu/config'; -import { MENU_ID } from '@/lib/menu/config'; - +import { usePageEditableStatus } from '@/common/composables/page-editable-status'; import { useFavoriteStore } from '@/common/modules/favorites/favorite-button/store/favorite-store'; import type { FavoriteItem } from '@/common/modules/favorites/favorite-button/type'; import { useRecentStore } from '@/common/modules/navigations/stores/recent-store'; @@ -31,7 +28,6 @@ import { RECENT_TYPE } from '@/common/modules/navigations/type'; import { gray } from '@/styles/colors'; import { ADVANCED_ROUTE } from '@/services/advanced/routes/route-constant'; -import { COST_EXPLORER_ROUTE } from '@/services/cost-explorer/routes/route-constant'; import LandingGroupWorkspaces from '@/services/landing/components/workspace-landing/landing-group-workspaces/LandingGroupWorkspaces.vue'; import LandingAllWorkspaces from '@/services/landing/components/workspace-landing/LandingAllWorkspaces.vue'; import LandingEmptyContents from '@/services/landing/components/workspace-landing/LandingEmptyContents.vue'; @@ -39,7 +35,6 @@ import LandingRecentVisits from '@/services/landing/components/workspace-landing import LandingSearch from '@/services/landing/components/workspace-landing/LandingSearch.vue'; import { useLandingPageStore } from '@/services/landing/store/landing-page-store'; - const userWorkspaceStore = useUserWorkspaceStore(); const workspaceStoreGetters = userWorkspaceStore.getters; const favoriteStore = useFavoriteStore(); @@ -50,7 +45,6 @@ const landingPageStore = useLandingPageStore(); const landingPageStoreGetters = landingPageStore.getters; const router = useRouter(); -const route = useRoute(); const { width } = useWindowSize(); const userStore = useUserStore(); @@ -65,7 +59,6 @@ const storeState = reactive({ workspaceId: i.data.workspace_id, itemId: i.data.id, }))), - pageAccessPermissionMap: computed(() => userStore.getters.pageAccessPermissionMap), }); const state = reactive({ searchText: '', @@ -75,16 +68,7 @@ const state = reactive({ ? storeState.workspaceList.filter((item) => item.name.toLowerCase()?.includes(state.searchText.toLowerCase())) : storeState.workspaceList)), refinedWorkspaceList: computed(() => (state.searchText ? state.searchedWorkspaceList : storeState.workspaceList)), - selectedMenuId: computed(() => { - const reversedMatched = clone(route.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - const targetMenuId: MenuId = closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; - if (route.name === COST_EXPLORER_ROUTE.LANDING._NAME) { - return ''; - } - return targetMenuId; - }), - hasReadWriteAccess: computed(() => storeState.pageAccessPermissionMap[state.selectedMenuId]?.write), + hasReadWriteAccess: computed(() => usePageEditableStatus()), }); const handleSearch = (value: string) => { From 5d32a855f43550aefa9d5409c5d27a6e423ed1e6 Mon Sep 17 00:00:00 2001 From: nayeongkim Date: Tue, 10 Dec 2024 11:40:43 +0900 Subject: [PATCH 3/4] chore: remove anomaly-detection menu Signed-off-by: NaYeong,Kim --- apps/web/src/lib/access-control/config.ts | 2 -- apps/web/src/lib/helper/config-data-helper.ts | 22 ------------------- apps/web/src/lib/menu/config.ts | 1 - apps/web/src/lib/menu/menu-architecture.ts | 1 - apps/web/src/lib/menu/menu-info.ts | 7 ------ .../cost-explorer/routes/route-constant.ts | 13 ----------- 6 files changed, 46 deletions(-) diff --git a/apps/web/src/lib/access-control/config.ts b/apps/web/src/lib/access-control/config.ts index 5d9a7b537a..7b71c8c132 100644 --- a/apps/web/src/lib/access-control/config.ts +++ b/apps/web/src/lib/access-control/config.ts @@ -31,7 +31,6 @@ export const WORKSPACE_OWNER_DEFAULT_PERMISSIONS: MenuId[] = [ MENU_ID.SERVICE_ACCOUNT, MENU_ID.COST_EXPLORER, MENU_ID.COST_ANALYSIS, - // MENU_ID.ANOMALY_DETECTION, MENU_ID.BUDGET, MENU_ID.COST_REPORT, MENU_ID.ALERT_MANAGER_DASHBOARD, @@ -59,7 +58,6 @@ export const WORKSPACE_MEMBER_DEFAULT_PERMISSIONS: MenuId[] = [ MENU_ID.SERVICE_ACCOUNT, MENU_ID.COST_EXPLORER, MENU_ID.COST_ANALYSIS, - // MENU_ID.ANOMALY_DETECTION, MENU_ID.BUDGET, MENU_ID.ALERT_MANAGER_DASHBOARD, MENU_ID.ALERT_MANAGER, diff --git a/apps/web/src/lib/helper/config-data-helper.ts b/apps/web/src/lib/helper/config-data-helper.ts index 03b4bbe998..5011ba3617 100644 --- a/apps/web/src/lib/helper/config-data-helper.ts +++ b/apps/web/src/lib/helper/config-data-helper.ts @@ -28,28 +28,6 @@ export interface ReferenceData extends Omit { export const convertMenuConfigToReferenceData = (config: ConfigData[]|null, menuList: DisplayMenu[]): ReferenceData[] => { const convertMenuList = cloneDeep(menuList); - // const costIdx = convertMenuList.findIndex((i) => i.id === MENU_ID.COST_EXPLORER); - - // NOTE: will be applied after the cost explorer menu is updated - // if (convertMenuList[costIdx].subMenuList?.length === 4) { - // convertMenuList[costIdx].subMenuList?.push( - // { - // id: MENU_ID.ANOMALY_DETECTION_CONFIGURATION, - // to: { name: COST_EXPLORER_ROUTE.ANOMALY_DETECTION.CONFIGURATION._NAME }, - // label: i18n.t('BILLING.COST_MANAGEMENT.ANOMALY_DETECTION.CONFIG.TITLE'), - // }, - // { - // id: MENU_ID.ANOMALY_DETECTION_POLICY, - // to: { name: COST_EXPLORER_ROUTE.ANOMALY_DETECTION.POLICY._NAME }, - // label: i18n.t('BILLING.COST_MANAGEMENT.ANOMALY_DETECTION.POLICY.TITLE'), - // }, - // { - // id: MENU_ID.ANOMALY_DETECTION_HISTORY, - // to: { name: COST_EXPLORER_ROUTE.ANOMALY_DETECTION.HISTORY._NAME }, - // label: i18n.t('BILLING.COST_MANAGEMENT.ANOMALY_DETECTION.HISTORY.TITLE'), - // }, - // ); - // } const allMenuList = getAllSuggestionMenuList(convertMenuList); const results: ReferenceData[] = []; diff --git a/apps/web/src/lib/menu/config.ts b/apps/web/src/lib/menu/config.ts index 4b9c3d3d16..5ce525a705 100644 --- a/apps/web/src/lib/menu/config.ts +++ b/apps/web/src/lib/menu/config.ts @@ -14,7 +14,6 @@ export const MENU_ID = Object.freeze({ COST_EXPLORER: 'cost_explorer', COST_ANALYSIS: 'cost_analysis', COST_ADVANCED_SETTINGS: 'cost_advanced_settings', - ANOMALY_DETECTION: 'anomaly_detection', BUDGET: 'budget', COST_REPORT: 'cost_report', DATA_SOURCES: 'data_sources', diff --git a/apps/web/src/lib/menu/menu-architecture.ts b/apps/web/src/lib/menu/menu-architecture.ts index bb502c0c66..733d69a2c0 100644 --- a/apps/web/src/lib/menu/menu-architecture.ts +++ b/apps/web/src/lib/menu/menu-architecture.ts @@ -28,7 +28,6 @@ export const MENU_LIST: Menu[] = [ needPermissionByRole: true, subMenuList: [ { id: MENU_ID.COST_ANALYSIS, needPermissionByRole: true }, - { id: MENU_ID.ANOMALY_DETECTION, needPermissionByRole: true }, { id: MENU_ID.BUDGET, needPermissionByRole: true }, { id: MENU_ID.COST_REPORT, needPermissionByRole: true }, ], diff --git a/apps/web/src/lib/menu/menu-info.ts b/apps/web/src/lib/menu/menu-info.ts index 62bebb1b52..fd9ed64bde 100644 --- a/apps/web/src/lib/menu/menu-info.ts +++ b/apps/web/src/lib/menu/menu-info.ts @@ -86,13 +86,6 @@ export const MENU_INFO_MAP: Record = Object.freeze({ translationId: 'MENU.COST_EXPLORER_COST_ANALYSIS', icon: 'ic_service_cost-analysis', }, - [MENU_ID.ANOMALY_DETECTION]: { - menuId: MENU_ID.ANOMALY_DETECTION, - routeName: COST_EXPLORER_ROUTE.ANOMALY_DETECTION._NAME, - translationId: 'MENU.COST_EXPLORER_ANOMALY_DETECTION', - highlightTag: 'new', - icon: 'ic_anomaly_detection', - }, [MENU_ID.BUDGET]: { menuId: MENU_ID.BUDGET, routeName: COST_EXPLORER_ROUTE.BUDGET._NAME, diff --git a/apps/web/src/services/cost-explorer/routes/route-constant.ts b/apps/web/src/services/cost-explorer/routes/route-constant.ts index eab93fca13..e9007a38df 100644 --- a/apps/web/src/services/cost-explorer/routes/route-constant.ts +++ b/apps/web/src/services/cost-explorer/routes/route-constant.ts @@ -6,19 +6,6 @@ export const COST_EXPLORER_ROUTE = { _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.COST_ANALYSIS}`, QUERY_SET: { _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.COST_ANALYSIS}.query_set` }, }, - ANOMALY_DETECTION: { - _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.ANOMALY_DETECTION}`, - CONFIGURATION: { - _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.ANOMALY_DETECTION}.configuration`, - CREATE: { _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.ANOMALY_DETECTION}.configuration.create` }, - DETAIL: { _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.ANOMALY_DETECTION}.configuration.detail` }, - }, - POLICY: { _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.ANOMALY_DETECTION}.policy` }, - HISTORY: { - _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.ANOMALY_DETECTION}.history`, - DETAIL: { _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.ANOMALY_DETECTION}.history.detail` }, - }, - }, BUDGET: { _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.BUDGET}`, DETAIL: { _NAME: `${MENU_ID.COST_EXPLORER}.${MENU_ID.BUDGET}.detail` }, From 5f4a91aa2a0da4ab2f1bbaad5e3e8e245a56df9e Mon Sep 17 00:00:00 2001 From: nayeongkim Date: Tue, 10 Dec 2024 16:18:38 +0900 Subject: [PATCH 4/4] refactor: apply pr review Signed-off-by: NaYeong,Kim --- .../composables/current-menu-id/index.ts | 27 ++++--- .../composables/page-editable-status/index.ts | 19 ++++- .../navigations/gnb/GNBNavigationRail.vue | 10 ++- .../top-bar-header/TopBarWorkspaces.vue | 5 +- .../web/src/services/advanced/AdvancedLSB.vue | 10 +-- .../components/BookmarkDetailContainer.vue | 7 +- .../BookmarkManagementDetailTable.vue | 5 +- .../components/WorkspaceGroupTabGroupUser.vue | 13 ++- .../components/WorkspaceGroupTabWorkspace.vue | 9 ++- .../pages/admin/AdminBookmarkPage.vue | 7 +- .../AdminDomainSettingsAppearancePage.vue | 13 +-- ...nSettingsAutoDormancyConfigurationPage.vue | 11 +-- ...minDomainSettingsDomainInformationPage.vue | 9 ++- .../pages/admin/AdminWorkspaceGroupPage.vue | 12 ++- .../pages/admin/AdminWorkspacesPage.vue | 20 +++-- .../alert-manager/pages/AlertDetailPage.vue | 13 +-- .../pages/EscalationPolicyPage.vue | 7 +- .../asset-inventory/AssetInventoryLSB.vue | 12 +-- .../CloudServiceHistoryDetailNoteTab.vue | 7 +- .../components/CollectorMainContents.vue | 7 +- .../components/MetricExplorerHeader.vue | 17 ++-- .../components/MetricExplorerLSBMetric.vue | 6 +- .../pages/CollectorDetailPage.vue | 13 +-- .../pages/ServiceAccountDetailPage.vue | 7 +- .../pages/ServiceAccountPage.vue | 5 +- .../pages/admin/AdminCollectorDetailPage.vue | 12 +-- .../cost-explorer/CostExplorerLSB.vue | 13 ++- .../components/BudgetDetailHeading.vue | 5 +- .../components/CostAnalysisHeader.vue | 5 +- .../components/CostAnalysisQuerySection.vue | 4 +- .../components/DataSourceManagementTabs.vue | 9 +-- .../cost-explorer/pages/BudgetMainPage.vue | 8 +- .../cost-explorer/pages/CostReportPage.vue | 7 +- ...tingsAnomalyDetectionConfigurationPage.vue | 19 ++--- .../pages/admin/AdminBudgetMainPage.vue | 8 +- .../src/services/dashboards/DashboardsLSB.vue | 4 +- .../dashboards/pages/DashboardsMainPage.vue | 11 +-- .../src/services/iam/pages/AppMainPage.vue | 7 +- .../src/services/iam/pages/UserMainPage.vue | 21 +++-- .../iam/pages/admin/AdminRolePage.vue | 12 ++- .../pages/admin/AdminNoticeDetailPage.vue | 7 +- .../info/pages/admin/AdminNoticeMainPage.vue | 81 ++++++++----------- .../workspace-landing/LandingContents.vue | 8 +- 43 files changed, 269 insertions(+), 243 deletions(-) diff --git a/apps/web/src/common/composables/current-menu-id/index.ts b/apps/web/src/common/composables/current-menu-id/index.ts index b34a729948..e26eacdb13 100644 --- a/apps/web/src/common/composables/current-menu-id/index.ts +++ b/apps/web/src/common/composables/current-menu-id/index.ts @@ -1,3 +1,5 @@ +import type { Ref } from 'vue'; +import { computed, reactive, toRef } from 'vue'; import { useRoute } from 'vue-router/composables'; import { clone } from 'lodash'; @@ -5,15 +7,22 @@ import { clone } from 'lodash'; import { MENU_ID } from '@/lib/menu/config'; -import { COST_EXPLORER_ROUTE } from '@/services/cost-explorer/routes/route-constant'; +interface UseCurrentMenuIdReturnType { + currentMenuId: Ref; +} -export const useCurrentMenuId = (): string => { +export const useCurrentMenuId = (): UseCurrentMenuIdReturnType => { const route = useRoute(); - const reversedMatched = clone(route.matched).reverse(); - const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); - const targetMenuId = closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; - if (route.name === COST_EXPLORER_ROUTE.LANDING._NAME) { - return ''; - } - return targetMenuId; + + const state = reactive({ + currentMenuId: computed(() => { + const reversedMatched = clone(route.matched).reverse(); + const closestRoute = reversedMatched.find((d) => d.meta?.menuId !== undefined); + return closestRoute?.meta?.menuId || MENU_ID.WORKSPACE_HOME; + }), + }); + + return { + currentMenuId: toRef(state, 'currentMenuId'), + }; }; diff --git a/apps/web/src/common/composables/page-editable-status/index.ts b/apps/web/src/common/composables/page-editable-status/index.ts index ccf767d09a..a77d60f18c 100644 --- a/apps/web/src/common/composables/page-editable-status/index.ts +++ b/apps/web/src/common/composables/page-editable-status/index.ts @@ -1,4 +1,5 @@ -import { computed, reactive } from 'vue'; +import type { Ref } from 'vue'; +import { computed, reactive, toRef } from 'vue'; import { useUserStore } from '@/store/user/user-store'; @@ -6,13 +7,25 @@ import type { PageAccessMap } from '@/lib/access-control/config'; import { useCurrentMenuId } from '@/common/composables/current-menu-id'; -export const usePageEditableStatus = (): boolean|undefined => { +interface UsePageEditableStatusReturnType { + hasReadWriteAccess: Ref; +} + +export const usePageEditableStatus = (): UsePageEditableStatusReturnType => { const userStore = useUserStore(); const userGetters = userStore.getters; + const { currentMenuId } = useCurrentMenuId(); + const storeState = reactive({ pageAccessPermissionMap: computed(() => userGetters.pageAccessPermissionMap), }); - return storeState.pageAccessPermissionMap[useCurrentMenuId()]?.write; + const state = reactive({ + hasReadWriteAccess: computed(() => storeState.pageAccessPermissionMap[currentMenuId.value]?.write), + }); + + return { + hasReadWriteAccess: toRef(state, 'hasReadWriteAccess'), + }; }; diff --git a/apps/web/src/common/modules/navigations/gnb/GNBNavigationRail.vue b/apps/web/src/common/modules/navigations/gnb/GNBNavigationRail.vue index 3a370213dd..39f5b9bb7c 100644 --- a/apps/web/src/common/modules/navigations/gnb/GNBNavigationRail.vue +++ b/apps/web/src/common/modules/navigations/gnb/GNBNavigationRail.vue @@ -49,6 +49,8 @@ const route = useRoute(); const router = useRouter(); const { width } = useWindowSize(); +const { currentMenuId } = useCurrentMenuId(); + const storeState = reactive({ isHideNavRail: computed(() => gnbGetters.isHideNavRail), isMinimizeNavRail: computed(() => gnbGetters.isMinimizeNavRail), @@ -89,6 +91,12 @@ const state = reactive({ }); return result; }), + selectedMenuId: computed(() => { + if (route.name === COST_EXPLORER_ROUTE.LANDING._NAME) { + return ''; + } + return currentMenuId.value; + }), }); const handleMouseEvent = (value: boolean) => { @@ -157,7 +165,7 @@ onMounted(async () => { :to="(item.type === 'header' && item.subMenuList?.length > 0) ? '' : item.to" class="service-menu" :class="{ - 'is-selected': useCurrentMenuId().split('.').includes(item.id) && item.type !== 'header', + 'is-selected': state.selectedMenuId.split('.').includes(item.id) && item.type !== 'header', 'is-only-label': item.type === 'header' && item.subMenuList?.length > 0 }" > diff --git a/apps/web/src/common/modules/navigations/top-bar/modules/top-bar-header/TopBarWorkspaces.vue b/apps/web/src/common/modules/navigations/top-bar/modules/top-bar-header/TopBarWorkspaces.vue index 0ac1cff949..1e3ded313f 100644 --- a/apps/web/src/common/modules/navigations/top-bar/modules/top-bar-header/TopBarWorkspaces.vue +++ b/apps/web/src/common/modules/navigations/top-bar/modules/top-bar-header/TopBarWorkspaces.vue @@ -53,6 +53,8 @@ const favoriteStore = useFavoriteStore(); const favoriteGetters = favoriteStore.getters; const recentStore = useRecentStore(); +const { currentMenuId } = useCurrentMenuId(); + const router = useRouter(); const selectDropdownRef = ref(null); @@ -79,9 +81,8 @@ const selectWorkspace = (name: string): void => { if (!workspaceId || workspaceId === storeState.currentWorkspaceId) return; appContextStore.setGlobalGrantLoading(true); - const targetMenuId: string = useCurrentMenuId(); userWorkspaceStore.setCurrentWorkspace(workspaceId); - router.push({ name: MENU_INFO_MAP[targetMenuId].routeName, params: { workspaceId } }).catch(() => {}); + router.push({ name: MENU_INFO_MAP[currentMenuId.value].routeName, params: { workspaceId } }).catch(() => {}); }; const formatMenuItems = (menuItems: WorkspaceModel[] = []): MenuItem[] => { const result = menuItems.length > 0 ? [ diff --git a/apps/web/src/services/advanced/AdvancedLSB.vue b/apps/web/src/services/advanced/AdvancedLSB.vue index 1225523c98..59c388ee0e 100644 --- a/apps/web/src/services/advanced/AdvancedLSB.vue +++ b/apps/web/src/services/advanced/AdvancedLSB.vue @@ -1,6 +1,4 @@ diff --git a/apps/web/src/services/advanced/components/BookmarkDetailContainer.vue b/apps/web/src/services/advanced/components/BookmarkDetailContainer.vue index 811035b1ab..7894e19788 100644 --- a/apps/web/src/services/advanced/components/BookmarkDetailContainer.vue +++ b/apps/web/src/services/advanced/components/BookmarkDetailContainer.vue @@ -38,6 +38,8 @@ const bookmarkPageStore = useBookmarkPageStore(); const bookmarkPageState = bookmarkPageStore.state; const bookmarkPageGetters = bookmarkPageStore.getters; +const { hasReadWriteAccess } = usePageEditableStatus(); + const route = useRoute(); const router = useRouter(); @@ -74,7 +76,6 @@ const state = reactive({ return state.workspaceInfo?.name || ''; }), workspaceInfo: computed(() => getWorkspaceInfo(state.group, storeState.workspaceList)), - hasReadWriteAccess: computed(() => usePageEditableStatus()), }); const hideMenu = () => { @@ -186,7 +187,7 @@ onUnmounted(() => { v-bind="workspaceStateFormatter( WORKSPACE_STATE.DORMANT)" class="capitalize state" /> - - -
(() => allReferenceStore.getters.plugin), @@ -117,7 +119,6 @@ const historyLinkQueryHelper = new QueryHelper(); const state = reactive({ loading: computed(() => collectorPageState.loading.collectorList), - hasReadWriteAccess: computed(() => usePageEditableStatus()), searchTags: computed(() => { const tags = searchQueryHelper.setFilters(collectorPageState.searchFilters).queryTags; return tags.reduce((r: QueryItem[], d: any): QueryItem[] => { @@ -265,7 +266,7 @@ onMounted(async () => { @refresh="fetchCollectorList" @export="handleExportExcel" > -