mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 09:41:57 +00:00
Review feedback on supporting multiple relatives in node-grid columns
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import groupBy from 'lodash/groupBy';
|
||||
import forEach from 'lodash/forEach';
|
||||
import mapValues from 'lodash/mapValues';
|
||||
import { groupBy, mapValues } from 'lodash';
|
||||
import { intersperse } from '../../utils/array-utils';
|
||||
|
||||
|
||||
@@ -11,7 +9,7 @@ import NodeDetailsTableNodeMetric from './node-details-table-node-metric';
|
||||
import { formatDataType } from '../../utils/string-utils';
|
||||
|
||||
function getValuesForNode(node) {
|
||||
const values = {};
|
||||
let values = {};
|
||||
['metrics', 'metadata'].forEach((collection) => {
|
||||
if (node[collection]) {
|
||||
node[collection].forEach((field) => {
|
||||
@@ -32,9 +30,10 @@ function getValuesForNode(node) {
|
||||
relatives,
|
||||
}));
|
||||
|
||||
forEach(relativesByTopologyId, (columnData, topologyId) => {
|
||||
values[topologyId] = columnData;
|
||||
});
|
||||
values = {
|
||||
...values,
|
||||
...relativesByTopologyId,
|
||||
};
|
||||
}
|
||||
|
||||
return values;
|
||||
|
||||
@@ -28,5 +28,14 @@ export function moveElement(array, from, to) {
|
||||
}
|
||||
|
||||
export function intersperse(items, value) {
|
||||
//
|
||||
// intersperse([1, 2, 3], 'a') => [1, 'a', 2, 'a', 3]
|
||||
//
|
||||
// Useful for when you wanna do: [<MyReactListItem />, <MyReactListItem />].join(' ')
|
||||
// But you can't because React Components aren't strings.
|
||||
//
|
||||
// intersperse([<MyReactListItem />, <MyReactListItem />], ' ')
|
||||
// Will get you there!
|
||||
//
|
||||
return [].concat(...items.map(e => [value, e])).slice(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user