Skip to content
Merged
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
10 changes: 4 additions & 6 deletions apps/web/src/common/modules/navigations/top-bar/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { includes } from 'lodash';
import { ROOT_ROUTE } from '@/router/constant';

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

import type { MenuId } from '@/lib/menu/config';
import { useAuthorizationStore } from '@/store/authorization/authorization-store';

import TopBarWorkspaces from '@/common/modules/navigations/top-bar/modules/top-bar-header/TopBarWorkspaces.vue';
import TopBarSearch from '@/common/modules/navigations/top-bar/modules/top-bar-search/TopBarSearch.vue';
Expand All @@ -19,12 +17,12 @@ import TopBarToolset from '@/common/modules/navigations/top-bar/modules/top-bar-
const ALLOWED_MENUS_FOR_ALL_USERS = ['notifications', 'support', 'profile'];

const appContextStore = useAppContextStore();
const userStore = useUserStore();
const athorizationStore = useAuthorizationStore();

const state = reactive({
isAdminMode: computed(() => appContextStore.getters.isAdminMode),
openedMenu: '',
hasPermission: computed<boolean>((() => userStore.getters.hasPermission)),
hasPermission: computed<boolean>((() => athorizationStore.getters.hasPermission)),
logoLink: computed(() => {
if (state.isAdminMode) return { name: ROOT_ROUTE.ADMIN._NAME };
return null;
Expand All @@ -38,7 +36,7 @@ const topBarWorkspaceRef = ref<InstanceType<typeof TopBarWorkspaces>>();
const hideMenu = () => {
state.openedMenu = '';
};
const handleOpenMenu = (menuId: MenuId) => {
const handleOpenMenu = (menuId: string) => {
if (state.openedMenu === menuId) {
hideMenu();
} else if (state.hasPermission || includes(ALLOWED_MENUS_FOR_ALL_USERS, menuId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
PI, PTooltip,
} from '@cloudforet/mirinae';

import { useUserStore } from '@/store/user/user-store';
import { useAuthorizationStore } from '@/store/authorization/authorization-store';

import TopBarIntegrationContextMenu
from '@/common/modules/navigations/top-bar/modules/top-bar-toolset/modules/top-bar-integration/modules/TopBarIntegrationContextMenu.vue';
Expand All @@ -24,9 +24,9 @@ const props = withDefaults(defineProps<Props>(), {

const emit = defineEmits<{(e: 'update:visible', value: boolean): void}>();

const userStore = useUserStore();
const authorizationStore = useAuthorizationStore();
const state = reactive({
isNoRoleUser: computed<boolean>(() => userStore.getters.isNoRoleUser),
isNoRoleUser: computed<boolean>(() => authorizationStore.getters.isNoRoleUser),
});

/* Util */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
PI, PTooltip,
} from '@cloudforet/mirinae';

import { useAuthorizationStore } from '@/store/authorization/authorization-store';
import { useNoticeStore } from '@/store/notice/notice-store';
import { useUserStore } from '@/store/user/user-store';

Expand All @@ -30,10 +31,12 @@ const emit = defineEmits<{(e: 'update:visible', value: boolean): void}>();
const noticeStore = useNoticeStore();
const noticeGetters = noticeStore.getters;
const userStore = useUserStore();
const authorizationStore = useAuthorizationStore();


const state = reactive({
hasNotice: computed(() => noticeGetters.unreadNoticeCount > 0),
isNoRoleUser: computed<boolean>(() => userStore.getters.isNoRoleUser),
isNoRoleUser: computed<boolean>(() => authorizationStore.getters.isNoRoleUser),
iconColor: computed<string>(() => {
if (props.visible) return blue[600];
return 'inherit';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
PI, PTooltip,
} from '@cloudforet/mirinae';

import { useAuthorizationStore } from '@/store/authorization/authorization-store';
import { useDisplayStore } from '@/store/display/display-store';
import { useUserStore } from '@/store/user/user-store';

Expand All @@ -28,10 +29,11 @@ const emit = defineEmits<{(e: 'update:visible', value: boolean): void}>();

const userStore = useUserStore();
const displayStore = useDisplayStore();
const authorizationStore = useAuthorizationStore();

const state = reactive({
hasNotifications: computed(() => displayStore.getters.hasUncheckedNotifications),
isNoRoleUser: computed<boolean>(() => userStore.getters.isNoRoleUser),
isNoRoleUser: computed<boolean>(() => authorizationStore.getters.isNoRoleUser),
notificationCount: 0,
iconColor: computed<string>(() => {
if (props.visible) return blue[600];
Expand Down
4 changes: 3 additions & 1 deletion apps/web/src/common/modules/portals/TopNotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { PNotificationBar } from '@cloudforet/mirinae';
import { i18n } from '@/translations';

import { useUserWorkspaceStore } from '@/store/app-context/workspace/user-workspace-store';
import { useAuthorizationStore } from '@/store/authorization/authorization-store';
import { useErrorStore } from '@/store/error/error-store';
import { useUserStore } from '@/store/user/user-store';

Expand All @@ -21,10 +22,11 @@ const props = withDefaults(defineProps<{
const userWorkspaceStore = useUserWorkspaceStore();
const errorStore = useErrorStore();
const userStore = useUserStore();
const authorizationStore = useAuthorizationStore();
const route = useRoute();

const storeState = reactive({
hasPermission: computed(() => userStore.getters.hasPermission),
hasPermission: computed(() => authorizationStore.getters.hasPermission),
isDomainAdmin: computed(() => userStore.getters.isDomainAdmin),
workspaceList: computed(() => userWorkspaceStore.getters.workspaceList),
visibleAuthorizationError: computed(() => errorStore.state.visibleAuthorizationError),
Expand Down
Loading