Browse Source

feat(gui): add appstore in navbar menu

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3796/head
Pranav C 2 years ago
parent
commit
2be20c5ee2
  1. 2
      packages/nc-gui/components.d.ts
  2. 50
      packages/nc-gui/components/dashboard/settings/Modal.vue
  3. 9
      packages/nc-gui/composables/useUIPermission/index.ts
  4. 15
      packages/nc-gui/layouts/base.vue
  5. 4
      packages/nc-gui/pages/index/apps.vue

2
packages/nc-gui/components.d.ts vendored

@ -190,6 +190,8 @@ declare module '@vue/runtime-core' {
MdiSort: typeof import('~icons/mdi/sort')['default'] MdiSort: typeof import('~icons/mdi/sort')['default']
MdiStar: typeof import('~icons/mdi/star')['default'] MdiStar: typeof import('~icons/mdi/star')['default']
MdiStarOutline: typeof import('~icons/mdi/star-outline')['default'] MdiStarOutline: typeof import('~icons/mdi/star-outline')['default']
MdiStorefrontOutline: typeof import('~icons/mdi/storefront-outline')['default']
MdiStorefrontSutline: typeof import('~icons/mdi/storefront-sutline')['default']
MdiTable: typeof import('~icons/mdi/table')['default'] MdiTable: typeof import('~icons/mdi/table')['default']
MdiTableArrowRight: typeof import('~icons/mdi/table-arrow-right')['default'] MdiTableArrowRight: typeof import('~icons/mdi/table-arrow-right')['default']
MdiTableLarge: typeof import('~icons/mdi/table-large')['default'] MdiTableLarge: typeof import('~icons/mdi/table-large')['default']

50
packages/nc-gui/components/dashboard/settings/Modal.vue

@ -56,40 +56,42 @@ const tabsInfo: TabGroup = {
subTabs: { subTabs: {
...(isUIAllowed('userMgmtTab') ...(isUIAllowed('userMgmtTab')
? { ? {
usersManagement: { usersManagement: {
// Users Management // Users Management
title: t('title.userMgmt'), title: t('title.userMgmt'),
body: UserManagement, body: UserManagement,
}, },
} }
: {}), : {}),
...(isUIAllowed('apiTokenTab') ...(isUIAllowed('apiTokenTab')
? { ? {
apiTokenManagement: { apiTokenManagement: {
// API Tokens Management // API Tokens Management
title: t('title.apiTokenMgmt'), title: t('title.apiTokenMgmt'),
body: ApiTokenManagement, body: ApiTokenManagement,
}, },
} }
: {}), : {}),
}, },
onClick: () => { onClick: () => {
$e('c:settings:team-auth') $e('c:settings:team-auth')
}, },
}, ...(isUIAllowed('appStore') },
...(isUIAllowed('appStore')
? { ? {
appStore: { appStore: {
// App Store // App Store
title: t('title.appStore'), title: t('title.appStore'),
icon: StoreFrontOutline, icon: StoreFrontOutline,
subTabs: { subTabs: {
new: { new: {
title: 'Apps', title: 'Apps',
body: AppStore, body: AppStore,
},
},
onClick: () => {
$e('c:settings:appstore')
}, },
},
onClick: () => {
$e('c:settings:appstore')
}, },
} }
: {}), : {}),

9
packages/nc-gui/composables/useUIPermission/index.ts

@ -11,13 +11,12 @@ const hasPermission = (role: Role | ProjectRole, hasRole: boolean, permission: P
if (isString(rolePermission) && rolePermission === '*') return true if (isString(rolePermission) && rolePermission === '*') return true
// todo: type correction // todo: type correction
if('include' in rolePermission[permission as keyof typeof rolePermission]){ if ('include' in rolePermission) {
return rolePermission[permission as keyof typeof rolePermission].include[permission] return rolePermission.include[permission]
} }
if('exclude' in rolePermission[permission as keyof typeof rolePermission]){ if ('exclude' in rolePermission) {
return !rolePermission[permission as keyof typeof rolePermission].exclude[permission] return !rolePermission.exclude[permission]
} }
return rolePermission[permission as keyof typeof rolePermission] return rolePermission[permission as keyof typeof rolePermission]

15
packages/nc-gui/layouts/base.vue

@ -13,6 +13,8 @@ const hasSider = ref(false)
const sidebar = ref<HTMLDivElement>() const sidebar = ref<HTMLDivElement>()
const { isUIAllowed } = useUIPermission()
const logout = () => { const logout = () => {
signOut() signOut()
navigateTo('/signin') navigateTo('/signin')
@ -87,6 +89,19 @@ hooks.hook('page:finish', () => {
</nuxt-link> </nuxt-link>
</a-menu-item> </a-menu-item>
<a-menu-divider class="!m-0" />
<a-menu-item v-if="isUIAllowed('appStore')" key="0" class="!rounded-t">
<nuxt-link
v-e="['c:settings:appstore', { page: true }]"
class="nc-project-menu-item group !no-underline"
to="/apps"
>
<MdiStorefrontOutline class="mt-1 group-hover:text-accent" />&nbsp;
<span class="prose group-hover:text-primary">{{ $t('title.appStore') }}</span>
</nuxt-link>
</a-menu-item>
<a-menu-divider class="!m-0" /> <a-menu-divider class="!m-0" />
<a-menu-item key="1" class="!rounded-b group"> <a-menu-item key="1" class="!rounded-b group">

4
packages/nc-gui/pages/index/apps.vue

@ -9,8 +9,8 @@ definePageMeta({
</script> </script>
<template> <template>
<div class="p-4 h-full overflow-auto"> <div class="p-10 h-full overflow-auto">
<h1>{{ $t('label.appStore') }}</h1> <h1 class="text-3xl text-center mb-11">{{ $t('title.appStore') }}</h1>
<AppStore /> <AppStore />
</div> </div>
</template> </template>

Loading…
Cancel
Save