diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-09-01 01:18:05 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-09-01 19:03:30 +0300 |
commit | a4d3ac40670abf853f531cc99284859a0941b2ca (patch) | |
tree | b3b89a796320cbf7394a1a0fa2afe89b7c6a031a /app/assets/javascripts/monitoring | |
parent | ce06927bddee1b706c24570e2c14b8a66e0c9d31 (diff) |
simplify storeMetrics method
Diffstat (limited to 'app/assets/javascripts/monitoring')
-rw-r--r-- | app/assets/javascripts/monitoring/stores/monitoring_store.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/assets/javascripts/monitoring/stores/monitoring_store.js b/app/assets/javascripts/monitoring/stores/monitoring_store.js index 541c8e7dd46..47ac8c5ff78 100644 --- a/app/assets/javascripts/monitoring/stores/monitoring_store.js +++ b/app/assets/javascripts/monitoring/stores/monitoring_store.js @@ -1,5 +1,7 @@ import _ from 'underscore'; +const sortMetrics = metrics => _.chain(metrics).sortBy('weight').sortBy('title').value(); + class MonitoringStore { constructor() { this.groups = []; @@ -43,12 +45,10 @@ class MonitoringStore { } storeMetrics(groups = []) { - this.groups = groups.map((group) => { - const currentGroup = group; - currentGroup.metrics = _.chain(group.metrics).sortBy('weight').sortBy('title').value(); - currentGroup.metrics = this.createArrayRows(currentGroup.metrics); - return currentGroup; - }); + this.groups = groups.map(group => ({ + ...group, + metrics: this.createArrayRows(sortMetrics(group.metrics)), + })); } storeDeploymentData(deploymentData = []) { |