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 38181b2 Optional chaining used to enhance readability (#5961)
38181b2 is described below
commit 38181b2afa28443fe27b53ef5893b434d0b78e2d
Author: Yashika <[email protected]>
AuthorDate: Thu Feb 10 09:57:54 2022 +0530
Optional chaining used to enhance readability (#5961)
* Optional chaining used to enhance readability
* Added Suggested change
Co-authored-by: YashikaSarkar
<[email protected]>
---
ui/src/components/header/ProjectMenu.vue | 2 +-
ui/src/components/view/BulkActionProgress.vue | 2 +-
ui/src/components/view/DedicateData.vue | 12 ++++--------
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/ui/src/components/header/ProjectMenu.vue
b/ui/src/components/header/ProjectMenu.vue
index 8a5f1da..959d8f3 100644
--- a/ui/src/components/header/ProjectMenu.vue
+++ b/ui/src/components/header/ProjectMenu.vue
@@ -79,7 +79,7 @@ export default {
const getNextPage = () => {
this.loading = true
api('listProjects', { listAll: true, details: 'min', page: page,
pageSize: 500, showIcon: true }).then(json => {
- if (json && json.listprojectsresponse &&
json.listprojectsresponse.project) {
+ if (json?.listprojectsresponse?.listprojectsresponse.project) {
projects.push(...json.listprojectsresponse.project)
}
if (projects.length < json.listprojectsresponse.count) {
diff --git a/ui/src/components/view/BulkActionProgress.vue
b/ui/src/components/view/BulkActionProgress.vue
index 73a6a34..2146715 100644
--- a/ui/src/components/view/BulkActionProgress.vue
+++ b/ui/src/components/view/BulkActionProgress.vue
@@ -155,7 +155,7 @@ export default {
this.tableChanged = true
},
filterItems () {
- if (this.appliedFilterStatus && this.appliedFilterStatus.length > 0) {
+ if (this.appliedFilterStatus?.length > 0) {
this.filteredItems = this.selectedItems.filter(item => {
if (this.appliedFilterStatus.includes(item.status)) {
return item
diff --git a/ui/src/components/view/DedicateData.vue
b/ui/src/components/view/DedicateData.vue
index 0818c70..a00cab5 100644
--- a/ui/src/components/view/DedicateData.vue
+++ b/ui/src/components/view/DedicateData.vue
@@ -121,8 +121,7 @@ export default {
api('listDedicatedZones', {
zoneid: this.resource.id
}).then(response => {
- if (response.listdedicatedzonesresponse.dedicatedzone &&
- response.listdedicatedzonesresponse.dedicatedzone.length > 0) {
+ if (response?.listdedicatedzonesresponse?.dedicatedzone?.length > 0) {
this.dedicatedDomainId =
response.listdedicatedzonesresponse.dedicatedzone[0].domainid
this.dedicatedAccountId =
response.listdedicatedzonesresponse.dedicatedzone[0].accountid
}
@@ -134,8 +133,7 @@ export default {
api('listDedicatedPods', {
podid: this.resource.id
}).then(response => {
- if (response.listdedicatedpodsresponse.dedicatedpod &&
- response.listdedicatedpodsresponse.dedicatedpod.length > 0) {
+ if (response?.listdedicatedpodsresponse?.dedicatedpod?.length > 0) {
this.dedicatedDomainId =
response.listdedicatedpodsresponse.dedicatedpod[0].domainid
this.dedicatedAccountId =
response.listdedicatedpodsresponse.dedicatedpod[0].accountid
}
@@ -147,8 +145,7 @@ export default {
api('listDedicatedClusters', {
clusterid: this.resource.id
}).then(response => {
- if (response.listdedicatedclustersresponse.dedicatedcluster &&
- response.listdedicatedclustersresponse.dedicatedcluster.length >
0) {
+ if (response?.listdedicatedclustersresponse?.dedicatedcluster?.length
> 0) {
this.dedicatedDomainId =
response.listdedicatedclustersresponse.dedicatedcluster[0].domainid
this.dedicatedAccountId =
response.listdedicatedclustersresponse.dedicatedcluster[0].accountid
}
@@ -160,8 +157,7 @@ export default {
api('listDedicatedHosts', {
hostid: this.resource.id
}).then(response => {
- if (response.listdedicatedhostsresponse.dedicatedhost &&
- response.listdedicatedhostsresponse.dedicatedhost.length > 0) {
+ if (response?.listdedicatedhostsresponse?.dedicatedhost?.length > 0) {
this.dedicatedDomainId =
response.listdedicatedhostsresponse.dedicatedhost[0].domainid
this.dedicatedAccountId =
response.listdedicatedhostsresponse.dedicatedhost[0].accountid
}