You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/04/17 07:43:15 UTC
[cloudstack-primate] branch master updated: iam: control show/hide
setting tab for account & domain (#239)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
The following commit(s) were added to refs/heads/master by this push:
new 40f2242 iam: control show/hide setting tab for account & domain (#239)
40f2242 is described below
commit 40f2242780df58a4ac2bf68219ca12dcfdd19384
Author: Hoang Nguyen <ho...@unitech.vn>
AuthorDate: Fri Apr 17 14:43:04 2020 +0700
iam: control show/hide setting tab for account & domain (#239)
Fixes #237
---
src/components/view/TreeView.vue | 15 +++++----------
src/config/section/iam.js | 10 ++++++----
2 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/src/components/view/TreeView.vue b/src/components/view/TreeView.vue
index e68b17c..c52d597 100644
--- a/src/components/view/TreeView.vue
+++ b/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)">
<component
:is="tab.component"
:resource="resource"
@@ -430,17 +430,12 @@ export default {
}
return json[responseName][objectName]
},
- checkShowTabDetail (tabKey) {
- // get tab item from the route
- const itemTab = this.tabs.filter(item => 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/src/config/section/iam.js b/src/config/section/iam.js
index c6ac178..f91789a 100644
--- a/src/config/section/iam.js
+++ b/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,