mirror of https://github.com/apache/cloudstack.git
simplify code using optional chaining in compute views (#5635)
This commit is contained in:
parent
bf3d1338e0
commit
610b2d0dd0
|
|
@ -176,7 +176,7 @@ export default {
|
|||
} else {
|
||||
api('createSSHKeyPair', params).then(json => {
|
||||
this.$message.success(this.$t('message.success.create.keypair') + ' ' + values.name)
|
||||
if (json.createsshkeypairresponse && json.createsshkeypairresponse.keypair && json.createsshkeypairresponse.keypair.privatekey) {
|
||||
if (json.createsshkeypairresponse?.keypair?.privatekey) {
|
||||
this.isSubmitted = true
|
||||
const key = json.createsshkeypairresponse.keypair.privatekey
|
||||
this.hiddenElement = document.createElement('a')
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ export default {
|
|||
fetchComments () {
|
||||
this.clusterConfigLoading = true
|
||||
api('listAnnotations', { entityid: this.resource.id, entitytype: 'KUBERNETES_CLUSTER', annotationfilter: 'all' }).then(json => {
|
||||
if (json.listannotationsresponse && json.listannotationsresponse.annotation) {
|
||||
if (json.listannotationsresponse?.annotation) {
|
||||
this.annotations = json.listannotationsresponse.annotation
|
||||
}
|
||||
}).catch(error => {
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ export default {
|
|||
this.$showNotification({
|
||||
type: '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,
|
||||
duration: 0
|
||||
})
|
||||
}).finally(() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue