Skip to content

Commit 55582f9

Browse files
Added displaynetwork option in filters for listnetwork only for admin
1 parent 9967bb3 commit 55582f9

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-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/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',

0 commit comments

Comments
 (0)