Skip to content

Commit c826475

Browse files
harikrishna-patnalaGlover, Rene (rg9975)
authored andcommitted
Added displaynetwork option in filters for listnetwork only for admin (apache#10209)
1 parent bb2f584 commit c826475

File tree

5 files changed

+31
-2
lines changed

5 files changed

+31
-2
lines changed

ui/public/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,8 @@
21432143
"label.traffictype": "Traffic type",
21442144
"label.transportzoneuuid": "Transport zone UUID",
21452145
"label.trigger.shutdown": "Trigger Safe Shutdown",
2146+
"label.true": "True",
2147+
"label.false": "False",
21462148
"label.try.again": "Try again",
21472149
"label.tuesday": "Tuesday",
21482150
"label.two.factor.authentication.secret.key": "Your Two factor authentication secret key",

ui/src/components/view/ListView.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@
8686
<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>
8787
<router-link :to="{ path: $route.path }" v-else>{{ $t(text.toLowerCase()) }}</router-link>
8888
</span>
89+
<span v-else-if="$route.path.startsWith('/guestnetwork') && record.id && record.displaynetwork === false">
90+
<router-link :to="{ path: $route.path + '/' + record.id, query: { displaynetwork: false } }" v-if="record.id">{{ $t(text.toLowerCase()) }}</router-link>
91+
</span>
8992
<span v-else>
9093
<router-link :to="{ path: $route.path + '/' + record.id }" v-if="record.id">{{ text }}</router-link>
9194
<router-link :to="{ path: $route.path + '/' + record.name }" v-else>{{ text }}</router-link>

ui/src/components/view/SearchView.vue

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,12 @@ export default {
289289
if (item === 'groupid' && !('listInstanceGroups' in this.$store.getters.apis)) {
290290
return true
291291
}
292+
if (item === 'displaynetwork' && this.$store.getters.userInfo.roletype !== 'Admin') {
293+
return true
294+
}
292295
if (['zoneid', 'domainid', 'imagestoreid', 'storageid', 'state', 'account', 'hypervisor', 'level',
293296
'clusterid', 'podid', 'groupid', 'entitytype', 'accounttype', 'systemvmtype', 'scope', 'provider',
294-
'type', 'serviceofferingid', 'diskofferingid'].includes(item)
297+
'type', 'serviceofferingid', 'diskofferingid', 'displaynetwork'].includes(item)
295298
) {
296299
type = 'list'
297300
} else if (item === 'tags') {
@@ -311,6 +314,12 @@ export default {
311314
return arrayField
312315
},
313316
fetchStaticFieldData (arrayField) {
317+
if (arrayField.includes('displaynetwork')) {
318+
const typeIndex = this.fields.findIndex(item => item.name === 'displaynetwork')
319+
this.fields[typeIndex].loading = true
320+
this.fields[typeIndex].opts = this.fetchBoolean()
321+
this.fields[typeIndex].loading = false
322+
}
314323
if (arrayField.includes('type')) {
315324
if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
316325
const typeIndex = this.fields.findIndex(item => item.name === 'type')
@@ -856,6 +865,18 @@ export default {
856865
}
857866
return types
858867
},
868+
fetchBoolean () {
869+
const types = []
870+
types.push({
871+
id: 'true',
872+
name: 'label.true'
873+
})
874+
types.push({
875+
id: 'false',
876+
name: 'label.false'
877+
})
878+
return types
879+
},
859880
fetchAccountTypes () {
860881
const types = []
861882
if (this.apiName.indexOf('listAccounts') > -1) {

ui/src/config/section/network.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default {
5454
return fields
5555
},
5656
filters: ['all', 'account', 'domainpath', 'shared'],
57-
searchFilters: ['keyword', 'zoneid', 'domainid', 'account', 'type', 'tags'],
57+
searchFilters: ['keyword', 'zoneid', 'domainid', 'account', 'type', 'displaynetwork', 'tags'],
5858
related: [{
5959
name: 'vm',
6060
title: 'label.instances',

ui/src/views/AutogenView.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,9 @@ export default {
915915
this.loading = true
916916
if (this.$route.params && this.$route.params.id) {
917917
params.id = this.$route.params.id
918+
if (['listNetworks'].includes(this.apiName) && 'displaynetwork' in this.$route.query) {
919+
params.displaynetwork = this.$route.query.displaynetwork
920+
}
918921
if (['listSSHKeyPairs'].includes(this.apiName)) {
919922
if (!this.$isValidUuid(params.id)) {
920923
delete params.id

0 commit comments

Comments
 (0)