mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 10:11:03 +00:00
Fixes tests + missing files oops (network view stuff)
This commit is contained in:
@@ -2,6 +2,7 @@ jest.dontMock('../../utils/router-utils');
|
||||
jest.dontMock('../../utils/search-utils');
|
||||
jest.dontMock('../../utils/string-utils');
|
||||
jest.dontMock('../../utils/topology-utils');
|
||||
jest.dontMock('../../utils/network-view-utils');
|
||||
jest.dontMock('../../constants/action-types');
|
||||
jest.dontMock('../root');
|
||||
|
||||
|
||||
20
client/app/scripts/utils/network-view-utils.js
Normal file
20
client/app/scripts/utils/network-view-utils.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { fromJS, List as makeList } from 'immutable';
|
||||
|
||||
export function getNetworkNodes(nodes) {
|
||||
const networks = {};
|
||||
nodes.forEach(node => (node.get('networks') || makeList()).forEach(n => {
|
||||
const networkId = n.get('id');
|
||||
networks[networkId] = (networks[networkId] || []).concat([node.get('id')]);
|
||||
}));
|
||||
return fromJS(networks);
|
||||
}
|
||||
|
||||
|
||||
export function getAvailableNetworks(nodes) {
|
||||
return nodes
|
||||
.valueSeq()
|
||||
.flatMap(node => node.get('networks') || makeList())
|
||||
.toSet()
|
||||
.toList()
|
||||
.sortBy(m => m.get('label'));
|
||||
}
|
||||
Reference in New Issue
Block a user