You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/12/13 02:13:44 UTC

[GitHub] [cloudstack] utchoang commented on a change in pull request #5764: simplify code using optional chaining in multiple config files

utchoang commented on a change in pull request #5764:
URL: https://github.com/apache/cloudstack/pull/5764#discussion_r767370771



##########
File path: ui/src/config/section/infra/clusters.js
##########
@@ -114,8 +114,7 @@ export default {
       message: 'label.outofbandmanagement.enable',
       dataView: true,
       show: (record) => {
-        return record.resourcedetails && record.resourcedetails.outOfBandManagementEnabled &&
-          record.resourcedetails.outOfBandManagementEnabled === 'false'
+        return record.resourcedetails?.outOfBandManagementEnabled === 'false'

Review comment:
       Should be `record?.resourcedetails?.outOfBandManagementEnabled === 'false'`

##########
File path: ui/src/config/section/infra/clusters.js
##########
@@ -131,8 +130,7 @@ export default {
       message: 'label.outofbandmanagement.disable',
       dataView: true,
       show: (record) => {
-        return !(record.resourcedetails && record.resourcedetails.outOfBandManagementEnabled &&
-          record.resourcedetails.outOfBandManagementEnabled === 'false')
+        return !(record.resourcedetails?.outOfBandManagementEnabled === 'false')

Review comment:
       Should be `return !(record?.resourcedetails?.outOfBandManagementEnabled === 'false')`

##########
File path: ui/src/config/section/infra/hosts.js
##########
@@ -152,8 +152,7 @@ export default {
       docHelp: 'adminguide/hosts.html#out-of-band-management',
       dataView: true,
       show: (record) => {
-        return !(record.outofbandmanagement && record.outofbandmanagement.enabled &&
-          record.outofbandmanagement.enabled === true)
+        return !(record.outofbandmanagement?.enabled === true)

Review comment:
       `return !(record?.outofbandmanagement?.enabled === true)`

##########
File path: ui/src/config/section/infra/hosts.js
##########
@@ -188,8 +186,7 @@ export default {
       docHelp: 'adminguide/hosts.html#out-of-band-management',
       dataView: true,
       show: (record) => {
-        return record.outofbandmanagement && record.outofbandmanagement.enabled &&
-          record.outofbandmanagement.enabled === true
+        return record.outofbandmanagement?.enabled === true

Review comment:
       `return record?.outofbandmanagement?.enabled === true`

##########
File path: ui/src/config/section/infra/clusters.js
##########
@@ -148,8 +146,7 @@ export default {
       message: 'label.ha.enable',
       dataView: true,
       show: (record) => {
-        return record.resourcedetails && record.resourcedetails.resourceHAEnabled &&
-          record.resourcedetails.resourceHAEnabled === 'false'
+        return record.resourcedetails?.resourceHAEnabled === 'false'

Review comment:
       `return record?.resourcedetails?.resourceHAEnabled === 'false'`

##########
File path: ui/src/config/section/infra/clusters.js
##########
@@ -165,8 +162,7 @@ export default {
       message: 'label.ha.disable',
       dataView: true,
       show: (record) => {
-        return !(record.resourcedetails && record.resourcedetails.resourceHAEnabled &&
-          record.resourcedetails.resourceHAEnabled === 'false')
+        return !(record.resourcedetails?.resourceHAEnabled === 'false')

Review comment:
       `return !(record?.resourcedetails?.resourceHAEnabled === 'false')`

##########
File path: ui/src/config/section/infra/zones.js
##########
@@ -126,8 +126,7 @@ export default {
       message: 'label.outofbandmanagement.enable',
       dataView: true,
       show: (record) => {
-        return record.resourcedetails && record.resourcedetails.outOfBandManagementEnabled &&
-          record.resourcedetails.outOfBandManagementEnabled === 'false'
+        return record.resourcedetails?.outOfBandManagementEnabled === 'false'

Review comment:
       `return record?.resourcedetails?.outOfBandManagementEnabled === 'false'`

##########
File path: ui/src/config/section/infra/hosts.js
##########
@@ -209,8 +206,7 @@ export default {
       docHelp: 'adminguide/hosts.html#out-of-band-management',
       dataView: true,
       show: (record) => {
-        return record.outofbandmanagement && record.outofbandmanagement.enabled &&
-          record.outofbandmanagement.enabled === true
+        return record.outofbandmanagement?.enabled === true

Review comment:
       `return record.outofbandmanagement?.enabled === true`

##########
File path: ui/src/config/section/infra/hosts.js
##########
@@ -245,8 +241,7 @@ export default {
       docHelp: 'adminguide/reliability.html#ha-for-hosts',
       dataView: true,
       show: (record) => {
-        return !(record.hostha && record.hostha.haenable &&
-          record.hostha.haenable === true)
+        return !(record.hostha?.haenable === true)

Review comment:
       `return !(record?.hostha?.haenable === true)`

##########
File path: ui/src/config/section/infra/zones.js
##########
@@ -143,8 +142,7 @@ export default {
       message: 'label.outofbandmanagement.disable',
       dataView: true,
       show: (record) => {
-        return !(record.resourcedetails && record.resourcedetails.outOfBandManagementEnabled &&
-          record.resourcedetails.outOfBandManagementEnabled === 'false')
+        return !(record.resourcedetails?.outOfBandManagementEnabled === 'false')

Review comment:
       `return !(record?.resourcedetails?.outOfBandManagementEnabled === 'false')`

##########
File path: ui/src/config/section/infra/hosts.js
##########
@@ -170,8 +169,7 @@ export default {
       docHelp: 'adminguide/hosts.html#out-of-band-management',
       dataView: true,
       show: (record) => {
-        return record.outofbandmanagement && record.outofbandmanagement.enabled &&
-          record.outofbandmanagement.enabled === true
+        return record.outofbandmanagement?.enabled === true

Review comment:
       `return record?.outofbandmanagement?.enabled === true`

##########
File path: ui/src/config/section/infra/zones.js
##########
@@ -160,8 +158,7 @@ export default {
       message: 'label.ha.enable',
       dataView: true,
       show: (record) => {
-        return record.resourcedetails && record.resourcedetails.resourceHAEnabled &&
-          record.resourcedetails.resourceHAEnabled === 'false'
+        return record.resourcedetails?.resourceHAEnabled === 'false'

Review comment:
       `return record?.resourcedetails?.resourceHAEnabled === 'false'`

##########
File path: ui/src/config/section/infra/zones.js
##########
@@ -177,8 +174,7 @@ export default {
       message: 'label.ha.disable',
       dataView: true,
       show: (record) => {
-        return !(record.resourcedetails && record.resourcedetails.resourceHAEnabled &&
-          record.resourcedetails.resourceHAEnabled === 'false')
+        return !(record.resourcedetails?.resourceHAEnabled === 'false')

Review comment:
       `return !(record?.resourcedetails?.resourceHAEnabled === 'false')`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org