Commit a4d3ac40 authored by Mike Greiling's avatar Mike Greiling

simplify storeMetrics method

parent ce06927b
import _ from 'underscore'; import _ from 'underscore';
const sortMetrics = metrics => _.chain(metrics).sortBy('weight').sortBy('title').value();
class MonitoringStore { class MonitoringStore {
constructor() { constructor() {
this.groups = []; this.groups = [];
...@@ -43,12 +45,10 @@ class MonitoringStore { ...@@ -43,12 +45,10 @@ class MonitoringStore {
} }
storeMetrics(groups = []) { storeMetrics(groups = []) {
this.groups = groups.map((group) => { this.groups = groups.map(group => ({
const currentGroup = group; ...group,
currentGroup.metrics = _.chain(group.metrics).sortBy('weight').sortBy('title').value(); metrics: this.createArrayRows(sortMetrics(group.metrics)),
currentGroup.metrics = this.createArrayRows(currentGroup.metrics); }));
return currentGroup;
});
} }
storeDeploymentData(deploymentData = []) { storeDeploymentData(deploymentData = []) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment