Keep topo nav visible if subnav selected

Follow-up to 21a0093c but also displays parent topology if
an empty sub_topology is selected.
This commit is contained in:
Roland Schilter
2017-07-12 18:53:33 +02:00
parent 21a0093c08
commit e9945e78cb
3 changed files with 29 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
import { endsWith } from 'lodash';
import { Set as makeSet, List as makeList } from 'immutable';
import { Set as makeSet, List as makeList, Map as makeMap } from 'immutable';
import { isPausedSelector } from '../selectors/time-travel';
import { isResourceViewModeSelector } from '../selectors/topology';
@@ -126,9 +126,11 @@ export function setTopologyUrlsById(topologyUrlsById, topologies) {
return urlMap;
}
export function filterHiddenTopologies(topologies, currentTopologyId) {
export function filterHiddenTopologies(topologies, currentTopology) {
currentTopology = currentTopology || makeMap();
return topologies.filter(t => (!t.hide_if_empty || t.stats.node_count > 0 ||
t.stats.filtered_nodes > 0 || t.id === currentTopologyId));
t.stats.filtered_nodes > 0 || t.id === currentTopology.get('id') ||
t.id === currentTopology.get('parentId')));
}
export function getCurrentTopologyOptions(state) {