mirror of https://github.com/apache/cloudstack.git
UI: Add UI support for `forvpc` and `guestiptype` parameters of the `listNetworkOfferings` API (#9947)
* add guestiptype and forvpc filters for listNetworkOfferings on UI * fix duplicate option names on list filters
This commit is contained in:
parent
db2e89a3a2
commit
546ef31aed
|
|
@ -80,7 +80,7 @@
|
||||||
</span>
|
</span>
|
||||||
<global-outlined v-else style="margin-right: 5px" />
|
<global-outlined v-else style="margin-right: 5px" />
|
||||||
</span>
|
</span>
|
||||||
<span v-if="(field.name.startsWith('domain') || field.name === 'account')">
|
<span v-if="(field.name.startsWith('domain') || field.name === 'account' || field.name.startsWith('associatednetwork'))">
|
||||||
<span v-if="opt.icon">
|
<span v-if="opt.icon">
|
||||||
<resource-icon :image="opt.icon.base64image" size="1x" style="margin-right: 5px"/>
|
<resource-icon :image="opt.icon.base64image" size="1x" style="margin-right: 5px"/>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -90,13 +90,6 @@
|
||||||
<status :text="opt.state" />
|
<status :text="opt.state" />
|
||||||
</span>
|
</span>
|
||||||
{{ $t((['storageid'].includes(field.name) || !opt.path) ? opt.name : opt.path) }}
|
{{ $t((['storageid'].includes(field.name) || !opt.path) ? opt.name : opt.path) }}
|
||||||
<span v-if="(field.name.startsWith('associatednetwork'))">
|
|
||||||
<span v-if="opt.icon">
|
|
||||||
<resource-icon :image="opt.icon.base64image" size="1x" style="margin-right: 5px"/>
|
|
||||||
</span>
|
|
||||||
<block-outlined v-else style="margin-right: 5px" />
|
|
||||||
</span>
|
|
||||||
{{ $t(opt.path || opt.name) }}
|
|
||||||
</div>
|
</div>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
|
|
@ -313,7 +306,7 @@ export default {
|
||||||
}
|
}
|
||||||
if (['zoneid', 'domainid', 'imagestoreid', 'storageid', 'state', 'account', 'hypervisor', 'level',
|
if (['zoneid', 'domainid', 'imagestoreid', 'storageid', 'state', 'account', 'hypervisor', 'level',
|
||||||
'clusterid', 'podid', 'groupid', 'entitytype', 'accounttype', 'systemvmtype', 'scope', 'provider',
|
'clusterid', 'podid', 'groupid', 'entitytype', 'accounttype', 'systemvmtype', 'scope', 'provider',
|
||||||
'type', 'scope', 'managementserverid', 'serviceofferingid', 'diskofferingid', 'networkid', 'usagetype', 'restartrequired'].includes(item)
|
'type', 'scope', 'managementserverid', 'serviceofferingid', 'diskofferingid', 'networkid', 'usagetype', 'restartrequired', 'guestiptype'].includes(item)
|
||||||
) {
|
) {
|
||||||
type = 'list'
|
type = 'list'
|
||||||
} else if (item === 'tags') {
|
} else if (item === 'tags') {
|
||||||
|
|
@ -335,9 +328,9 @@ export default {
|
||||||
return arrayField
|
return arrayField
|
||||||
},
|
},
|
||||||
fetchStaticFieldData (arrayField) {
|
fetchStaticFieldData (arrayField) {
|
||||||
if (arrayField.includes('type')) {
|
if (arrayField.includes('type') || arrayField.includes('guestiptype')) {
|
||||||
if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
|
if (this.$route.path.includes('/guestnetwork') || this.$route.path.includes('/networkoffering')) {
|
||||||
const typeIndex = this.fields.findIndex(item => item.name === 'type')
|
const typeIndex = this.fields.findIndex(item => ['type', 'guestiptype'].includes(item.name))
|
||||||
this.fields[typeIndex].loading = true
|
this.fields[typeIndex].loading = true
|
||||||
this.fields[typeIndex].opts = this.fetchGuestNetworkTypes()
|
this.fields[typeIndex].opts = this.fetchGuestNetworkTypes()
|
||||||
this.fields[typeIndex].loading = false
|
this.fields[typeIndex].loading = false
|
||||||
|
|
@ -982,7 +975,7 @@ export default {
|
||||||
},
|
},
|
||||||
fetchGuestNetworkTypes () {
|
fetchGuestNetworkTypes () {
|
||||||
const types = []
|
const types = []
|
||||||
if (this.apiName.indexOf('listNetworks') > -1) {
|
if (['listNetworks', 'listNetworkOfferings'].includes(this.apiName)) {
|
||||||
types.push({
|
types.push({
|
||||||
id: 'Isolated',
|
id: 'Isolated',
|
||||||
name: 'label.isolated'
|
name: 'label.isolated'
|
||||||
|
|
|
||||||
|
|
@ -373,10 +373,22 @@ export default {
|
||||||
icon: 'wifi-outlined',
|
icon: 'wifi-outlined',
|
||||||
docHelp: 'adminguide/networking.html#network-offerings',
|
docHelp: 'adminguide/networking.html#network-offerings',
|
||||||
permission: ['listNetworkOfferings'],
|
permission: ['listNetworkOfferings'],
|
||||||
searchFilters: ['name', 'zoneid', 'domainid', 'tags'],
|
filters: ['all', 'forvpc', 'guestnetwork'],
|
||||||
|
searchFilters: ['name', 'zoneid', 'domainid', 'guestiptype', 'tags'],
|
||||||
columns: ['name', 'state', 'guestiptype', 'traffictype', 'networkrate', 'domain', 'zone', 'order'],
|
columns: ['name', 'state', 'guestiptype', 'traffictype', 'networkrate', 'domain', 'zone', 'order'],
|
||||||
details: ['name', 'id', 'displaytext', 'guestiptype', 'traffictype', 'internetprotocol', 'networkrate', 'ispersistent', 'egressdefaultpolicy', 'availability', 'conservemode', 'specifyvlan', 'routingmode', 'specifyasnumber', 'specifyipranges', 'supportspublicaccess', 'supportsstrechedl2subnet', 'forvpc', 'fornsx', 'networkmode', 'service', 'tags', 'domain', 'zone'],
|
details: ['name', 'id', 'displaytext', 'guestiptype', 'traffictype', 'internetprotocol', 'networkrate', 'ispersistent', 'egressdefaultpolicy', 'availability', 'conservemode', 'specifyvlan', 'routingmode', 'specifyasnumber', 'specifyipranges', 'supportspublicaccess', 'supportsstrechedl2subnet', 'forvpc', 'fornsx', 'networkmode', 'service', 'tags', 'domain', 'zone'],
|
||||||
resourceType: 'NetworkOffering',
|
resourceType: 'NetworkOffering',
|
||||||
|
customParamHandler: (params, query) => {
|
||||||
|
const { filter } = query
|
||||||
|
if (!filter) {
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
params.forvpc = filter === 'forvpc'
|
||||||
|
if (filter === 'all') {
|
||||||
|
delete params.forvpc
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
},
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
name: 'details',
|
name: 'details',
|
||||||
|
|
|
||||||
|
|
@ -692,7 +692,7 @@ export default {
|
||||||
return this.$route.query.filter
|
return this.$route.query.filter
|
||||||
}
|
}
|
||||||
const routeName = this.$route.name
|
const routeName = this.$route.name
|
||||||
if ((this.projectView && routeName === 'vm') || (['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype) && ['vm', 'iso', 'template', 'pod', 'cluster', 'host', 'systemvm', 'router', 'storagepool'].includes(routeName)) || ['account', 'guestnetwork', 'guestvlans', 'oauthsetting', 'guestos', 'guestoshypervisormapping', 'kubernetes', 'asnumbers'].includes(routeName)) {
|
if ((this.projectView && routeName === 'vm') || (['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype) && ['vm', 'iso', 'template', 'pod', 'cluster', 'host', 'systemvm', 'router', 'storagepool'].includes(routeName)) || ['account', 'guestnetwork', 'guestvlans', 'oauthsetting', 'guestos', 'guestoshypervisormapping', 'kubernetes', 'asnumbers', 'networkoffering'].includes(routeName)) {
|
||||||
return 'all'
|
return 'all'
|
||||||
}
|
}
|
||||||
if (['publicip'].includes(routeName)) {
|
if (['publicip'].includes(routeName)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue