From 84cba65c0ea1c2e8e6093cd033a56ef0fd51ae35 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Sat, 4 Jul 2020 12:13:44 +0530 Subject: [PATCH] image: Hide status column for users other than Root admin (#480) Fixes #476 Signed-off-by: Rohit Yadav --- ui/src/config/section/image.js | 2 +- ui/src/views/AutogenView.vue | 2 ++ ui/src/views/image/IsoZones.vue | 5 +++++ ui/src/views/image/TemplateZones.vue | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ui/src/config/section/image.js b/ui/src/config/section/image.js index 37128802172..476ffbad780 100644 --- a/ui/src/config/section/image.js +++ b/ui/src/config/section/image.js @@ -33,7 +33,7 @@ export default { resourceType: 'Template', filters: ['self', 'shared', 'featured', 'community'], columns: () => { - var fields = ['name', 'ostypename', 'status', 'hypervisor', 'account', 'domain'] + var fields = ['name', 'ostypename', 'hypervisor', 'account', 'domain'] if (['Admin'].includes(store.getters.userInfo.roletype)) { fields.push('order') } diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index 7b587fce6f3..8e51b777e59 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -582,9 +582,11 @@ export default { if (!this.items || this.items.length === 0) { this.items = [] } + if (['listTemplates', 'listIsos'].includes(this.apiName) && this.items.length > 1) { this.items = [...new Map(this.items.map(x => [x.id, x])).values()] } + for (let idx = 0; idx < this.items.length; idx++) { this.items[idx].key = idx for (const key in customRender) { diff --git a/ui/src/views/image/IsoZones.vue b/ui/src/views/image/IsoZones.vue index 7852af7ce55..f23dacf96be 100644 --- a/ui/src/views/image/IsoZones.vue +++ b/ui/src/views/image/IsoZones.vue @@ -175,6 +175,11 @@ export default { scopedSlots: { customRender: 'action' } } ] + const userInfo = this.$store.getters.userInfo + if (!['Admin'].includes(userInfo.roletype) && + (userInfo.account !== this.resource.account || userInfo.domain !== this.resource.domain)) { + this.columns = this.columns.filter(col => { return col.dataIndex !== 'status' }) + } }, mounted () { this.fetchData() diff --git a/ui/src/views/image/TemplateZones.vue b/ui/src/views/image/TemplateZones.vue index b0093452481..3b020c8232e 100644 --- a/ui/src/views/image/TemplateZones.vue +++ b/ui/src/views/image/TemplateZones.vue @@ -185,6 +185,11 @@ export default { scopedSlots: { customRender: 'action' } } ] + const userInfo = this.$store.getters.userInfo + if (!['Admin'].includes(userInfo.roletype) && + (userInfo.account !== this.resource.account || userInfo.domain !== this.resource.domain)) { + this.columns = this.columns.filter(col => { return col.dataIndex !== 'status' }) + } }, mounted () { this.fetchData()