Skip to content

Commit 546ef31

Browse files
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
1 parent db2e89a commit 546ef31

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

ui/src/components/view/SearchView.vue

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</span>
8181
<global-outlined v-else style="margin-right: 5px" />
8282
</span>
83-
<span v-if="(field.name.startsWith('domain') || field.name === 'account')">
83+
<span v-if="(field.name.startsWith('domain') || field.name === 'account' || field.name.startsWith('associatednetwork'))">
8484
<span v-if="opt.icon">
8585
<resource-icon :image="opt.icon.base64image" size="1x" style="margin-right: 5px"/>
8686
</span>
@@ -90,13 +90,6 @@
9090
<status :text="opt.state" />
9191
</span>
9292
{{ $t((['storageid'].includes(field.name) || !opt.path) ? opt.name : opt.path) }}
93-
<span v-if="(field.name.startsWith('associatednetwork'))">
94-
<span v-if="opt.icon">
95-
<resource-icon :image="opt.icon.base64image" size="1x" style="margin-right: 5px"/>
96-
</span>
97-
<block-outlined v-else style="margin-right: 5px" />
98-
</span>
99-
{{ $t(opt.path || opt.name) }}
10093
</div>
10194
</a-select-option>
10295
</a-select>
@@ -313,7 +306,7 @@ export default {
313306
}
314307
if (['zoneid', 'domainid', 'imagestoreid', 'storageid', 'state', 'account', 'hypervisor', 'level',
315308
'clusterid', 'podid', 'groupid', 'entitytype', 'accounttype', 'systemvmtype', 'scope', 'provider',
316-
'type', 'scope', 'managementserverid', 'serviceofferingid', 'diskofferingid', 'networkid', 'usagetype', 'restartrequired'].includes(item)
309+
'type', 'scope', 'managementserverid', 'serviceofferingid', 'diskofferingid', 'networkid', 'usagetype', 'restartrequired', 'guestiptype'].includes(item)
317310
) {
318311
type = 'list'
319312
} else if (item === 'tags') {
@@ -335,9 +328,9 @@ export default {
335328
return arrayField
336329
},
337330
fetchStaticFieldData (arrayField) {
338-
if (arrayField.includes('type')) {
339-
if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
340-
const typeIndex = this.fields.findIndex(item => item.name === 'type')
331+
if (arrayField.includes('type') || arrayField.includes('guestiptype')) {
332+
if (this.$route.path.includes('/guestnetwork') || this.$route.path.includes('/networkoffering')) {
333+
const typeIndex = this.fields.findIndex(item => ['type', 'guestiptype'].includes(item.name))
341334
this.fields[typeIndex].loading = true
342335
this.fields[typeIndex].opts = this.fetchGuestNetworkTypes()
343336
this.fields[typeIndex].loading = false
@@ -982,7 +975,7 @@ export default {
982975
},
983976
fetchGuestNetworkTypes () {
984977
const types = []
985-
if (this.apiName.indexOf('listNetworks') > -1) {
978+
if (['listNetworks', 'listNetworkOfferings'].includes(this.apiName)) {
986979
types.push({
987980
id: 'Isolated',
988981
name: 'label.isolated'

ui/src/config/section/offering.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,22 @@ export default {
373373
icon: 'wifi-outlined',
374374
docHelp: 'adminguide/networking.html#network-offerings',
375375
permission: ['listNetworkOfferings'],
376-
searchFilters: ['name', 'zoneid', 'domainid', 'tags'],
376+
filters: ['all', 'forvpc', 'guestnetwork'],
377+
searchFilters: ['name', 'zoneid', 'domainid', 'guestiptype', 'tags'],
377378
columns: ['name', 'state', 'guestiptype', 'traffictype', 'networkrate', 'domain', 'zone', 'order'],
378379
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'],
379380
resourceType: 'NetworkOffering',
381+
customParamHandler: (params, query) => {
382+
const { filter } = query
383+
if (!filter) {
384+
return params
385+
}
386+
params.forvpc = filter === 'forvpc'
387+
if (filter === 'all') {
388+
delete params.forvpc
389+
}
390+
return params
391+
},
380392
tabs: [
381393
{
382394
name: 'details',

ui/src/views/AutogenView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ export default {
692692
return this.$route.query.filter
693693
}
694694
const routeName = this.$route.name
695-
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)) {
695+
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)) {
696696
return 'all'
697697
}
698698
if (['publicip'].includes(routeName)) {

0 commit comments

Comments
 (0)