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

nvazquez 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 649be0d  simplify code using optional chaining in multiple views 
(#5630)
649be0d is described below

commit 649be0d8c7527137bd3b8d5c216176dac9fc028d
Author: Daman Arora <[email protected]>
AuthorDate: Sun Feb 6 08:09:41 2022 -0500

    simplify code using optional chaining in multiple views (#5630)
    
    * simplify code using optional chaining in multiple views
    
    * Undo simplify chaining in CreateL2NetworkForm
---
 ui/src/views/infra/network/IpRangesTabPublic.vue      | 6 ++----
 ui/src/views/infra/network/IpRangesTabStorage.vue     | 2 +-
 ui/src/views/infra/network/providers/ProviderItem.vue | 4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/ui/src/views/infra/network/IpRangesTabPublic.vue 
b/ui/src/views/infra/network/IpRangesTabPublic.vue
index ff1976f..e97b411 100644
--- a/ui/src/views/infra/network/IpRangesTabPublic.vue
+++ b/ui/src/views/infra/network/IpRangesTabPublic.vue
@@ -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(() => {
diff --git a/ui/src/views/infra/network/IpRangesTabStorage.vue 
b/ui/src/views/infra/network/IpRangesTabStorage.vue
index 7250c51..0570d9f 100644
--- a/ui/src/views/infra/network/IpRangesTabStorage.vue
+++ b/ui/src/views/infra/network/IpRangesTabStorage.vue
@@ -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
diff --git a/ui/src/views/infra/network/providers/ProviderItem.vue 
b/ui/src/views/infra/network/providers/ProviderItem.vue
index 73931bd..5cbdf78 100644
--- a/ui/src/views/infra/network/providers/ProviderItem.vue
+++ b/ui/src/views/infra/network/providers/ProviderItem.vue
@@ -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()

Reply via email to