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/07/04 06:43:54 UTC

[cloudstack-primate] branch master updated: image: Hide status column for users other than Root admin (#480)

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 285e6f9  image: Hide status column for users other than Root admin (#480)
285e6f9 is described below

commit 285e6f922cc4725152a079743d161bc64a9dd344
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Sat Jul 4 12:13:44 2020 +0530

    image: Hide status column for users other than Root admin (#480)
    
    Fixes #476
---
 src/config/section/image.js       | 2 +-
 src/views/AutogenView.vue         | 2 ++
 src/views/image/IsoZones.vue      | 5 +++++
 src/views/image/TemplateZones.vue | 5 +++++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/config/section/image.js b/src/config/section/image.js
index 3712880..476ffba 100644
--- a/src/config/section/image.js
+++ b/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/src/views/AutogenView.vue b/src/views/AutogenView.vue
index 7b587fc..8e51b77 100644
--- a/src/views/AutogenView.vue
+++ b/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/src/views/image/IsoZones.vue b/src/views/image/IsoZones.vue
index 7852af7..f23dacf 100644
--- a/src/views/image/IsoZones.vue
+++ b/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/src/views/image/TemplateZones.vue b/src/views/image/TemplateZones.vue
index b009345..3b020c8 100644
--- a/src/views/image/TemplateZones.vue
+++ b/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()