Skip to content

Commit 36b3c94

Browse files
nicoschmdtNicole Schmidt
authored andcommitted
Selected type on update traffic type is based on chosen type in traffic types tab (apache#10902)
Co-authored-by: Nicole Schmidt <[email protected]>
1 parent 3ec0b59 commit 36b3c94

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

ui/src/config/section/infra/phynetworks.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
import { shallowRef, defineAsyncComponent } from 'vue'
18+
import { shallowRef, defineAsyncComponent, reactive } from 'vue'
1919
export default {
2020
name: 'physicalnetwork',
2121
title: 'label.physical.network',
@@ -131,3 +131,6 @@ export default {
131131
}
132132
]
133133
}
134+
export const trafficTypeTab = reactive({
135+
index: 0
136+
})

ui/src/views/infra/network/EditTrafficLabel.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
import { ref, reactive, toRaw } from 'vue'
100100
import { getAPI, postAPI } from '@/api'
101101
import TooltipLabel from '@/components/widgets/TooltipLabel'
102+
import { trafficTypeTab } from '@/config/section/infra/phynetworks.js'
102103
103104
export default {
104105
name: 'EditTrafficLabel',
@@ -150,9 +151,9 @@ export default {
150151
getAPI('listTrafficTypes', { physicalnetworkid: this.resource.id })
151152
.then(json => {
152153
this.trafficTypes = json.listtraffictypesresponse.traffictype || []
153-
this.form.id = this.trafficTypes[0].id || undefined
154-
this.trafficResource = this.trafficTypes[0] || {}
155-
this.traffictype = this.trafficTypes[0].traffictype || undefined
154+
this.form.id = this.trafficTypes[trafficTypeTab.index].id || undefined
155+
this.trafficResource = this.trafficTypes[trafficTypeTab.index] || {}
156+
this.traffictype = this.trafficTypes[trafficTypeTab.index].traffictype || undefined
156157
this.fillEditFromFieldValues()
157158
}).catch(error => {
158159
this.$notification.error({

ui/src/views/infra/network/TrafficTypesTab.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<template>
1919
<a-spin :spinning="fetchLoading">
20-
<a-tabs :tabPosition="device === 'mobile' ? 'top' : 'left'" :animated="false">
20+
<a-tabs :tabPosition="device === 'mobile' ? 'top' : 'left'" :animated="false" @tabClick="onClick">
2121
<a-tab-pane v-for="(item, index) in traffictypes" :tab="item.traffictype" :key="index">
2222
<a-popconfirm
2323
:title="$t('message.confirm.delete.traffic.type')"
@@ -84,6 +84,7 @@ import IpRangesTabPublic from './IpRangesTabPublic'
8484
import IpRangesTabManagement from './IpRangesTabManagement'
8585
import IpRangesTabStorage from './IpRangesTabStorage'
8686
import IpRangesTabGuest from './IpRangesTabGuest'
87+
import { trafficTypeTab } from '@/config/section/infra/phynetworks.js'
8788
8889
export default {
8990
name: 'TrafficTypesTab',
@@ -221,6 +222,9 @@ export default {
221222
this.fetchLoading = false
222223
this.fetchTrafficTypes()
223224
})
225+
},
226+
onClick (trafficType) {
227+
trafficTypeTab.index = trafficType
224228
}
225229
}
226230
}

0 commit comments

Comments
 (0)