Selected type on update traffic type is based on chosen type in traffic types tab (#10902)

Co-authored-by: Nicole Schmidt <nicole.schmidt@scclouds.com.br>
This commit is contained in:
Nico 2025-07-31 06:51:19 -03:00 committed by GitHub
parent f58372e97b
commit 6b9615b2f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 5 deletions

View File

@ -15,7 +15,7 @@
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
import { shallowRef, defineAsyncComponent } from 'vue' import { shallowRef, defineAsyncComponent, reactive } from 'vue'
export default { export default {
name: 'physicalnetwork', name: 'physicalnetwork',
title: 'label.physical.network', title: 'label.physical.network',
@ -131,3 +131,6 @@ export default {
} }
] ]
} }
export const trafficTypeTab = reactive({
index: 0
})

View File

@ -99,6 +99,7 @@
import { ref, reactive, toRaw } from 'vue' import { ref, reactive, toRaw } from 'vue'
import { getAPI, postAPI } from '@/api' import { getAPI, postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel' import TooltipLabel from '@/components/widgets/TooltipLabel'
import { trafficTypeTab } from '@/config/section/infra/phynetworks.js'
export default { export default {
name: 'EditTrafficLabel', name: 'EditTrafficLabel',
@ -150,9 +151,9 @@ export default {
getAPI('listTrafficTypes', { physicalnetworkid: this.resource.id }) getAPI('listTrafficTypes', { physicalnetworkid: this.resource.id })
.then(json => { .then(json => {
this.trafficTypes = json.listtraffictypesresponse.traffictype || [] this.trafficTypes = json.listtraffictypesresponse.traffictype || []
this.form.id = this.trafficTypes[0].id || undefined this.form.id = this.trafficTypes[trafficTypeTab.index].id || undefined
this.trafficResource = this.trafficTypes[0] || {} this.trafficResource = this.trafficTypes[trafficTypeTab.index] || {}
this.traffictype = this.trafficTypes[0].traffictype || undefined this.traffictype = this.trafficTypes[trafficTypeTab.index].traffictype || undefined
this.fillEditFromFieldValues() this.fillEditFromFieldValues()
}).catch(error => { }).catch(error => {
this.$notification.error({ this.$notification.error({

View File

@ -17,7 +17,7 @@
<template> <template>
<a-spin :spinning="fetchLoading"> <a-spin :spinning="fetchLoading">
<a-tabs :tabPosition="device === 'mobile' ? 'top' : 'left'" :animated="false"> <a-tabs :tabPosition="device === 'mobile' ? 'top' : 'left'" :animated="false" @tabClick="onClick">
<a-tab-pane v-for="(item, index) in traffictypes" :tab="item.traffictype" :key="index"> <a-tab-pane v-for="(item, index) in traffictypes" :tab="item.traffictype" :key="index">
<a-popconfirm <a-popconfirm
:title="$t('message.confirm.delete.traffic.type')" :title="$t('message.confirm.delete.traffic.type')"
@ -84,6 +84,7 @@ import IpRangesTabPublic from './IpRangesTabPublic'
import IpRangesTabManagement from './IpRangesTabManagement' import IpRangesTabManagement from './IpRangesTabManagement'
import IpRangesTabStorage from './IpRangesTabStorage' import IpRangesTabStorage from './IpRangesTabStorage'
import IpRangesTabGuest from './IpRangesTabGuest' import IpRangesTabGuest from './IpRangesTabGuest'
import { trafficTypeTab } from '@/config/section/infra/phynetworks.js'
export default { export default {
name: 'TrafficTypesTab', name: 'TrafficTypesTab',
@ -221,6 +222,9 @@ export default {
this.fetchLoading = false this.fetchLoading = false
this.fetchTrafficTypes() this.fetchTrafficTypes()
}) })
},
onClick (trafficType) {
trafficTypeTab.index = trafficType
} }
} }
} }