From 6b9615b2f9ea3669e3d1f7c034f4e17d69c486df Mon Sep 17 00:00:00 2001 From: Nico <45316185+nicoschmdt@users.noreply.github.com> Date: Thu, 31 Jul 2025 06:51:19 -0300 Subject: [PATCH] Selected type on update traffic type is based on chosen type in traffic types tab (#10902) Co-authored-by: Nicole Schmidt --- ui/src/config/section/infra/phynetworks.js | 5 ++++- ui/src/views/infra/network/EditTrafficLabel.vue | 7 ++++--- ui/src/views/infra/network/TrafficTypesTab.vue | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ui/src/config/section/infra/phynetworks.js b/ui/src/config/section/infra/phynetworks.js index 977fc984d2c..0863eff6ec0 100644 --- a/ui/src/config/section/infra/phynetworks.js +++ b/ui/src/config/section/infra/phynetworks.js @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -import { shallowRef, defineAsyncComponent } from 'vue' +import { shallowRef, defineAsyncComponent, reactive } from 'vue' export default { name: 'physicalnetwork', title: 'label.physical.network', @@ -131,3 +131,6 @@ export default { } ] } +export const trafficTypeTab = reactive({ + index: 0 +}) diff --git a/ui/src/views/infra/network/EditTrafficLabel.vue b/ui/src/views/infra/network/EditTrafficLabel.vue index 4739e81e8c9..b727089110b 100644 --- a/ui/src/views/infra/network/EditTrafficLabel.vue +++ b/ui/src/views/infra/network/EditTrafficLabel.vue @@ -99,6 +99,7 @@ import { ref, reactive, toRaw } from 'vue' import { getAPI, postAPI } from '@/api' import TooltipLabel from '@/components/widgets/TooltipLabel' +import { trafficTypeTab } from '@/config/section/infra/phynetworks.js' export default { name: 'EditTrafficLabel', @@ -150,9 +151,9 @@ export default { getAPI('listTrafficTypes', { physicalnetworkid: this.resource.id }) .then(json => { this.trafficTypes = json.listtraffictypesresponse.traffictype || [] - this.form.id = this.trafficTypes[0].id || undefined - this.trafficResource = this.trafficTypes[0] || {} - this.traffictype = this.trafficTypes[0].traffictype || undefined + this.form.id = this.trafficTypes[trafficTypeTab.index].id || undefined + this.trafficResource = this.trafficTypes[trafficTypeTab.index] || {} + this.traffictype = this.trafficTypes[trafficTypeTab.index].traffictype || undefined this.fillEditFromFieldValues() }).catch(error => { this.$notification.error({ diff --git a/ui/src/views/infra/network/TrafficTypesTab.vue b/ui/src/views/infra/network/TrafficTypesTab.vue index c65f8ec2aec..3120d85250c 100644 --- a/ui/src/views/infra/network/TrafficTypesTab.vue +++ b/ui/src/views/infra/network/TrafficTypesTab.vue @@ -17,7 +17,7 @@