Skip to content

Commit

Permalink
Use feature flags in nodes-layout
Browse files Browse the repository at this point in the history
  • Loading branch information
davkal committed Nov 15, 2016
1 parent d22a685 commit bfcadf1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/app/scripts/charts/nodes-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import debug from 'debug';
import { fromJS, Map as makeMap, Set as ImmSet } from 'immutable';

import { EDGE_ID_SEPARATOR } from '../constants/naming';
import { featureIsEnabledAny } from '../utils/feature-utils';
import { buildTopologyCacheId, updateNodeDegrees } from '../utils/topology-utils';

const log = debug('scope:nodes-layout');
Expand Down Expand Up @@ -460,13 +461,17 @@ export function doLayout(immNodes, immEdges, opts) {
layout = copyLayoutProperties(layout, nodeCache, edgeCache);
} else {
const nodesWithDegrees = updateNodeDegrees(immNodes, immEdges);
if (useCache && hasNewSingleNode(nodesWithDegrees, nodeCache)) {
if (useCache
&& featureIsEnabledAny('layout-dance', 'layout-dance-single')
&& hasNewSingleNode(nodesWithDegrees, nodeCache)) {
// special case: new nodes are 0-degree nodes, no need for layout run,
// they will be layed out further below
log('skip layout, only 0-degree node(s) added');
layout = cloneLayout(cachedLayout, nodesWithDegrees, immEdges);
layout = copyLayoutProperties(layout, nodeCache, edgeCache);
} else if (useCache && hasNewNodesOfExistingRank(nodesWithDegrees, immEdges, nodeCache)) {
} else if (useCache
&& featureIsEnabledAny('layout-dance', 'layout-dance-rank')
&& hasNewNodesOfExistingRank(nodesWithDegrees, immEdges, nodeCache)) {
// special case: few new nodes were added, no need for layout run,
// they will inserted according to ranks
log('skip layout, used rank-based insertion');
Expand Down

0 comments on commit bfcadf1

Please sign in to comment.