mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
simplify code using optional chaining in multiple views (#5630)
* simplify code using optional chaining in multiple views * Undo simplify chaining in CreateL2NetworkForm
This commit is contained in:
parent
e3f0e3b544
commit
649be0d8c7
@ -546,8 +546,7 @@ export default {
|
||||
}).catch(error => {
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.createvlaniprangeresponse
|
||||
? error.response.data.createvlaniprangeresponse.errortext : error.response.data.errorresponse.errortext,
|
||||
description: error.response.data.createvlaniprangeresponse?.errortext || error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
})
|
||||
}).finally(() => {
|
||||
@ -578,8 +577,7 @@ export default {
|
||||
}).catch(error => {
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.updatevlaniprangeresponse
|
||||
? error.response.data.updatevlaniprangeresponse.errortext : error.response.data.errorresponse.errortext,
|
||||
description: error.response.data.updatevlaniprangeresponse?.errortext || error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
})
|
||||
}).finally(() => {
|
||||
|
||||
@ -235,7 +235,7 @@ export default {
|
||||
},
|
||||
returnPodName (id) {
|
||||
const match = this.pods.find(i => i.id === id)
|
||||
return match ? match.name : null
|
||||
return match?.name || null
|
||||
},
|
||||
handleOpenAddIpRangeModal () {
|
||||
this.addIpRangeModal = true
|
||||
|
||||
@ -144,7 +144,7 @@ export default {
|
||||
const params = {}
|
||||
if (args.mapping) {
|
||||
Object.keys(args.mapping).map(key => {
|
||||
params[key] = 'value' in args.mapping[key] ? args.mapping[key].value(this.resource) : null
|
||||
params[key] = 'value' in args.mapping[key]?.value(this.resource) || null
|
||||
})
|
||||
}
|
||||
params.page = this.page
|
||||
@ -190,7 +190,7 @@ export default {
|
||||
this.listData[args.title].loading = false
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
description: (error.response?.headers?.['x-description']) || error.message
|
||||
})
|
||||
}
|
||||
this.$forceUpdate()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user