This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 610b2d0  simplify code using optional chaining in compute views (#5635)
610b2d0 is described below

commit 610b2d0dd0c10904799888baef0fcb1325ea6768
Author: Daman Arora <[email protected]>
AuthorDate: Tue Jan 4 01:53:28 2022 -0500

    simplify code using optional chaining in compute views (#5635)
---
 ui/src/views/compute/CreateSSHKeyPair.vue     | 2 +-
 ui/src/views/compute/KubernetesServiceTab.vue | 2 +-
 ui/src/views/compute/MigrateWizard.vue        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ui/src/views/compute/CreateSSHKeyPair.vue 
b/ui/src/views/compute/CreateSSHKeyPair.vue
index f244fe2..06b41dc 100644
--- a/ui/src/views/compute/CreateSSHKeyPair.vue
+++ b/ui/src/views/compute/CreateSSHKeyPair.vue
@@ -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')
diff --git a/ui/src/views/compute/KubernetesServiceTab.vue 
b/ui/src/views/compute/KubernetesServiceTab.vue
index 55254dd..768fdf1 100644
--- a/ui/src/views/compute/KubernetesServiceTab.vue
+++ b/ui/src/views/compute/KubernetesServiceTab.vue
@@ -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 => {
diff --git a/ui/src/views/compute/MigrateWizard.vue 
b/ui/src/views/compute/MigrateWizard.vue
index 9899dc5..10c0f81 100644
--- a/ui/src/views/compute/MigrateWizard.vue
+++ b/ui/src/views/compute/MigrateWizard.vue
@@ -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(() => {

Reply via email to