mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 03:46:45 +00:00
Revert "Upgraded eslint & eslint-config-airbnb"
This commit is contained in:
@@ -5,7 +5,9 @@ import { connect } from 'react-redux';
|
||||
import { sampleSize, sample, random, range, flattenDeep } from 'lodash';
|
||||
import { fromJS, Set as makeSet } from 'immutable';
|
||||
import { hsl } from 'd3-color';
|
||||
|
||||
import debug from 'debug';
|
||||
const log = debug('scope:debug-panel');
|
||||
|
||||
import ActionTypes from '../constants/action-types';
|
||||
import { receiveNodesDelta } from '../actions/app-actions';
|
||||
@@ -27,7 +29,7 @@ voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occa
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`;
|
||||
|
||||
const sampleArray = (collection, n = 4) => sampleSize(collection, random(n));
|
||||
const log = debug('scope:debug-panel');
|
||||
|
||||
|
||||
const shapeTypes = {
|
||||
square: ['Process', 'Processes'],
|
||||
@@ -78,7 +80,7 @@ function label(shape, stacked) {
|
||||
|
||||
|
||||
function addAllVariants(dispatch) {
|
||||
const newNodes = flattenDeep(STACK_VARIANTS.map(stack => (SHAPES.map((s) => {
|
||||
const newNodes = flattenDeep(STACK_VARIANTS.map(stack => (SHAPES.map(s => {
|
||||
if (!stack) return [deltaAdd(label(s, stack), [], s, stack, 1)];
|
||||
return NODE_COUNTS.map(n => deltaAdd(label(s, stack), [], s, stack, n));
|
||||
}))));
|
||||
@@ -237,16 +239,16 @@ class DebugToolbar extends React.Component {
|
||||
const ns = this.props.nodes;
|
||||
const nodeNames = ns.keySeq().toJS();
|
||||
this.asyncDispatch(receiveNodesDelta({
|
||||
add: this.createRandomNodes(7),
|
||||
add: this._addNodes(7),
|
||||
update: sampleArray(nodeNames).map(n => ({
|
||||
id: n,
|
||||
adjacency: sampleArray(nodeNames),
|
||||
}), nodeNames.length),
|
||||
remove: this.randomExistingNode(),
|
||||
remove: this._removeNode(),
|
||||
}));
|
||||
}
|
||||
|
||||
createRandomNodes(n, prefix = 'zing') {
|
||||
_addNodes(n, prefix = 'zing') {
|
||||
const ns = this.props.nodes;
|
||||
const nodeNames = ns.keySeq().toJS();
|
||||
const newNodeNames = range(ns.size, ns.size + n).map(i => (
|
||||
@@ -254,7 +256,7 @@ class DebugToolbar extends React.Component {
|
||||
`${prefix}${i}`
|
||||
));
|
||||
const allNodes = nodeNames.concat(newNodeNames);
|
||||
return newNodeNames.map(name => deltaAdd(
|
||||
return newNodeNames.map((name) => deltaAdd(
|
||||
name,
|
||||
sampleArray(allNodes),
|
||||
sample(SHAPES),
|
||||
@@ -267,13 +269,13 @@ class DebugToolbar extends React.Component {
|
||||
addNodes(n, prefix = 'zing') {
|
||||
setTimeout(() => {
|
||||
this.asyncDispatch(receiveNodesDelta({
|
||||
add: this.createRandomNodes(n, prefix)
|
||||
add: this._addNodes(n, prefix)
|
||||
}));
|
||||
log('added nodes', n);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
randomExistingNode() {
|
||||
_removeNode() {
|
||||
const ns = this.props.nodes;
|
||||
const nodeNames = ns.keySeq().toJS();
|
||||
return [nodeNames[random(nodeNames.length - 1)]];
|
||||
@@ -281,7 +283,7 @@ class DebugToolbar extends React.Component {
|
||||
|
||||
removeNode() {
|
||||
this.asyncDispatch(receiveNodesDelta({
|
||||
remove: this.randomExistingNode()
|
||||
remove: this._removeNode()
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -291,7 +293,7 @@ class DebugToolbar extends React.Component {
|
||||
return (
|
||||
<div className="debug-panel">
|
||||
<div>
|
||||
<strong>Add nodes </strong>
|
||||
<label>Add nodes </label>
|
||||
<button onClick={() => this.addNodes(1)}>+1</button>
|
||||
<button onClick={() => this.addNodes(10)}>+10</button>
|
||||
<input type="number" onChange={this.onChange} value={this.state.nodesToAdd} />
|
||||
@@ -306,7 +308,7 @@ class DebugToolbar extends React.Component {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<strong>Logging </strong>
|
||||
<label>Logging</label>
|
||||
<button onClick={() => enableLog('*')}>scope:*</button>
|
||||
<button onClick={() => enableLog('dispatcher')}>scope:dispatcher</button>
|
||||
<button onClick={() => enableLog('app-key-press')}>scope:app-key-press</button>
|
||||
@@ -315,7 +317,7 @@ class DebugToolbar extends React.Component {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<strong>Colors </strong>
|
||||
<label>Colors</label>
|
||||
<button onClick={this.toggleColors}>toggle</button>
|
||||
</div>
|
||||
|
||||
@@ -338,7 +340,7 @@ class DebugToolbar extends React.Component {
|
||||
{LABEL_PREFIXES.map(r => (
|
||||
<tr key={r}>
|
||||
{LABEL_PREFIXES.map(c => (
|
||||
<td key={c} title={`(${r}, ${c})`} style={{backgroundColor: fn(r, c)}} />
|
||||
<td key={c} title={`(${r}, ${c})`} style={{backgroundColor: fn(r, c)}}></td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
@@ -347,19 +349,19 @@ class DebugToolbar extends React.Component {
|
||||
))}
|
||||
|
||||
<div>
|
||||
<strong>State </strong>
|
||||
<label>state</label>
|
||||
<button onClick={() => this.setLoading(true)}>Set doing initial load</button>
|
||||
<button onClick={() => this.setLoading(false)}>Stop</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<strong>Short-lived nodes </strong>
|
||||
<label>Short-lived nodes</label>
|
||||
<button onClick={() => this.setShortLived()}>Toggle short-lived nodes</button>
|
||||
<button onClick={() => this.setIntermittent()}>Toggle intermittent nodes</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<strong>Measure React perf for </strong>
|
||||
<label>Measure React perf for </label>
|
||||
<button onClick={() => startPerf(2)}>2s</button>
|
||||
<button onClick={() => startPerf(5)}>5s</button>
|
||||
<button onClick={() => startPerf(10)}>10s</button>
|
||||
|
||||
Reference in New Issue
Block a user