This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new dc1a4529139 UI: add filter user/all to list user/all volumes (#7075)
dc1a4529139 is described below

commit dc1a4529139bc48f0db6b641c505be194d36dc97
Author: Wei Zhou <[email protected]>
AuthorDate: Wed Jan 18 14:32:36 2023 +0100

    UI: add filter user/all to list user/all volumes (#7075)
---
 ui/src/config/section/storage.js |  7 +++++++
 ui/src/views/AutogenView.vue     | 16 ++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ui/src/config/section/storage.js b/ui/src/config/section/storage.js
index 54e62a4eff1..917027c78b3 100644
--- a/ui/src/config/section/storage.js
+++ b/ui/src/config/section/storage.js
@@ -30,6 +30,13 @@ export default {
       docHelp: 'adminguide/storage.html#working-with-volumes',
       permission: ['listVolumesMetrics'],
       resourceType: 'Volume',
+      filters: () => {
+        if (store.getters.userInfo.roletype === 'Admin') {
+          return ['user', 'all']
+        } else {
+          return []
+        }
+      },
       columns: () => {
         const fields = ['name', 'state', 'type', 'vmname', 'sizegb']
         const metricsFields = ['diskkbsread', 'diskkbswrite', 'diskiopstotal']
diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue
index abd29a737ef..ee243b0e723 100644
--- a/ui/src/views/AutogenView.vue
+++ b/ui/src/views/AutogenView.vue
@@ -55,8 +55,10 @@
                     :placeholder="$t('label.filterby')"
                     :value="$route.query.filter || (projectView && $route.name 
=== 'vm' ||
                       ['Admin', 
'DomainAdmin'].includes($store.getters.userInfo.roletype) && ['vm', 'iso', 
'template'].includes($route.name)
-                      ? 'all' : ['publicip'].includes($route.name)
-                        ? 'allocated' : ['guestnetwork', 
'guestvlans'].includes($route.name) ? 'all' : 'self')"
+                        ? 'all' : ['publicip'].includes($route.name)
+                        ? 'allocated' : ['guestnetwork', 
'guestvlans'].includes($route.name)
+                        ? 'all' : ['volume'].includes($route.name)
+                        ? 'user' : 'self')"
                     style="min-width: 120px; margin-left: 10px"
                     @change="changeFilter"
                     showSearch
@@ -847,10 +849,6 @@ export default {
         delete params.showunique
       }
 
-      if (['Admin'].includes(this.$store.getters.userInfo.roletype) && 
['listVolumesMetrics', 'listVolumes'].includes(this.apiName)) {
-        params.listsystemvms = true
-      }
-
       this.loading = true
       if (this.$route.params && this.$route.params.id) {
         params.id = this.$route.params.id
@@ -1542,6 +1540,12 @@ export default {
         query.templatefilter = filter
       } else if (this.$route.name === 'iso') {
         query.isofilter = filter
+      } else if (this.$route.name === 'volume') {
+        if (filter === 'all') {
+          query.listsystemvms = true
+        } else {
+          delete query.listsystemvms
+        }
       } else if (this.$route.name === 'guestnetwork') {
         if (filter === 'all') {
           delete query.networkfilter

Reply via email to