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

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


The following commit(s) were added to refs/heads/4.19 by this push:
     new 4d9fd1b73fa Added displaynetwork option in filters for listnetwork 
only for admin (#10209)
4d9fd1b73fa is described below

commit 4d9fd1b73fa8429881782c2df7d3ffecef1701f4
Author: Harikrishna <[email protected]>
AuthorDate: Thu Jan 23 14:06:30 2025 +0530

    Added displaynetwork option in filters for listnetwork only for admin 
(#10209)
---
 ui/public/locales/en.json             |  2 ++
 ui/src/components/view/ListView.vue   |  3 +++
 ui/src/components/view/SearchView.vue | 23 ++++++++++++++++++++++-
 ui/src/config/section/network.js      |  2 +-
 ui/src/views/AutogenView.vue          |  3 +++
 5 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index 8cc17bbb128..cb113d41b2f 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -2143,6 +2143,8 @@
 "label.traffictype": "Traffic type",
 "label.transportzoneuuid": "Transport zone UUID",
 "label.trigger.shutdown": "Trigger Safe Shutdown",
+"label.true": "True",
+"label.false": "False",
 "label.try.again": "Try again",
 "label.tuesday": "Tuesday",
 "label.two.factor.authentication.secret.key": "Your Two factor authentication 
secret key",
diff --git a/ui/src/components/view/ListView.vue 
b/ui/src/components/view/ListView.vue
index eaa54939d07..e67f1c4cc78 100644
--- a/ui/src/components/view/ListView.vue
+++ b/ui/src/components/view/ListView.vue
@@ -86,6 +86,9 @@
             <router-link :to="{ path: $route.path + '/' + record.uuid, query: 
{ zoneid: $route.query.zoneid } }" v-else-if="record.uuid && 
$route.query.zoneid">{{ $t(text.toLowerCase()) }}</router-link>
             <router-link :to="{ path: $route.path }" v-else>{{ 
$t(text.toLowerCase()) }}</router-link>
           </span>
+          <span v-else-if="$route.path.startsWith('/guestnetwork') && 
record.id && record.displaynetwork === false">
+            <router-link :to="{ path: $route.path + '/' + record.id, query: { 
displaynetwork: false } }" v-if="record.id">{{ $t(text.toLowerCase()) 
}}</router-link>
+          </span>
           <span v-else>
             <router-link :to="{ path: $route.path + '/' + record.id }" 
v-if="record.id">{{ text }}</router-link>
             <router-link :to="{ path: $route.path + '/' + record.name }" 
v-else>{{ text }}</router-link>
diff --git a/ui/src/components/view/SearchView.vue 
b/ui/src/components/view/SearchView.vue
index a43dfabf868..9cbe1ef0fe6 100644
--- a/ui/src/components/view/SearchView.vue
+++ b/ui/src/components/view/SearchView.vue
@@ -289,9 +289,12 @@ export default {
         if (item === 'groupid' && !('listInstanceGroups' in 
this.$store.getters.apis)) {
           return true
         }
+        if (item === 'displaynetwork' && this.$store.getters.userInfo.roletype 
!== 'Admin') {
+          return true
+        }
         if (['zoneid', 'domainid', 'imagestoreid', 'storageid', 'state', 
'account', 'hypervisor', 'level',
           'clusterid', 'podid', 'groupid', 'entitytype', 'accounttype', 
'systemvmtype', 'scope', 'provider',
-          'type', 'serviceofferingid', 'diskofferingid'].includes(item)
+          'type', 'serviceofferingid', 'diskofferingid', 
'displaynetwork'].includes(item)
         ) {
           type = 'list'
         } else if (item === 'tags') {
@@ -311,6 +314,12 @@ export default {
       return arrayField
     },
     fetchStaticFieldData (arrayField) {
+      if (arrayField.includes('displaynetwork')) {
+        const typeIndex = this.fields.findIndex(item => item.name === 
'displaynetwork')
+        this.fields[typeIndex].loading = true
+        this.fields[typeIndex].opts = this.fetchBoolean()
+        this.fields[typeIndex].loading = false
+      }
       if (arrayField.includes('type')) {
         if (this.$route.path === '/guestnetwork' || 
this.$route.path.includes('/guestnetwork/')) {
           const typeIndex = this.fields.findIndex(item => item.name === 'type')
@@ -856,6 +865,18 @@ export default {
       }
       return types
     },
+    fetchBoolean () {
+      const types = []
+      types.push({
+        id: 'true',
+        name: 'label.true'
+      })
+      types.push({
+        id: 'false',
+        name: 'label.false'
+      })
+      return types
+    },
     fetchAccountTypes () {
       const types = []
       if (this.apiName.indexOf('listAccounts') > -1) {
diff --git a/ui/src/config/section/network.js b/ui/src/config/section/network.js
index 72eb17e0ae9..986a2c206c7 100644
--- a/ui/src/config/section/network.js
+++ b/ui/src/config/section/network.js
@@ -54,7 +54,7 @@ export default {
         return fields
       },
       filters: ['all', 'account', 'domainpath', 'shared'],
-      searchFilters: ['keyword', 'zoneid', 'domainid', 'account', 'type', 
'tags'],
+      searchFilters: ['keyword', 'zoneid', 'domainid', 'account', 'type', 
'displaynetwork', 'tags'],
       related: [{
         name: 'vm',
         title: 'label.instances',
diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue
index 3471c02d2e4..74fae8cada4 100644
--- a/ui/src/views/AutogenView.vue
+++ b/ui/src/views/AutogenView.vue
@@ -915,6 +915,9 @@ export default {
       this.loading = true
       if (this.$route.params && this.$route.params.id) {
         params.id = this.$route.params.id
+        if (['listNetworks'].includes(this.apiName) && 'displaynetwork' in 
this.$route.query) {
+          params.displaynetwork = this.$route.query.displaynetwork
+        }
         if (['listSSHKeyPairs'].includes(this.apiName)) {
           if (!this.$isValidUuid(params.id)) {
             delete params.id

Reply via email to