mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
155 lines
4.0 KiB
155 lines
4.0 KiB
2 years ago
|
<script setup lang="ts">
|
||
2 years ago
|
import type { FunctionalComponent, SVGAttributes } from 'vue'
|
||
2 years ago
|
import AuditTab from './AuditTab.vue'
|
||
2 years ago
|
import AppStore from './AppStore.vue'
|
||
2 years ago
|
import Metadata from './Metadata.vue'
|
||
2 years ago
|
import UIAcl from './UIAcl.vue'
|
||
2 years ago
|
import ApiTokenManagement from '~/components/tabs/auth/ApiTokenManagement.vue'
|
||
|
import UserManagement from '~/components/tabs/auth/UserManagement.vue'
|
||
2 years ago
|
import StoreFrontOutline from '~icons/mdi/storefront-outline'
|
||
|
import TeamFillIcon from '~icons/ri/team-fill'
|
||
|
import MultipleTableIcon from '~icons/mdi/table-multiple'
|
||
|
import NootbookOutline from '~icons/mdi/notebook-outline'
|
||
2 years ago
|
import { useVModel, watch } from '#imports'
|
||
2 years ago
|
|
||
|
interface Props {
|
||
2 years ago
|
modelValue: boolean
|
||
|
openKey?: string
|
||
2 years ago
|
}
|
||
|
|
||
|
interface SubTabGroup {
|
||
|
[key: string]: {
|
||
|
title: string
|
||
|
body: any
|
||
|
}
|
||
|
}
|
||
|
|
||
|
interface TabGroup {
|
||
|
[key: string]: {
|
||
|
title: string
|
||
|
icon: FunctionalComponent<SVGAttributes, {}>
|
||
|
subTabs: SubTabGroup
|
||
|
}
|
||
|
}
|
||
|
|
||
2 years ago
|
const props = defineProps<Props>()
|
||
2 years ago
|
|
||
2 years ago
|
const emits = defineEmits(['update:modelValue'])
|
||
|
|
||
|
const vModel = useVModel(props, 'modelValue', emits)
|
||
2 years ago
|
|
||
|
const tabsInfo: TabGroup = {
|
||
|
teamAndAuth: {
|
||
|
title: 'Team and Auth',
|
||
|
icon: TeamFillIcon,
|
||
|
subTabs: {
|
||
|
usersManagement: {
|
||
|
title: 'Users Management',
|
||
2 years ago
|
body: UserManagement,
|
||
2 years ago
|
},
|
||
|
apiTokenManagement: {
|
||
|
title: 'API Token Management',
|
||
2 years ago
|
body: ApiTokenManagement,
|
||
2 years ago
|
},
|
||
|
},
|
||
|
},
|
||
|
appStore: {
|
||
|
title: 'App Store',
|
||
|
icon: StoreFrontOutline,
|
||
|
subTabs: {
|
||
|
new: {
|
||
|
title: 'Apps',
|
||
2 years ago
|
body: AppStore,
|
||
2 years ago
|
},
|
||
|
},
|
||
|
},
|
||
|
metaData: {
|
||
|
title: 'Project Metadata',
|
||
|
icon: MultipleTableIcon,
|
||
|
subTabs: {
|
||
|
metaData: {
|
||
|
title: 'Metadata',
|
||
2 years ago
|
body: Metadata,
|
||
2 years ago
|
},
|
||
|
acl: {
|
||
|
title: 'UI Access Control',
|
||
2 years ago
|
body: UIAcl,
|
||
2 years ago
|
},
|
||
|
},
|
||
|
},
|
||
|
audit: {
|
||
|
title: 'Audit',
|
||
|
icon: NootbookOutline,
|
||
|
subTabs: {
|
||
|
audit: {
|
||
|
title: 'Audit',
|
||
2 years ago
|
body: AuditTab,
|
||
2 years ago
|
},
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
const firstKeyOfObject = (obj: object) => Object.keys(obj)[0]
|
||
|
|
||
|
// Array of keys of tabs which are selected. In our case will be only one.
|
||
2 years ago
|
let selectedTabKeys = $ref<string[]>([firstKeyOfObject(tabsInfo)])
|
||
2 years ago
|
const selectedTab = $computed(() => tabsInfo[selectedTabKeys[0]])
|
||
|
|
||
|
let selectedSubTabKeys = $ref<string[]>([firstKeyOfObject(selectedTab.subTabs)])
|
||
2 years ago
|
const selectedSubTab = $computed(() => selectedTab.subTabs[selectedSubTabKeys[0]])
|
||
2 years ago
|
|
||
|
watch(
|
||
|
() => selectedTabKeys[0],
|
||
|
(newTabKey) => {
|
||
|
selectedSubTabKeys = [firstKeyOfObject(tabsInfo[newTabKey].subTabs)]
|
||
|
},
|
||
|
)
|
||
2 years ago
|
|
||
|
watch(
|
||
|
() => props.openKey,
|
||
|
(nextOpenKey) => {
|
||
|
selectedTabKeys = [Object.keys(tabsInfo).find((key) => key === nextOpenKey) || firstKeyOfObject(tabsInfo)]
|
||
|
},
|
||
|
)
|
||
2 years ago
|
</script>
|
||
|
|
||
|
<template>
|
||
2 years ago
|
<a-modal v-model:visible="vModel" :footer="null" width="max(90vw, 600px)" @cancel="emits('update:modelValue', false)">
|
||
2 years ago
|
<a-typography-title class="ml-4 mb-2 select-none" type="secondary" :level="5">SETTINGS</a-typography-title>
|
||
2 years ago
|
|
||
|
<a-layout class="mt-3 modal-body flex">
|
||
2 years ago
|
<!-- Side tabs -->
|
||
|
<a-layout-sider theme="light">
|
||
2 years ago
|
<a-menu v-model:selected-keys="selectedTabKeys" class="h-full" mode="inline" :open-keys="[]">
|
||
2 years ago
|
<a-menu-item v-for="(tab, key) of tabsInfo" :key="key">
|
||
|
<div class="flex flex-row items-center space-x-2">
|
||
|
<component :is="tab.icon" class="flex" />
|
||
2 years ago
|
|
||
2 years ago
|
<div class="flex select-none">
|
||
|
{{ tab.title }}
|
||
|
</div>
|
||
|
</div>
|
||
|
</a-menu-item>
|
||
|
</a-menu>
|
||
|
</a-layout-sider>
|
||
|
|
||
|
<!-- Sub Tabs -->
|
||
2 years ago
|
<a-layout-content class="h-auto px-4 scrollbar-thumb-gray-500">
|
||
2 years ago
|
<a-menu v-model:selectedKeys="selectedSubTabKeys" :open-keys="[]" mode="horizontal">
|
||
|
<a-menu-item v-for="(tab, key) of selectedTab.subTabs" :key="key" class="select-none">
|
||
|
{{ tab.title }}
|
||
|
</a-menu-item>
|
||
|
</a-menu>
|
||
|
|
||
2 years ago
|
<component :is="selectedSubTab.body" class="px-2 py-6" />
|
||
2 years ago
|
</a-layout-content>
|
||
|
</a-layout>
|
||
|
</a-modal>
|
||
|
</template>
|
||
|
|
||
|
<style scoped>
|
||
|
.modal-body {
|
||
2 years ago
|
@apply min-h-[75vh];
|
||
2 years ago
|
}
|
||
|
</style>
|