diff --git a/ui/src/components/view/TreeView.vue b/ui/src/components/view/TreeView.vue index e68b17c8d4a..c52d597cabc 100644 --- a/ui/src/components/view/TreeView.vue +++ b/ui/src/components/view/TreeView.vue @@ -61,7 +61,7 @@ v-for="tab in tabs" :tab="$t(tab.name)" :key="tab.name" - v-if="checkShowTabDetail(tab.name)"> + v-if="checkShowTabDetail(tab)"> item.name === tabKey) - - // check tab item not exists - if (!itemTab || !itemTab[0]) { - return false + checkShowTabDetail (tab) { + if ('show' in tab) { + return tab.show(this.resource, this.$route, store.getters.userInfo) } - // get permission from the route - const permission = itemTab[0].permission ? itemTab[0].permission[0] : '' + const permission = tab.permission ? tab.permission[0] : '' // check permission not exists if (!permission || permission === '') { diff --git a/ui/src/config/section/iam.js b/ui/src/config/section/iam.js index c6ac178ab5f..f91789a6a25 100644 --- a/ui/src/config/section/iam.js +++ b/ui/src/config/section/iam.js @@ -105,8 +105,9 @@ export default { component: () => import('@/components/view/ResourceLimitTab.vue') }, { - name: 'settings', - component: () => import('@/components/view/SettingsTab.vue') + name: 'Settings', + component: () => import('@/components/view/SettingsTab.vue'), + show: (record, route, user) => { return ['Admin'].includes(user.roletype) } } ], actions: [ @@ -246,8 +247,9 @@ export default { component: () => import('@/components/view/ResourceLimitTab.vue') }, { - name: 'settings', - component: () => import('@/components/view/SettingsTab.vue') + name: 'Settings', + component: () => import('@/components/view/SettingsTab.vue'), + show: (record, route, user) => { return ['Admin'].includes(user.roletype) } } ], treeView: true,