Skip to content

Commit a1bd0d4

Browse files
Pearl1594dhslove
authored andcommitted
UI: Prevent exceptions when network service provider that's disabled is viewed (apache#11413)
1 parent 531dd9d commit a1bd0d4

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

ui/src/views/infra/network/providers/ProviderItem.vue

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ export default {
9393
currentAction: {},
9494
page: 1,
9595
pageSize: 10,
96-
itemCount: 0
96+
itemCount: 0,
97+
pluginEnabled: false
9798
}
9899
},
99100
provide () {
@@ -139,6 +140,19 @@ export default {
139140
this.provider.lists.map(this.fetchOptions)
140141
}
141142
},
143+
async fetchConfiguration (configName) {
144+
const params = {
145+
name: configName
146+
}
147+
getAPI('listConfigurations', params).then(json => {
148+
if (json.listconfigurationsresponse.configuration !== null) {
149+
const config = json.listconfigurationsresponse.configuration[0]
150+
if (config && config.name === params.name) {
151+
this.pluginEnabled = config.value
152+
}
153+
}
154+
})
155+
},
142156
async fetchOptions (args) {
143157
if (!args || Object.keys(args).length === 0) {
144158
return
@@ -185,6 +199,18 @@ export default {
185199
}
186200
187201
try {
202+
const providers = ['tungsten', 'nsx', 'netris']
203+
const apiLower = args.api.toLowerCase()
204+
205+
for (const provider of providers) {
206+
if (apiLower.includes(provider)) {
207+
await this.fetchConfiguration(`${provider}.plugin.enable`)
208+
if (!this.pluginEnabled) {
209+
this.listData[args.title].loading = false
210+
return
211+
}
212+
}
213+
}
188214
const listResult = await this.executeApi(args.api, params)
189215
this.listData[args.title].data = listResult.data
190216
this.listData[args.title].itemCount = listResult.itemCount

0 commit comments

Comments
 (0)