mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Applied arrow-parens linting rule
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
"no-mixed-operators": 0,
|
||||
"no-restricted-properties": 0,
|
||||
"no-underscore-dangle": 0,
|
||||
"arrow-parens": 0,
|
||||
"class-methods-use-this": 0,
|
||||
"global-require": 0,
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('NodesLayout', () => {
|
||||
const coords = [];
|
||||
nodes
|
||||
.sortBy(node => node.get('id'))
|
||||
.forEach(node => {
|
||||
.forEach((node) => {
|
||||
coords.push(node.get('x'));
|
||||
coords.push(node.get('y'));
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ class NodeContainer extends React.Component {
|
||||
y: spring(dy, animConfig),
|
||||
f: spring(scaleFactor, animConfig)
|
||||
}}>
|
||||
{interpolated => {
|
||||
{(interpolated) => {
|
||||
const transform = `translate(${round(interpolated.x, layoutPrecision)},`
|
||||
+ `${round(interpolated.y, layoutPrecision)})`;
|
||||
return <Node {...other} transform={transform} scaleFactor={interpolated.f} />;
|
||||
|
||||
@@ -13,7 +13,7 @@ class NodesChartEdges extends React.Component {
|
||||
|
||||
return (
|
||||
<g className="nodes-chart-edges">
|
||||
{layoutEdges.toIndexedSeq().map(edge => {
|
||||
{layoutEdges.toIndexedSeq().map((edge) => {
|
||||
const sourceSelected = selectedNodeId === edge.get('source');
|
||||
const targetSelected = selectedNodeId === edge.get('target');
|
||||
const highlighted = highlightedEdgeIds.has(edge.get('id'));
|
||||
|
||||
@@ -28,7 +28,7 @@ class NodesChartNodes extends React.Component {
|
||||
&& !(node.get('networks') || makeList()).find(n => n.get('id') === selectedNetwork));
|
||||
|
||||
// make sure blurred nodes are in the background
|
||||
const sortNodes = node => {
|
||||
const sortNodes = (node) => {
|
||||
if (node.get('id') === mouseOverNodeId) {
|
||||
return 3;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class NodesChartNodes extends React.Component {
|
||||
};
|
||||
|
||||
// TODO: think about pulling this up into the store.
|
||||
const metric = node => {
|
||||
const metric = (node) => {
|
||||
const isHighlighted = topCardNode && topCardNode.details && topCardNode.id === node.get('id');
|
||||
const sourceNode = isHighlighted ? fromJS(topCardNode.details) : node;
|
||||
return sourceNode.get('metrics') && sourceNode.get('metrics')
|
||||
|
||||
@@ -52,7 +52,7 @@ function initEdges(nodes) {
|
||||
nodes.forEach((node, nodeId) => {
|
||||
const adjacency = node.get('adjacency');
|
||||
if (adjacency) {
|
||||
adjacency.forEach(adjacent => {
|
||||
adjacency.forEach((adjacent) => {
|
||||
const edge = [nodeId, adjacent];
|
||||
const edgeId = edge.join(EDGE_ID_SEPARATOR);
|
||||
|
||||
@@ -256,7 +256,7 @@ class NodesChart extends React.Component {
|
||||
const adjacentNodes = props.adjacentNodes;
|
||||
const adjacentLayoutNodeIds = [];
|
||||
|
||||
adjacentNodes.forEach(adjacentId => {
|
||||
adjacentNodes.forEach((adjacentId) => {
|
||||
// filter loopback
|
||||
if (adjacentId !== props.selectedNodeId) {
|
||||
adjacentLayoutNodeIds.push(adjacentId);
|
||||
@@ -293,7 +293,7 @@ class NodesChart extends React.Component {
|
||||
});
|
||||
|
||||
// fix all edges for circular nodes
|
||||
stateEdges = stateEdges.map(edge => {
|
||||
stateEdges = stateEdges.map((edge) => {
|
||||
if (edge.get('source') === props.selectedNodeId
|
||||
|| edge.get('target') === props.selectedNodeId
|
||||
|| includes(adjacentLayoutNodeIds, edge.get('source'))
|
||||
@@ -327,7 +327,7 @@ class NodesChart extends React.Component {
|
||||
y: node.get('py')
|
||||
}));
|
||||
|
||||
const edges = state.edges.map(edge => {
|
||||
const edges = state.edges.map((edge) => {
|
||||
if (edge.has('ppoints')) {
|
||||
return edge.set('points', edge.get('ppoints'));
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ const IGNORED_COLUMNS = ['docker_container_ports', 'docker_container_id', 'docke
|
||||
function getColumns(nodes) {
|
||||
const metricColumns = nodes
|
||||
.toList()
|
||||
.flatMap(n => {
|
||||
.flatMap((n) => {
|
||||
const metrics = (n.get('metrics') || makeList())
|
||||
.map(m => makeMap({ id: m.get('id'), label: m.get('label'), dataType: 'number' }));
|
||||
return metrics;
|
||||
@@ -28,7 +28,7 @@ function getColumns(nodes) {
|
||||
|
||||
const metadataColumns = nodes
|
||||
.toList()
|
||||
.flatMap(n => {
|
||||
.flatMap((n) => {
|
||||
const metadata = (n.get('metadata') || makeList())
|
||||
.map(m => makeMap({ id: m.get('id'), label: m.get('label'), dataType: m.get('dataType') }));
|
||||
return metadata;
|
||||
@@ -40,7 +40,7 @@ function getColumns(nodes) {
|
||||
|
||||
const relativesColumns = nodes
|
||||
.toList()
|
||||
.flatMap(n => {
|
||||
.flatMap((n) => {
|
||||
const metadata = (n.get('parents') || makeList())
|
||||
.map(m => makeMap({ id: m.get('topologyId'), label: m.get('topologyId') }));
|
||||
return metadata;
|
||||
|
||||
@@ -55,7 +55,7 @@ function runLayoutEngine(graph, imNodes, imEdges, opts) {
|
||||
});
|
||||
|
||||
// add nodes to the graph if not already there
|
||||
nodes.forEach(node => {
|
||||
nodes.forEach((node) => {
|
||||
const gNodeId = graphNodeId(node.get('id'));
|
||||
if (!graph.hasNode(gNodeId)) {
|
||||
graph.setNode(gNodeId, {
|
||||
@@ -66,7 +66,7 @@ function runLayoutEngine(graph, imNodes, imEdges, opts) {
|
||||
});
|
||||
|
||||
// remove nodes that are no longer there or are 0-degree nodes
|
||||
graph.nodes().forEach(gNodeId => {
|
||||
graph.nodes().forEach((gNodeId) => {
|
||||
const nodeId = fromGraphNodeId(gNodeId);
|
||||
if (!nodes.has(nodeId) || nodes.get(nodeId).get('degree') === 0) {
|
||||
graph.removeNode(gNodeId);
|
||||
@@ -74,7 +74,7 @@ function runLayoutEngine(graph, imNodes, imEdges, opts) {
|
||||
});
|
||||
|
||||
// add edges to the graph if not already there
|
||||
edges.forEach(edge => {
|
||||
edges.forEach((edge) => {
|
||||
const s = graphNodeId(edge.get('source'));
|
||||
const t = graphNodeId(edge.get('target'));
|
||||
if (!graph.hasEdge(s, t)) {
|
||||
@@ -84,7 +84,7 @@ function runLayoutEngine(graph, imNodes, imEdges, opts) {
|
||||
});
|
||||
|
||||
// remove edges that are no longer there
|
||||
graph.edges().forEach(edgeObj => {
|
||||
graph.edges().forEach((edgeObj) => {
|
||||
const edge = [fromGraphNodeId(edgeObj.v), fromGraphNodeId(edgeObj.w)];
|
||||
const edgeId = edge.join(EDGE_ID_SEPARATOR);
|
||||
if (!edges.has(edgeId)) {
|
||||
@@ -97,14 +97,14 @@ function runLayoutEngine(graph, imNodes, imEdges, opts) {
|
||||
|
||||
// apply coordinates to nodes and edges
|
||||
|
||||
graph.nodes().forEach(gNodeId => {
|
||||
graph.nodes().forEach((gNodeId) => {
|
||||
const graphNode = graph.node(gNodeId);
|
||||
const nodeId = fromGraphNodeId(gNodeId);
|
||||
nodes = nodes.setIn([nodeId, 'x'], graphNode.x);
|
||||
nodes = nodes.setIn([nodeId, 'y'], graphNode.y);
|
||||
});
|
||||
|
||||
graph.edges().forEach(graphEdge => {
|
||||
graph.edges().forEach((graphEdge) => {
|
||||
const graphEdgeMeta = graph.edge(graphEdge);
|
||||
const edge = edges.get(graphEdgeMeta.id);
|
||||
let points = fromJS(graphEdgeMeta.points);
|
||||
@@ -165,7 +165,7 @@ export function doLayoutNewNodesOfExistingRank(layout, nodeCache, opts) {
|
||||
const oldNodes = ImmSet.fromKeys(nodeCache);
|
||||
const newNodes = ImmSet.fromKeys(layout.nodes.filter(n => n.get('degree') > 0))
|
||||
.subtract(oldNodes);
|
||||
result.nodes = layout.nodes.map(n => {
|
||||
result.nodes = layout.nodes.map((n) => {
|
||||
if (newNodes.contains(n.get('id'))) {
|
||||
const nodesSameRank = nodeCache.filter(nn => nn.get('rank') === n.get('rank'));
|
||||
if (nodesSameRank.size > 0) {
|
||||
@@ -178,7 +178,7 @@ export function doLayoutNewNodesOfExistingRank(layout, nodeCache, opts) {
|
||||
return n;
|
||||
});
|
||||
|
||||
result.edges = layout.edges.map(edge => {
|
||||
result.edges = layout.edges.map((edge) => {
|
||||
if (!edge.has('points')) {
|
||||
return setSimpleEdgePoints(edge, layout.nodes);
|
||||
}
|
||||
@@ -245,7 +245,7 @@ function layoutSingleNodes(layout, opts) {
|
||||
let col = 0;
|
||||
let singleX;
|
||||
let singleY;
|
||||
nodes = nodes.sortBy(node => node.get('rank')).map(node => {
|
||||
nodes = nodes.sortBy(node => node.get('rank')).map((node) => {
|
||||
if (singleNodes.has(node.get('id'))) {
|
||||
if (col === columns) {
|
||||
col = 0;
|
||||
@@ -412,7 +412,7 @@ function copyLayoutProperties(layout, nodeCache, edgeCache) {
|
||||
const result = Object.assign({}, layout);
|
||||
result.nodes = layout.nodes.map(node => (nodeCache.has(node.get('id'))
|
||||
? node.merge(nodeCache.get(node.get('id'))) : node));
|
||||
result.edges = layout.edges.map(edge => {
|
||||
result.edges = layout.edges.map((edge) => {
|
||||
if (edgeCache.has(edge.get('id'))
|
||||
&& hasSameEndpoints(edgeCache.get(edge.get('id')), result.nodes)) {
|
||||
return edge.merge(edgeCache.get(edge.get('id')));
|
||||
|
||||
@@ -78,7 +78,7 @@ function label(shape, stacked) {
|
||||
|
||||
|
||||
function addAllVariants(dispatch) {
|
||||
const newNodes = flattenDeep(STACK_VARIANTS.map(stack => (SHAPES.map(s => {
|
||||
const newNodes = flattenDeep(STACK_VARIANTS.map(stack => (SHAPES.map((s) => {
|
||||
if (!stack) return [deltaAdd(label(s, stack), [], s, stack, 1)];
|
||||
return NODE_COUNTS.map(n => deltaAdd(label(s, stack), [], s, stack, n));
|
||||
}))));
|
||||
@@ -253,8 +253,13 @@ class DebugToolbar extends React.Component {
|
||||
// `${randomLetter()}${randomLetter()}-zing`
|
||||
`${prefix}${i}`
|
||||
));
|
||||
<<<<<<< f5ae864fa293b70db13c64d519ec9f261bad4ddd
|
||||
const allNodes = nodeNames.concat(newNodeNames);
|
||||
return newNodeNames.map((name) => deltaAdd(
|
||||
=======
|
||||
const allNodes = _(nodeNames).concat(newNodeNames).value();
|
||||
return newNodeNames.map(name => deltaAdd(
|
||||
>>>>>>> Applied arrow-parens linting rule
|
||||
name,
|
||||
sampleArray(allNodes),
|
||||
sample(SHAPES),
|
||||
|
||||
@@ -203,7 +203,7 @@ class NodeDetails extends React.Component {
|
||||
</div>
|
||||
))}
|
||||
|
||||
{details.tables && details.tables.length > 0 && details.tables.map(table => {
|
||||
{details.tables && details.tables.length > 0 && details.tables.map((table) => {
|
||||
if (table.rows.length > 0) {
|
||||
return (
|
||||
<div className="node-details-content-section" key={table.id}>
|
||||
|
||||
@@ -38,7 +38,7 @@ export default class NodeDetailsInfo extends React.Component {
|
||||
|
||||
return (
|
||||
<div className="node-details-info">
|
||||
{rows.map(field => {
|
||||
{rows.map((field) => {
|
||||
const { value, title } = formatDataType(field);
|
||||
return (
|
||||
<div className="node-details-info-field" key={field.id}>
|
||||
|
||||
@@ -8,9 +8,9 @@ import { formatDataType } from '../../utils/string-utils';
|
||||
|
||||
function getValuesForNode(node) {
|
||||
const values = {};
|
||||
['metrics', 'metadata'].forEach(collection => {
|
||||
['metrics', 'metadata'].forEach((collection) => {
|
||||
if (node[collection]) {
|
||||
node[collection].forEach(field => {
|
||||
node[collection].forEach((field) => {
|
||||
const result = Object.assign({}, field);
|
||||
result.valueType = collection;
|
||||
values[field.id] = result;
|
||||
@@ -18,7 +18,7 @@ function getValuesForNode(node) {
|
||||
}
|
||||
});
|
||||
|
||||
(node.parents || []).forEach(p => {
|
||||
(node.parents || []).forEach((p) => {
|
||||
values[p.topologyId] = {
|
||||
id: p.topologyId,
|
||||
label: p.topologyId,
|
||||
@@ -149,5 +149,5 @@ export default class NodeDetailsTableRow extends React.Component {
|
||||
|
||||
|
||||
NodeDetailsTableRow.defaultProps = {
|
||||
renderIdCell: (props) => <NodeDetailsTableNodeLink {...props} />
|
||||
renderIdCell: props => <NodeDetailsTableNodeLink {...props} />
|
||||
};
|
||||
|
||||
@@ -113,13 +113,13 @@ function getNodeValue(node, header) {
|
||||
|
||||
|
||||
function getValueForSortedBy(sortedByHeader) {
|
||||
return (node) => maybeToLower(getNodeValue(node, sortedByHeader));
|
||||
return node => maybeToLower(getNodeValue(node, sortedByHeader));
|
||||
}
|
||||
|
||||
|
||||
function getMetaDataSorters(nodes) {
|
||||
// returns an array of sorters that will take a node
|
||||
return get(nodes, [0, 'metadata'], []).map((field, index) => node => {
|
||||
return get(nodes, [0, 'metadata'], []).map((field, index) => (node) => {
|
||||
const nodeMetadataField = node.metadata && node.metadata[index];
|
||||
if (nodeMetadataField) {
|
||||
if (isNumber(nodeMetadataField)) {
|
||||
@@ -225,7 +225,7 @@ export default class NodeDetailsTable extends React.Component {
|
||||
<tr>
|
||||
{headers.map((header, i) => {
|
||||
const headerClasses = ['node-details-table-header', 'truncate'];
|
||||
const onHeaderClick = ev => {
|
||||
const onHeaderClick = (ev) => {
|
||||
this.handleHeaderClick(ev, header.id, sortedBy, sortedDesc);
|
||||
};
|
||||
// sort by first metric by default
|
||||
|
||||
@@ -73,7 +73,7 @@ function openNewWindow(url, bcr, minWidth = 200) {
|
||||
};
|
||||
|
||||
const windowOptionsString = Object.keys(windowOptions)
|
||||
.map((k) => `${k}=${windowOptions[k]}`)
|
||||
.map(k => `${k}=${windowOptions[k]}`)
|
||||
.join(',');
|
||||
|
||||
window.open(url, '', windowOptionsString);
|
||||
@@ -374,10 +374,10 @@ class Terminal extends React.Component {
|
||||
<div className="terminal-wrapper">
|
||||
{this.isEmbedded() && this.getTerminalHeader()}
|
||||
<div
|
||||
ref={(ref) => this.innerFlex = ref}
|
||||
ref={ref => this.innerFlex = ref}
|
||||
className={innerClassName}
|
||||
style={innerFlexStyle} >
|
||||
<div style={innerStyle} ref={(ref) => this.inner = ref} />
|
||||
<div style={innerStyle} ref={ref => this.inner = ref} />
|
||||
</div>
|
||||
{this.getTerminalStatusBar()}
|
||||
</div>
|
||||
|
||||
@@ -95,7 +95,7 @@ function setTopology(state, topologyId) {
|
||||
}
|
||||
|
||||
function setDefaultTopologyOptions(state, topologyList) {
|
||||
topologyList.forEach(topology => {
|
||||
topologyList.forEach((topology) => {
|
||||
let defaultOptions = makeOrderedMap();
|
||||
if (topology.has('options') && topology.get('options')) {
|
||||
topology.get('options').forEach((option) => {
|
||||
@@ -371,13 +371,13 @@ export function rootReducer(state = initialState, action) {
|
||||
|
||||
case ActionTypes.ENTER_EDGE: {
|
||||
// highlight adjacent nodes
|
||||
state = state.update('highlightedNodeIds', highlightedNodeIds => {
|
||||
state = state.update('highlightedNodeIds', (highlightedNodeIds) => {
|
||||
highlightedNodeIds = highlightedNodeIds.clear();
|
||||
return highlightedNodeIds.union(action.edgeId.split(EDGE_ID_SEPARATOR));
|
||||
});
|
||||
|
||||
// highlight edge
|
||||
state = state.update('highlightedEdgeIds', highlightedEdgeIds => {
|
||||
state = state.update('highlightedEdgeIds', (highlightedEdgeIds) => {
|
||||
highlightedEdgeIds = highlightedEdgeIds.clear();
|
||||
return highlightedEdgeIds.add(action.edgeId);
|
||||
});
|
||||
@@ -392,18 +392,18 @@ export function rootReducer(state = initialState, action) {
|
||||
state = state.set('mouseOverNodeId', nodeId);
|
||||
|
||||
// highlight adjacent nodes
|
||||
state = state.update('highlightedNodeIds', highlightedNodeIds => {
|
||||
state = state.update('highlightedNodeIds', (highlightedNodeIds) => {
|
||||
highlightedNodeIds = highlightedNodeIds.clear();
|
||||
highlightedNodeIds = highlightedNodeIds.add(nodeId);
|
||||
return highlightedNodeIds.union(adjacentNodes);
|
||||
});
|
||||
|
||||
// highlight edge
|
||||
state = state.update('highlightedEdgeIds', highlightedEdgeIds => {
|
||||
state = state.update('highlightedEdgeIds', (highlightedEdgeIds) => {
|
||||
highlightedEdgeIds = highlightedEdgeIds.clear();
|
||||
if (adjacentNodes.size > 0) {
|
||||
// all neighbour combinations because we dont know which direction exists
|
||||
highlightedEdgeIds = highlightedEdgeIds.union(adjacentNodes.flatMap((adjacentId) => [
|
||||
highlightedEdgeIds = highlightedEdgeIds.union(adjacentNodes.flatMap(adjacentId => [
|
||||
[adjacentId, nodeId].join(EDGE_ID_SEPARATOR),
|
||||
[nodeId, adjacentId].join(EDGE_ID_SEPARATOR)
|
||||
]));
|
||||
@@ -491,7 +491,7 @@ export function rootReducer(state = initialState, action) {
|
||||
|
||||
// disregard if node is not selected anymore
|
||||
if (state.hasIn(['nodeDetails', action.details.id])) {
|
||||
state = state.updateIn(['nodeDetails', action.details.id], obj => {
|
||||
state = state.updateIn(['nodeDetails', action.details.id], (obj) => {
|
||||
const result = Object.assign({}, obj);
|
||||
result.notFound = false;
|
||||
result.details = action.details;
|
||||
@@ -554,7 +554,7 @@ export function rootReducer(state = initialState, action) {
|
||||
|
||||
// TODO move this setting of networks as toplevel node field to backend,
|
||||
// to not rely on field IDs here. should be determined by topology implementer
|
||||
state = state.update('nodes', nodes => nodes.map(node => {
|
||||
state = state.update('nodes', nodes => nodes.map((node) => {
|
||||
if (node.has('metadata')) {
|
||||
const networks = node.get('metadata')
|
||||
.find(field => field.get('id') === 'docker_container_networks');
|
||||
@@ -605,7 +605,7 @@ export function rootReducer(state = initialState, action) {
|
||||
|
||||
case ActionTypes.RECEIVE_NOT_FOUND: {
|
||||
if (state.hasIn(['nodeDetails', action.nodeId])) {
|
||||
state = state.updateIn(['nodeDetails', action.nodeId], obj => {
|
||||
state = state.updateIn(['nodeDetails', action.nodeId], (obj) => {
|
||||
const result = Object.assign({}, obj);
|
||||
result.notFound = true;
|
||||
return result;
|
||||
|
||||
@@ -46,7 +46,7 @@ function mergeDeepKeyIntersection(mapA, mapB) {
|
||||
//
|
||||
const _createDeepEqualSelector = createSelectorCreator(defaultMemoize, is);
|
||||
const _identity = v => v;
|
||||
const returnPreviousRefIfEqual = (selector) => _createDeepEqualSelector(selector, _identity);
|
||||
const returnPreviousRefIfEqual = selector => _createDeepEqualSelector(selector, _identity);
|
||||
|
||||
|
||||
//
|
||||
@@ -60,7 +60,7 @@ const allNodesSelector = state => state.get('nodes');
|
||||
export const nodesSelector = returnPreviousRefIfEqual(
|
||||
createSelector(
|
||||
allNodesSelector,
|
||||
(allNodes) => allNodes.filter(node => !node.get('filtered'))
|
||||
allNodes => allNodes.filter(node => !node.get('filtered'))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -71,7 +71,7 @@ export const adjacentNodesSelector = returnPreviousRefIfEqual(getAdjacentNodes);
|
||||
export const nodeAdjacenciesSelector = returnPreviousRefIfEqual(
|
||||
createSelector(
|
||||
nodesSelector,
|
||||
(nodes) => nodes.map(n => makeMap({
|
||||
nodes => nodes.map(n => makeMap({
|
||||
id: n.get('id'),
|
||||
adjacency: n.get('adjacency'),
|
||||
}))
|
||||
@@ -81,7 +81,7 @@ export const nodeAdjacenciesSelector = returnPreviousRefIfEqual(
|
||||
|
||||
export const dataNodesSelector = createSelector(
|
||||
nodesSelector,
|
||||
(nodes) => nodes.map((node, id) => makeMap({
|
||||
nodes => nodes.map((node, id) => makeMap({
|
||||
id,
|
||||
label: node.get('label'),
|
||||
pseudo: node.get('pseudo'),
|
||||
|
||||
@@ -18,7 +18,11 @@ function setInlineStyles(svg, target, emptySvgDeclarationComputed) {
|
||||
function explicitlySetStyle(element, targetEl) {
|
||||
const cSSStyleDeclarationComputed = getComputedStyle(element);
|
||||
let computedStyleStr = '';
|
||||
<<<<<<< f5ae864fa293b70db13c64d519ec9f261bad4ddd
|
||||
each(cSSStyleDeclarationComputed, key => {
|
||||
=======
|
||||
_.each(cSSStyleDeclarationComputed, (key) => {
|
||||
>>>>>>> Applied arrow-parens linting rule
|
||||
const value = cSSStyleDeclarationComputed.getPropertyValue(key);
|
||||
if (value !== emptySvgDeclarationComputed.getPropertyValue(key) && !cssSkipValues[value]) {
|
||||
computedStyleStr += `${key}:${value};`;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { fromJS, List as makeList } from 'immutable';
|
||||
|
||||
export function getNetworkNodes(nodes) {
|
||||
const networks = {};
|
||||
nodes.forEach(node => (node.get('networks') || makeList()).forEach(n => {
|
||||
nodes.forEach(node => (node.get('networks') || makeList()).forEach((n) => {
|
||||
const networkId = n.get('id');
|
||||
networks[networkId] = (networks[networkId] || []).concat([node.get('id')]);
|
||||
}));
|
||||
|
||||
@@ -132,7 +132,7 @@ export function searchTopology(nodes, { prefix, query, metric, comp, value }) {
|
||||
|
||||
// metadata
|
||||
if (node.get('metadata')) {
|
||||
node.get('metadata').forEach(field => {
|
||||
node.get('metadata').forEach((field) => {
|
||||
const keyPath = [nodeId, 'metadata', field.get('id')];
|
||||
nodeMatches = findNodeMatch(nodeMatches, keyPath, field.get('value'),
|
||||
query, prefix, field.get('label'), field.get('truncate'));
|
||||
@@ -141,7 +141,7 @@ export function searchTopology(nodes, { prefix, query, metric, comp, value }) {
|
||||
|
||||
// parents and relatives
|
||||
if (node.get('parents')) {
|
||||
node.get('parents').forEach(parent => {
|
||||
node.get('parents').forEach((parent) => {
|
||||
const keyPath = [nodeId, 'parents', parent.get('id')];
|
||||
nodeMatches = findNodeMatch(nodeMatches, keyPath, parent.get('label'),
|
||||
query, prefix, parent.get('topologyId'));
|
||||
@@ -153,7 +153,7 @@ export function searchTopology(nodes, { prefix, query, metric, comp, value }) {
|
||||
if (tables) {
|
||||
tables.forEach((table) => {
|
||||
if (table.get('rows')) {
|
||||
table.get('rows').forEach(field => {
|
||||
table.get('rows').forEach((field) => {
|
||||
const keyPath = [nodeId, 'tables', field.get('id')];
|
||||
nodeMatches = findNodeMatch(nodeMatches, keyPath, field.get('value'),
|
||||
query, prefix, field.get('label'));
|
||||
@@ -164,7 +164,7 @@ export function searchTopology(nodes, { prefix, query, metric, comp, value }) {
|
||||
} else if (metric) {
|
||||
const metrics = node.get('metrics');
|
||||
if (metrics) {
|
||||
metrics.forEach(field => {
|
||||
metrics.forEach((field) => {
|
||||
const keyPath = [nodeId, 'metrics', field.get('id')];
|
||||
nodeMatches = findNodeMatchMetric(nodeMatches, keyPath, field.get('value'),
|
||||
field.get('label'), metric, comp, value);
|
||||
@@ -291,7 +291,7 @@ export function applyPinnedSearches(state) {
|
||||
|
||||
const pinnedSearches = state.get('pinnedSearches');
|
||||
if (pinnedSearches.size > 0) {
|
||||
state.get('pinnedSearches').forEach(query => {
|
||||
state.get('pinnedSearches').forEach((query) => {
|
||||
const parsed = parseQuery(query);
|
||||
if (parsed) {
|
||||
const nodeMatches = searchTopology(state.get('nodes'), parsed);
|
||||
|
||||
@@ -19,7 +19,7 @@ export function getDefaultTopology(topologies) {
|
||||
.flatMap(t => makeList([t]).concat(t.get('sub_topologies', makeList())));
|
||||
|
||||
return flatTopologies
|
||||
.sortBy(t => {
|
||||
.sortBy((t) => {
|
||||
const index = TOPOLOGY_DISPLAY_PRIORITY.indexOf(t.get('id'));
|
||||
return index === -1 ? Infinity : index;
|
||||
})
|
||||
@@ -53,7 +53,7 @@ export function buildTopologyCacheId(topologyId, topologyOptions) {
|
||||
export function findTopologyById(subTree, topologyId) {
|
||||
let foundTopology;
|
||||
|
||||
subTree.forEach(topology => {
|
||||
subTree.forEach((topology) => {
|
||||
if (endsWith(topology.get('url'), topologyId)) {
|
||||
foundTopology = topology;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ export function findTopologyById(subTree, topologyId) {
|
||||
}
|
||||
|
||||
export function updateNodeDegrees(nodes, edges) {
|
||||
return nodes.map(node => {
|
||||
return nodes.map((node) => {
|
||||
const nodeId = node.get('id');
|
||||
const degree = edges.count(edge => edge.get('source') === nodeId
|
||||
|| edge.get('target') === nodeId);
|
||||
@@ -76,7 +76,7 @@ export function updateNodeDegrees(nodes, edges) {
|
||||
|
||||
/* set topology.id and parentId for sub-topologies in place */
|
||||
export function updateTopologyIds(topologies, parentId) {
|
||||
return topologies.map(topology => {
|
||||
return topologies.map((topology) => {
|
||||
const result = Object.assign({}, topology);
|
||||
result.id = topology.url.split('/').pop();
|
||||
if (parentId) {
|
||||
@@ -90,7 +90,7 @@ export function updateTopologyIds(topologies, parentId) {
|
||||
}
|
||||
|
||||
export function addTopologyFullname(topologies) {
|
||||
return topologies.map(t => {
|
||||
return topologies.map((t) => {
|
||||
if (!t.sub_topologies) {
|
||||
return Object.assign({}, t, {fullName: t.name});
|
||||
}
|
||||
@@ -108,10 +108,10 @@ export function addTopologyFullname(topologies) {
|
||||
export function setTopologyUrlsById(topologyUrlsById, topologies) {
|
||||
let urlMap = topologyUrlsById;
|
||||
if (topologies) {
|
||||
topologies.forEach(topology => {
|
||||
topologies.forEach((topology) => {
|
||||
urlMap = urlMap.set(topology.id, topology.url);
|
||||
if (topology.sub_topologies) {
|
||||
topology.sub_topologies.forEach(subTopology => {
|
||||
topology.sub_topologies.forEach((subTopology) => {
|
||||
urlMap = urlMap.set(subTopology.id, subTopology.url);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user