Fixes tests + missing files oops (network view stuff)

This commit is contained in:
Simon Howe
2016-06-06 16:30:20 +02:00
parent 570124fbe0
commit 53768b52ec
2 changed files with 21 additions and 0 deletions

View File

@@ -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');

View 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'));
}