image: Hide status column for users other than Root admin (#480)

Fixes #476

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Pearl Dsilva 2020-07-04 12:13:44 +05:30 committed by Rohit Yadav
parent fc5bb9f123
commit 84cba65c0e
4 changed files with 13 additions and 1 deletions

View File

@ -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')
}

View File

@ -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) {

View File

@ -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()

View File

@ -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()