This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 6b9615b2f9e Selected type on update traffic type is based on chosen 
type in traffic types tab (#10902)
6b9615b2f9e is described below

commit 6b9615b2f9ea3669e3d1f7c034f4e17d69c486df
Author: Nico <45316185+nicosch...@users.noreply.github.com>
AuthorDate: Thu Jul 31 06:51:19 2025 -0300

    Selected type on update traffic type is based on chosen type in traffic 
types tab (#10902)
    
    Co-authored-by: Nicole Schmidt <nicole.schm...@scclouds.com.br>
---
 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 @@
 
 <template>
   <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-popconfirm
           :title="$t('message.confirm.delete.traffic.type')"
@@ -84,6 +84,7 @@ import IpRangesTabPublic from './IpRangesTabPublic'
 import IpRangesTabManagement from './IpRangesTabManagement'
 import IpRangesTabStorage from './IpRangesTabStorage'
 import IpRangesTabGuest from './IpRangesTabGuest'
+import { trafficTypeTab } from '@/config/section/infra/phynetworks.js'
 
 export default {
   name: 'TrafficTypesTab',
@@ -221,6 +222,9 @@ export default {
         this.fetchLoading = false
         this.fetchTrafficTypes()
       })
+    },
+    onClick (trafficType) {
+      trafficTypeTab.index = trafficType
     }
   }
 }

Reply via email to