Added displaynetwork option in filters for listnetwork only for admin (#10209)

This commit is contained in:
Harikrishna 2025-01-23 14:06:30 +05:30 committed by GitHub
parent 20759187b3
commit 4d9fd1b73f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 31 additions and 2 deletions

View File

@ -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",

View File

@ -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>

View File

@ -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) {

View File

@ -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',

View File

@ -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