Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
davkal committed Nov 24, 2016
1 parent 79a9598 commit 02771a3
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions client/app/scripts/components/debug-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ class DebugToolbar extends React.Component {
this.onChange = this.onChange.bind(this);
this.toggleColors = this.toggleColors.bind(this);
this.addNodes = this.addNodes.bind(this);
this.intermittendTimer = null;
this.intermittendNodes = makeSet();
this.intermittentTimer = null;
this.intermittentNodes = makeSet();
this.shortLivedTimer = null;
this.shortLivedNodes = makeSet();
this.state = {
Expand All @@ -188,26 +188,13 @@ class DebugToolbar extends React.Component {
this.asyncDispatch(setAppState(state => state.set('topologiesLoaded', !loading)));
}

updateAdjacencies() {
const ns = this.props.nodes;
const nodeNames = ns.keySeq().toJS();
this.asyncDispatch(receiveNodesDelta({
add: this._addNodes(7),
update: sample(nodeNames).map(n => ({
id: n,
adjacency: sample(nodeNames),
}), nodeNames.length),
remove: this._removeNode(),
}));
}

setIntermittend() {
setIntermittent() {
// simulate epheremal nodes
if (this.intermittendTimer) {
clearInterval(this.intermittendTimer);
this.intermittendTimer = null;
if (this.intermittentTimer) {
clearInterval(this.intermittentTimer);
this.intermittentTimer = null;
} else {
this.intermittendTimer = setInterval(() => {
this.intermittentTimer = setInterval(() => {
// add new node
this.addNodes(1);

Expand Down Expand Up @@ -370,7 +357,7 @@ class DebugToolbar extends React.Component {
<div>
<label>Short-lived nodes</label>
<button onClick={() => this.setShortLived()}>Toggle short-lived nodes</button>
<button onClick={() => this.setIntermittend()}>Toggle intermittend nodes</button>
<button onClick={() => this.setIntermittent()}>Toggle intermittent nodes</button>
</div>

<div>
Expand Down

0 comments on commit 02771a3

Please sign in to comment.