Skip to content

Commit

Permalink
UI: Add UI support for forvpc and guestiptype parameters of the `…
Browse files Browse the repository at this point in the history
…listNetworkOfferings` API (#9947)

* add guestiptype and forvpc filters for listNetworkOfferings on UI

* fix duplicate option names on list filters
  • Loading branch information
bernardodemarco authored Nov 29, 2024
1 parent db2e89a commit 546ef31
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
19 changes: 6 additions & 13 deletions ui/src/components/view/SearchView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
</span>
<global-outlined v-else style="margin-right: 5px" />
</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">
<resource-icon :image="opt.icon.base64image" size="1x" style="margin-right: 5px"/>
</span>
Expand All @@ -90,13 +90,6 @@
<status :text="opt.state" />
</span>
{{ $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>
</a-select-option>
</a-select>
Expand Down Expand Up @@ -313,7 +306,7 @@ export default {
}
if (['zoneid', 'domainid', 'imagestoreid', 'storageid', 'state', 'account', 'hypervisor', 'level',
'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'
} else if (item === 'tags') {
Expand All @@ -335,9 +328,9 @@ export default {
return arrayField
},
fetchStaticFieldData (arrayField) {
if (arrayField.includes('type')) {
if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
const typeIndex = this.fields.findIndex(item => item.name === 'type')
if (arrayField.includes('type') || arrayField.includes('guestiptype')) {
if (this.$route.path.includes('/guestnetwork') || this.$route.path.includes('/networkoffering')) {
const typeIndex = this.fields.findIndex(item => ['type', 'guestiptype'].includes(item.name))
this.fields[typeIndex].loading = true
this.fields[typeIndex].opts = this.fetchGuestNetworkTypes()
this.fields[typeIndex].loading = false
Expand Down Expand Up @@ -982,7 +975,7 @@ export default {
},
fetchGuestNetworkTypes () {
const types = []
if (this.apiName.indexOf('listNetworks') > -1) {
if (['listNetworks', 'listNetworkOfferings'].includes(this.apiName)) {
types.push({
id: 'Isolated',
name: 'label.isolated'
Expand Down
14 changes: 13 additions & 1 deletion ui/src/config/section/offering.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,22 @@ export default {
icon: 'wifi-outlined',
docHelp: 'adminguide/networking.html#network-offerings',
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'],
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',
customParamHandler: (params, query) => {
const { filter } = query
if (!filter) {
return params
}
params.forvpc = filter === 'forvpc'
if (filter === 'all') {
delete params.forvpc
}
return params
},
tabs: [
{
name: 'details',
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/AutogenView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ export default {
return this.$route.query.filter
}
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'
}
if (['publicip'].includes(routeName)) {
Expand Down

0 comments on commit 546ef31

Please sign in to comment.