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.
61 lines
1.4 KiB
61 lines
1.4 KiB
2 years ago
|
<script setup lang="ts">
|
||
2 years ago
|
import { useI18n } from 'vue-i18n'
|
||
2 years ago
|
import UserManagement from './auth/UserManagement.vue'
|
||
|
import ApiTokenManagement from './auth/ApiTokenManagement.vue'
|
||
2 years ago
|
import { useUIPermission } from '#imports'
|
||
2 years ago
|
|
||
2 years ago
|
interface Tab {
|
||
|
title: string
|
||
2 years ago
|
label: string
|
||
2 years ago
|
body: any
|
||
2 years ago
|
isUIAllowed: boolean
|
||
2 years ago
|
}
|
||
2 years ago
|
const { t } = useI18n()
|
||
2 years ago
|
|
||
|
const { isUIAllowed } = useUIPermission()
|
||
|
|
||
2 years ago
|
const tabsInfo: Tab[] = [
|
||
|
{
|
||
2 years ago
|
title: 'Users Management',
|
||
2 years ago
|
label: t('title.userMgmt'),
|
||
2 years ago
|
body: () => UserManagement,
|
||
2 years ago
|
isUIAllowed: isUIAllowed('userMgmtTab'),
|
||
2 years ago
|
},
|
||
2 years ago
|
{
|
||
2 years ago
|
title: 'API Token Management',
|
||
2 years ago
|
label: t('title.apiTokenMgmt'),
|
||
2 years ago
|
body: () => ApiTokenManagement,
|
||
2 years ago
|
isUIAllowed: isUIAllowed('apiTokenTab'),
|
||
2 years ago
|
},
|
||
2 years ago
|
]
|
||
2 years ago
|
|
||
2 years ago
|
// const firstKeyOfObject = (obj: object) => Object.keys(obj)[0]
|
||
2 years ago
|
|
||
2 years ago
|
const selectedTabKey = $ref(0)
|
||
|
const selectedTab = $computed(() => tabsInfo[selectedTabKey])
|
||
2 years ago
|
</script>
|
||
|
|
||
2 years ago
|
<template>
|
||
2 years ago
|
<div v-if="selectedTab.isUIAllowed">
|
||
2 years ago
|
<a-tabs v-model:active-key="selectedTabKey" :open-keys="[]" mode="horizontal" class="nc-auth-tabs !mx-6">
|
||
2 years ago
|
<a-tab-pane v-for="(tab, key) of tabsInfo" :key="key" class="select-none">
|
||
2 years ago
|
<template #tab>
|
||
2 years ago
|
<span>
|
||
2 years ago
|
{{ tab.label }}
|
||
2 years ago
|
</span>
|
||
|
</template>
|
||
2 years ago
|
</a-tab-pane>
|
||
2 years ago
|
</a-tabs>
|
||
2 years ago
|
|
||
|
<div class="mx-4 py-6 mt-2">
|
||
|
<component :is="selectedTab.body()" />
|
||
|
</div>
|
||
2 years ago
|
</div>
|
||
|
</template>
|
||
2 years ago
|
|
||
|
<style scoped>
|
||
|
:deep(.nc-auth-tabs .ant-tabs-nav::before) {
|
||
|
@apply !border-none;
|
||
|
}
|
||
|
</style>
|