UI: Prevent exceptions when network service provider that's disabled is viewed (#11413)

This commit is contained in:
Pearl Dsilva 2025-10-14 02:24:59 -04:00 committed by GitHub
parent 0ca63f36a5
commit 5e7ae227d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,7 +93,8 @@ export default {
currentAction: {}, currentAction: {},
page: 1, page: 1,
pageSize: 10, pageSize: 10,
itemCount: 0 itemCount: 0,
pluginEnabled: false
} }
}, },
provide () { provide () {
@ -139,6 +140,19 @@ export default {
this.provider.lists.map(this.fetchOptions) this.provider.lists.map(this.fetchOptions)
} }
}, },
async fetchConfiguration (configName) {
const params = {
name: configName
}
getAPI('listConfigurations', params).then(json => {
if (json.listconfigurationsresponse.configuration !== null) {
const config = json.listconfigurationsresponse.configuration[0]
if (config && config.name === params.name) {
this.pluginEnabled = config.value
}
}
})
},
async fetchOptions (args) { async fetchOptions (args) {
if (!args || Object.keys(args).length === 0) { if (!args || Object.keys(args).length === 0) {
return return
@ -185,6 +199,18 @@ export default {
} }
try { try {
const providers = ['tungsten', 'nsx', 'netris']
const apiLower = args.api.toLowerCase()
for (const provider of providers) {
if (apiLower.includes(provider)) {
await this.fetchConfiguration(`${provider}.plugin.enable`)
if (!this.pluginEnabled) {
this.listData[args.title].loading = false
return
}
}
}
const listResult = await this.executeApi(args.api, params) const listResult = await this.executeApi(args.api, params)
this.listData[args.title].data = listResult.data this.listData[args.title].data = listResult.data
this.listData[args.title].itemCount = listResult.itemCount this.listData[args.title].itemCount = listResult.itemCount