mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 03:46:45 +00:00
Fixed function-paren-newline.
This commit is contained in:
@@ -184,7 +184,8 @@ describe('NodesLayout', () => {
|
||||
it('lays out initial nodeset in a rectangle', () => {
|
||||
const result = NodesLayout.doLayout(
|
||||
nodeSets.initial4.nodes,
|
||||
nodeSets.initial4.edges);
|
||||
nodeSets.initial4.edges
|
||||
);
|
||||
// console.log('initial', result.get('nodes'));
|
||||
nodes = result.nodes.toJS();
|
||||
|
||||
@@ -199,7 +200,8 @@ describe('NodesLayout', () => {
|
||||
it('keeps nodes in rectangle after removing one edge', () => {
|
||||
let result = NodesLayout.doLayout(
|
||||
nodeSets.initial4.nodes,
|
||||
nodeSets.initial4.edges);
|
||||
nodeSets.initial4.edges
|
||||
);
|
||||
|
||||
options.cachedLayout = result;
|
||||
options.nodeCache = options.nodeCache.merge(result.nodes);
|
||||
@@ -221,7 +223,8 @@ describe('NodesLayout', () => {
|
||||
it('keeps nodes in rectangle after removed edge reappears', () => {
|
||||
let result = NodesLayout.doLayout(
|
||||
nodeSets.initial4.nodes,
|
||||
nodeSets.initial4.edges);
|
||||
nodeSets.initial4.edges
|
||||
);
|
||||
|
||||
coords = getNodeCoordinates(result.nodes);
|
||||
options.cachedLayout = result;
|
||||
@@ -252,7 +255,8 @@ describe('NodesLayout', () => {
|
||||
it('keeps nodes in rectangle after node disappears', () => {
|
||||
let result = NodesLayout.doLayout(
|
||||
nodeSets.initial4.nodes,
|
||||
nodeSets.initial4.edges);
|
||||
nodeSets.initial4.edges
|
||||
);
|
||||
|
||||
options.cachedLayout = result;
|
||||
options.nodeCache = options.nodeCache.merge(result.nodes);
|
||||
@@ -273,7 +277,8 @@ describe('NodesLayout', () => {
|
||||
it('keeps nodes in rectangle after removed node reappears', () => {
|
||||
let result = NodesLayout.doLayout(
|
||||
nodeSets.initial4.nodes,
|
||||
nodeSets.initial4.edges);
|
||||
nodeSets.initial4.edges
|
||||
);
|
||||
|
||||
nodes = result.nodes.toJS();
|
||||
|
||||
@@ -313,7 +318,8 @@ describe('NodesLayout', () => {
|
||||
it('renders single nodes in a square', () => {
|
||||
const result = NodesLayout.doLayout(
|
||||
nodeSets.single3.nodes,
|
||||
nodeSets.single3.edges);
|
||||
nodeSets.single3.edges
|
||||
);
|
||||
|
||||
nodes = result.nodes.toJS();
|
||||
|
||||
@@ -404,7 +410,8 @@ describe('NodesLayout', () => {
|
||||
expect(NodesLayout.hasNewNodesOfExistingRank(
|
||||
nodeSets.rank6.nodes,
|
||||
nodeSets.rank6.edges,
|
||||
result.nodes)).toBeTruthy();
|
||||
result.nodes
|
||||
)).toBeTruthy();
|
||||
|
||||
result = NodesLayout.doLayout(
|
||||
nodeSets.rank6.nodes,
|
||||
|
||||
@@ -81,9 +81,14 @@ export default class EdgeContainer extends React.PureComponent {
|
||||
// For the Motion interpolation to work, the waypoints need to be in a map format like
|
||||
// { x0: 11, y0: 22, x1: 33, y1: 44 } that we convert to the array format when rendering.
|
||||
<Motion style={{ interpolatedThickness: weakSpring(thickness), ...waypointsMap.toJS() }}>
|
||||
{({ interpolatedThickness, ...interpolatedWaypoints}) => transformedEdge(
|
||||
forwardedProps, waypointsMapToArray(fromJS(interpolatedWaypoints)), interpolatedThickness
|
||||
)}
|
||||
{
|
||||
({ interpolatedThickness, ...interpolatedWaypoints}) =>
|
||||
transformedEdge(
|
||||
forwardedProps,
|
||||
waypointsMapToArray(fromJS(interpolatedWaypoints)),
|
||||
interpolatedThickness
|
||||
)
|
||||
}
|
||||
</Motion>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -277,6 +277,4 @@ function mapStateToProps(state) {
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps
|
||||
)(NodesChartElements);
|
||||
export default connect(mapStateToProps)(NodesChartElements);
|
||||
|
||||
@@ -19,28 +19,26 @@ describe('NodeDetails', () => {
|
||||
});
|
||||
|
||||
it('shows n/a when node was not found', () => {
|
||||
const c = TestUtils.renderIntoDocument(
|
||||
<Provider store={configureStore()}>
|
||||
<NodeDetails notFound />
|
||||
</Provider>
|
||||
const c = TestUtils.renderIntoDocument(<Provider store={configureStore()}>
|
||||
<NodeDetails notFound />
|
||||
</Provider>);
|
||||
const notFound = TestUtils.findRenderedDOMComponentWithClass(
|
||||
c,
|
||||
'node-details-header-notavailable'
|
||||
);
|
||||
const notFound = TestUtils.findRenderedDOMComponentWithClass(c,
|
||||
'node-details-header-notavailable');
|
||||
expect(notFound).toBeDefined();
|
||||
});
|
||||
|
||||
it('show label of node with title', () => {
|
||||
nodes = nodes.set(nodeId, Immutable.fromJS({id: nodeId}));
|
||||
details = {label: 'Node 1'};
|
||||
const c = TestUtils.renderIntoDocument(
|
||||
<Provider store={configureStore()}>
|
||||
<NodeDetails
|
||||
nodes={nodes}
|
||||
topologyId="containers"
|
||||
nodeId={nodeId} details={details}
|
||||
const c = TestUtils.renderIntoDocument(<Provider store={configureStore()}>
|
||||
<NodeDetails
|
||||
nodes={nodes}
|
||||
topologyId="containers"
|
||||
nodeId={nodeId} details={details}
|
||||
/>
|
||||
</Provider>
|
||||
);
|
||||
</Provider>);
|
||||
|
||||
const title = TestUtils.findRenderedDOMComponentWithClass(c, 'node-details-header-label');
|
||||
expect(title.title).toBe('Node 1');
|
||||
|
||||
@@ -243,6 +243,4 @@ function mapStateToProps(state) {
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps
|
||||
)(App);
|
||||
export default connect(mapStateToProps)(App);
|
||||
|
||||
@@ -385,6 +385,4 @@ function mapStateToProps(state) {
|
||||
}
|
||||
|
||||
|
||||
export default connect(
|
||||
mapStateToProps
|
||||
)(DebugToolbar);
|
||||
export default connect(mapStateToProps)(DebugToolbar);
|
||||
|
||||
@@ -27,6 +27,4 @@ function mapStateToProps(state) {
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps
|
||||
)(Details);
|
||||
export default connect(mapStateToProps)(Details);
|
||||
|
||||
@@ -3,11 +3,9 @@ import { createDevTools } from 'redux-devtools';
|
||||
import LogMonitor from 'redux-devtools-log-monitor';
|
||||
import DockMonitor from 'redux-devtools-dock-monitor';
|
||||
|
||||
export default createDevTools(
|
||||
<DockMonitor
|
||||
defaultIsVisible={false}
|
||||
toggleVisibilityKey="ctrl-h"
|
||||
changePositionKey="ctrl-w">
|
||||
<LogMonitor />
|
||||
</DockMonitor>
|
||||
);
|
||||
export default createDevTools(<DockMonitor
|
||||
defaultIsVisible={false}
|
||||
toggleVisibilityKey="ctrl-h"
|
||||
changePositionKey="ctrl-w">
|
||||
<LogMonitor />
|
||||
</DockMonitor>);
|
||||
|
||||
@@ -70,6 +70,4 @@ function mapStateToProps(state) {
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps
|
||||
)(EmeddedTerminal);
|
||||
export default connect(mapStateToProps)(EmeddedTerminal);
|
||||
|
||||
@@ -58,8 +58,7 @@ describe('NodeDetailsTable', () => {
|
||||
// form columnIndex + n * columns.length, where n >= 0. Therefore we take only the values
|
||||
// at the index which divided by columns.length gives a reminder columnIndex.
|
||||
const filteredValues = values.filter((element, index) =>
|
||||
index % columns.length === columnIndex
|
||||
);
|
||||
index % columns.length === columnIndex);
|
||||
// Array comparison
|
||||
expect(filteredValues).toEqual(expectedValues);
|
||||
}
|
||||
@@ -72,16 +71,14 @@ describe('NodeDetailsTable', () => {
|
||||
|
||||
describe('kubernetes_ip', () => {
|
||||
it('sorts by column', () => {
|
||||
component = TestUtils.renderIntoDocument(
|
||||
<Provider store={configureStore()}>
|
||||
<NodeDetailsTable
|
||||
columns={columns}
|
||||
sortedBy="kubernetes_ip"
|
||||
nodeIdKey="id"
|
||||
nodes={nodes}
|
||||
component = TestUtils.renderIntoDocument(<Provider store={configureStore()}>
|
||||
<NodeDetailsTable
|
||||
columns={columns}
|
||||
sortedBy="kubernetes_ip"
|
||||
nodeIdKey="id"
|
||||
nodes={nodes}
|
||||
/>
|
||||
</Provider>
|
||||
);
|
||||
</Provider>);
|
||||
|
||||
matchColumnValues('kubernetes_ip', [
|
||||
'10.44.253.255',
|
||||
@@ -108,16 +105,14 @@ describe('NodeDetailsTable', () => {
|
||||
|
||||
describe('kubernetes_namespace', () => {
|
||||
it('sorts by column', () => {
|
||||
component = TestUtils.renderIntoDocument(
|
||||
<Provider store={configureStore()}>
|
||||
<NodeDetailsTable
|
||||
columns={columns}
|
||||
sortedBy="kubernetes_namespace"
|
||||
nodeIdKey="id"
|
||||
nodes={nodes}
|
||||
component = TestUtils.renderIntoDocument(<Provider store={configureStore()}>
|
||||
<NodeDetailsTable
|
||||
columns={columns}
|
||||
sortedBy="kubernetes_namespace"
|
||||
nodeIdKey="id"
|
||||
nodes={nodes}
|
||||
/>
|
||||
</Provider>
|
||||
);
|
||||
</Provider>);
|
||||
|
||||
matchColumnValues('kubernetes_namespace', ['00000', '1111', '12', '5']);
|
||||
clickColumn('Namespace');
|
||||
|
||||
@@ -63,8 +63,7 @@ export default class NodeDetailsGenericTable extends React.Component {
|
||||
// expanded if any of them match the search query; otherwise hide them.
|
||||
if (this.state.limit > 0 && rows.length > this.state.limit) {
|
||||
const hasHiddenMatch = rows.slice(this.state.limit).some(row =>
|
||||
columns.some(column => matches.has(genericTableEntryKey(row, column)))
|
||||
);
|
||||
columns.some(column => matches.has(genericTableEntryKey(row, column))));
|
||||
if (!hasHiddenMatch) {
|
||||
notShown = rows.length - NODE_DETAILS_DATA_ROWS_DEFAULT_LIMIT;
|
||||
rows = rows.slice(0, this.state.limit);
|
||||
|
||||
@@ -71,8 +71,7 @@ function renderValues(node, columns = [], columnStyles = [], timestamp = null, t
|
||||
linkable
|
||||
nodeId={relative.id}
|
||||
{...relative}
|
||||
/>
|
||||
), ' ')}
|
||||
/>), ' ')}
|
||||
</td>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,4 @@ function mapStateToProps(state, props) {
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps
|
||||
)(NodesResourcesLayer);
|
||||
export default connect(mapStateToProps)(NodesResourcesLayer);
|
||||
|
||||
@@ -92,6 +92,4 @@ function mapStateToProps(state) {
|
||||
}
|
||||
|
||||
|
||||
export default connect(
|
||||
mapStateToProps
|
||||
)(Nodes);
|
||||
export default connect(mapStateToProps)(Nodes);
|
||||
|
||||
@@ -44,6 +44,4 @@ function mapStateToProps(state) {
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps
|
||||
)(Plugins);
|
||||
export default connect(mapStateToProps)(Plugins);
|
||||
|
||||
@@ -54,6 +54,4 @@ function mapStateToProps(state) {
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps
|
||||
)(Status);
|
||||
export default connect(mapStateToProps)(Status);
|
||||
|
||||
@@ -13,8 +13,10 @@ class TerminalApp extends React.Component {
|
||||
|
||||
const paramString = window.location.hash.split('/').pop();
|
||||
const params = JSON.parse(decodeURIComponent(paramString));
|
||||
this.props.receiveControlPipeFromParams(params.pipe.id, params.pipe.raw,
|
||||
params.pipe.resizeTtyControl);
|
||||
this.props.receiveControlPipeFromParams(
|
||||
params.pipe.id, params.pipe.raw,
|
||||
params.pipe.resizeTtyControl
|
||||
);
|
||||
|
||||
this.state = {
|
||||
title: params.title,
|
||||
|
||||
@@ -132,7 +132,9 @@ class Terminal extends React.Component {
|
||||
this.createWebsocket(term);
|
||||
} else {
|
||||
this.reconnectTimeout = setTimeout(
|
||||
this.createWebsocket.bind(this, term), reconnectTimerInterval);
|
||||
this.createWebsocket.bind(this, term),
|
||||
reconnectTimerInterval
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -379,8 +381,7 @@ class Terminal extends React.Component {
|
||||
|
||||
function mapStateToProps(state, ownProps) {
|
||||
const controlStatus = state.get('controlPipes').find(pipe =>
|
||||
pipe.get('nodeId') === ownProps.pipe.get('nodeId')
|
||||
);
|
||||
pipe.get('nodeId') === ownProps.pipe.get('nodeId'));
|
||||
return { controlStatus };
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ function basicTopologyInfo(topology, searchMatchCount) {
|
||||
}
|
||||
|
||||
class Topologies extends React.Component {
|
||||
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
this.onTopologyClick = this.onTopologyClick.bind(this);
|
||||
@@ -88,9 +87,7 @@ class Topologies extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="topologies">
|
||||
{this.props.currentTopology && this.props.topologies.map(
|
||||
topology => this.renderTopology(topology)
|
||||
)}
|
||||
{this.props.currentTopology && this.props.topologies.map(t => this.renderTopology(t))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -129,8 +129,7 @@ class TopologyOptions extends React.Component {
|
||||
const { options } = this.props;
|
||||
return (
|
||||
<div className="topology-options">
|
||||
{options && options.toIndexedSeq().map(
|
||||
option => this.renderOption(option))}
|
||||
{options && options.toIndexedSeq().map(option => this.renderOption(option))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,10 @@ class ViewModeSelector extends React.Component {
|
||||
<div className="view-mode-selector-wrapper">
|
||||
{this.renderItem('fa fa-share-alt', 'Graph', GRAPH_VIEW_MODE, this.props.setGraphView)}
|
||||
{this.renderItem('fa fa-table', 'Table', TABLE_VIEW_MODE, this.props.setTableView)}
|
||||
{this.renderItem('fa fa-bar-chart', 'Resources', RESOURCE_VIEW_MODE,
|
||||
this.props.setResourceView, hasResourceView)}
|
||||
{this.renderItem(
|
||||
'fa fa-bar-chart', 'Resources', RESOURCE_VIEW_MODE,
|
||||
this.props.setResourceView, hasResourceView
|
||||
)}
|
||||
</div>
|
||||
<MetricSelector />
|
||||
</div>
|
||||
|
||||
@@ -15,12 +15,14 @@ const store = configureStore();
|
||||
|
||||
function renderApp() {
|
||||
const App = require('./components/app').default;
|
||||
ReactDOM.render((
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
<DevTools />
|
||||
</Provider>
|
||||
), document.getElementById('app'));
|
||||
ReactDOM.render(
|
||||
(
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
<DevTools />
|
||||
</Provider>
|
||||
), document.getElementById('app')
|
||||
);
|
||||
}
|
||||
|
||||
renderApp();
|
||||
|
||||
@@ -11,11 +11,13 @@ const store = configureStore();
|
||||
|
||||
function renderApp() {
|
||||
const App = require('./components/app').default;
|
||||
ReactDOM.render((
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
</Provider>
|
||||
), document.getElementById('app'));
|
||||
ReactDOM.render(
|
||||
(
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
</Provider>
|
||||
), document.getElementById('app')
|
||||
);
|
||||
}
|
||||
|
||||
renderApp();
|
||||
|
||||
@@ -119,8 +119,10 @@ function processTopologies(state, nextTopologies) {
|
||||
// set `selectType` field for topology and sub_topologies options (recursive).
|
||||
const topologiesWithSelectType = visibleTopologies.map(calcSelectType);
|
||||
// cache URLs by ID
|
||||
state = state.set('topologyUrlsById',
|
||||
setTopologyUrlsById(state.get('topologyUrlsById'), topologiesWithSelectType));
|
||||
state = state.set(
|
||||
'topologyUrlsById',
|
||||
setTopologyUrlsById(state.get('topologyUrlsById'), topologiesWithSelectType)
|
||||
);
|
||||
|
||||
const topologiesWithFullnames = addTopologyFullname(topologiesWithSelectType);
|
||||
const immNextTopologies = fromJS(topologiesWithFullnames).sortBy(topologySorter);
|
||||
@@ -144,7 +146,8 @@ function setDefaultTopologyOptions(state, topologyList) {
|
||||
}
|
||||
|
||||
if (defaultOptions.size) {
|
||||
state = state.setIn(['topologyOptions', topology.get('id')],
|
||||
state = state.setIn(
|
||||
['topologyOptions', topology.get('id')],
|
||||
defaultOptions
|
||||
);
|
||||
}
|
||||
@@ -157,8 +160,10 @@ function closeNodeDetails(state, nodeId) {
|
||||
if (nodeDetails.size > 0) {
|
||||
const popNodeId = nodeId || nodeDetails.keySeq().last();
|
||||
// remove pipe if it belongs to the node being closed
|
||||
state = state.update('controlPipes',
|
||||
controlPipes => controlPipes.filter(pipe => pipe.get('nodeId') !== popNodeId));
|
||||
state = state.update(
|
||||
'controlPipes',
|
||||
controlPipes => controlPipes.filter(pipe => pipe.get('nodeId') !== popNodeId)
|
||||
);
|
||||
state = state.deleteIn(['nodeDetails', popNodeId]);
|
||||
}
|
||||
if (state.get('nodeDetails').size === 0 || state.get('selectedNodeId') === nodeId) {
|
||||
@@ -298,7 +303,8 @@ export function rootReducer(state = initialState, action) {
|
||||
if (prevDetailsStackSize > 1 || prevSelectedNodeId !== action.nodeId) {
|
||||
// dont set origin if a node was already selected, suppresses animation
|
||||
const origin = prevSelectedNodeId === null ? action.origin : null;
|
||||
state = state.setIn(['nodeDetails', action.nodeId],
|
||||
state = state.setIn(
|
||||
['nodeDetails', action.nodeId],
|
||||
{
|
||||
id: action.nodeId,
|
||||
label: action.label,
|
||||
@@ -318,7 +324,8 @@ export function rootReducer(state = initialState, action) {
|
||||
state = state.deleteIn(['nodeDetails', action.nodeId]);
|
||||
state = state.setIn(['nodeDetails', action.nodeId], details);
|
||||
} else {
|
||||
state = state.setIn(['nodeDetails', action.nodeId],
|
||||
state = state.setIn(
|
||||
['nodeDetails', action.nodeId],
|
||||
{
|
||||
id: action.nodeId,
|
||||
label: action.label,
|
||||
@@ -331,8 +338,10 @@ export function rootReducer(state = initialState, action) {
|
||||
}
|
||||
|
||||
case ActionTypes.CLICK_SHOW_TOPOLOGY_FOR_NODE: {
|
||||
state = state.update('nodeDetails',
|
||||
nodeDetails => nodeDetails.filter((v, k) => k === action.nodeId));
|
||||
state = state.update(
|
||||
'nodeDetails',
|
||||
nodeDetails => nodeDetails.filter((v, k) => k === action.nodeId)
|
||||
);
|
||||
state = state.update('controlPipes', controlPipes => controlPipes.clear());
|
||||
state = state.set('selectedNodeId', action.nodeId);
|
||||
|
||||
@@ -579,11 +588,13 @@ export function rootReducer(state = initialState, action) {
|
||||
return state;
|
||||
}
|
||||
|
||||
log('RECEIVE_NODES_DELTA',
|
||||
log(
|
||||
'RECEIVE_NODES_DELTA',
|
||||
'remove', size(action.delta.remove),
|
||||
'update', size(action.delta.update),
|
||||
'add', size(action.delta.add),
|
||||
'reset', action.delta.reset);
|
||||
'reset', action.delta.reset
|
||||
);
|
||||
|
||||
if (action.delta.reset) {
|
||||
state = state.set('nodes', makeMap());
|
||||
@@ -700,8 +711,7 @@ export function rootReducer(state = initialState, action) {
|
||||
state = state.update('controlPipes', controlPipes => controlPipes.clear());
|
||||
}
|
||||
if (action.state.nodeDetails) {
|
||||
const actionNodeDetails = makeOrderedMap(
|
||||
action.state.nodeDetails.map(obj => [obj.id, obj]));
|
||||
const actionNodeDetails = makeOrderedMap(action.state.nodeDetails.map(h => [h.id, h]));
|
||||
// check if detail IDs have changed
|
||||
if (!isDeepEqual(state.get('nodeDetails').keySeq(), actionNodeDetails.keySeq())) {
|
||||
state = state.set('nodeDetails', actionNodeDetails);
|
||||
@@ -709,8 +719,10 @@ export function rootReducer(state = initialState, action) {
|
||||
} else {
|
||||
state = state.update('nodeDetails', nodeDetails => nodeDetails.clear());
|
||||
}
|
||||
state = state.set('topologyOptions',
|
||||
fromJS(action.state.topologyOptions) || state.get('topologyOptions'));
|
||||
state = state.set(
|
||||
'topologyOptions',
|
||||
fromJS(action.state.topologyOptions) || state.get('topologyOptions')
|
||||
);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,8 +85,8 @@ const decoratedNodesByTopologySelector = createSelector(
|
||||
const isBaseLayer = (index === 0);
|
||||
|
||||
const nodeParentDecorator = nodeParentDecoratorByTopologyId(parentLayerTopologyId);
|
||||
const nodeMetricSummaryDecorator = nodeMetricSummaryDecoratorByType(
|
||||
pinnedMetricType, showCapacity);
|
||||
const nodeMetricSummaryDecorator =
|
||||
nodeMetricSummaryDecoratorByType(pinnedMetricType, showCapacity);
|
||||
|
||||
// Color the node, deduce its anchor point, dimensions and info about its pinned metric.
|
||||
const decoratedTopologyNodes = (topologyNodes || makeMap())
|
||||
|
||||
@@ -11,11 +11,13 @@ const store = configureStore();
|
||||
|
||||
function renderApp() {
|
||||
const TerminalApp = require('./components/terminal-app').default;
|
||||
ReactDOM.render((
|
||||
<Provider store={store}>
|
||||
<TerminalApp />
|
||||
</Provider>
|
||||
), document.getElementById('app'));
|
||||
ReactDOM.render(
|
||||
(
|
||||
<Provider store={store}>
|
||||
<TerminalApp />
|
||||
</Provider>
|
||||
), document.getElementById('app')
|
||||
);
|
||||
}
|
||||
|
||||
renderApp();
|
||||
|
||||
@@ -125,15 +125,19 @@ describe('SearchUtils', () => {
|
||||
|
||||
it('does not add a non-matching field', () => {
|
||||
let matches = fromJS({});
|
||||
matches = fun(matches, ['node1', 'field1'],
|
||||
'some value', 'some query', null, 'some label');
|
||||
matches = fun(
|
||||
matches, ['node1', 'field1'],
|
||||
'some value', 'some query', null, 'some label'
|
||||
);
|
||||
expect(matches.size).toBe(0);
|
||||
});
|
||||
|
||||
it('adds a matching field', () => {
|
||||
let matches = fromJS({});
|
||||
matches = fun(matches, ['node1', 'field1'],
|
||||
'samevalue', 'samevalue', null, 'some label');
|
||||
matches = fun(
|
||||
matches, ['node1', 'field1'],
|
||||
'samevalue', 'samevalue', null, 'some label'
|
||||
);
|
||||
expect(matches.size).toBe(1);
|
||||
expect(matches.getIn(['node1', 'field1'])).toBeDefined();
|
||||
const {text, label, start, length} = matches.getIn(['node1', 'field1']);
|
||||
@@ -145,15 +149,19 @@ describe('SearchUtils', () => {
|
||||
|
||||
it('does not add a field when the prefix does not match the label', () => {
|
||||
let matches = fromJS({});
|
||||
matches = fun(matches, ['node1', 'field1'],
|
||||
'samevalue', 'samevalue', 'some prefix', 'some label');
|
||||
matches = fun(
|
||||
matches, ['node1', 'field1'],
|
||||
'samevalue', 'samevalue', 'some prefix', 'some label'
|
||||
);
|
||||
expect(matches.size).toBe(0);
|
||||
});
|
||||
|
||||
it('adds a field when the prefix matches the label', () => {
|
||||
let matches = fromJS({});
|
||||
matches = fun(matches, ['node1', 'field1'],
|
||||
'samevalue', 'samevalue', 'prefix', 'prefixed label');
|
||||
matches = fun(
|
||||
matches, ['node1', 'field1'],
|
||||
'samevalue', 'samevalue', 'prefix', 'prefixed label'
|
||||
);
|
||||
expect(matches.size).toBe(1);
|
||||
});
|
||||
});
|
||||
@@ -163,30 +171,40 @@ describe('SearchUtils', () => {
|
||||
|
||||
it('does not add a non-matching field', () => {
|
||||
let matches = fromJS({});
|
||||
matches = fun(matches, ['node1', 'field1'],
|
||||
1, 'metric1', 'metric2', 'lt', 2);
|
||||
matches = fun(
|
||||
matches, ['node1', 'field1'],
|
||||
1, 'metric1', 'metric2', 'lt', 2
|
||||
);
|
||||
expect(matches.size).toBe(0);
|
||||
});
|
||||
|
||||
it('adds a matching field', () => {
|
||||
let matches = fromJS({});
|
||||
matches = fun(matches, ['node1', 'field1'],
|
||||
1, 'metric1', 'metric1', 'lt', 2);
|
||||
matches = fun(
|
||||
matches, ['node1', 'field1'],
|
||||
1, 'metric1', 'metric1', 'lt', 2
|
||||
);
|
||||
expect(matches.size).toBe(1);
|
||||
expect(matches.getIn(['node1', 'field1'])).toBeDefined();
|
||||
const { metric } = matches.getIn(['node1', 'field1']);
|
||||
expect(metric).toBeTruthy();
|
||||
|
||||
matches = fun(matches, ['node2', 'field1'],
|
||||
1, 'metric1', 'metric1', 'gt', 0);
|
||||
matches = fun(
|
||||
matches, ['node2', 'field1'],
|
||||
1, 'metric1', 'metric1', 'gt', 0
|
||||
);
|
||||
expect(matches.size).toBe(2);
|
||||
|
||||
matches = fun(matches, ['node3', 'field1'],
|
||||
1, 'metric1', 'metric1', 'eq', 1);
|
||||
matches = fun(
|
||||
matches, ['node3', 'field1'],
|
||||
1, 'metric1', 'metric1', 'eq', 1
|
||||
);
|
||||
expect(matches.size).toBe(3);
|
||||
|
||||
matches = fun(matches, ['node3', 'field1'],
|
||||
1, 'metric1', 'metric1', 'other', 1);
|
||||
matches = fun(
|
||||
matches, ['node3', 'field1'],
|
||||
1, 'metric1', 'metric1', 'other', 1
|
||||
);
|
||||
expect(matches.size).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -79,7 +79,8 @@ describe('TopologyUtils', () => {
|
||||
it('sets node degrees', () => {
|
||||
nodes = TopologyUtils.updateNodeDegrees(
|
||||
nodeSets.initial4.nodes,
|
||||
nodeSets.initial4.edges).toJS();
|
||||
nodeSets.initial4.edges
|
||||
).toJS();
|
||||
|
||||
expect(nodes.n1.degree).toEqual(2);
|
||||
expect(nodes.n2.degree).toEqual(1);
|
||||
@@ -88,7 +89,8 @@ describe('TopologyUtils', () => {
|
||||
|
||||
nodes = TopologyUtils.updateNodeDegrees(
|
||||
nodeSets.removeEdge24.nodes,
|
||||
nodeSets.removeEdge24.edges).toJS();
|
||||
nodeSets.removeEdge24.edges
|
||||
).toJS();
|
||||
|
||||
expect(nodes.n1.degree).toEqual(2);
|
||||
expect(nodes.n2.degree).toEqual(0);
|
||||
@@ -97,7 +99,8 @@ describe('TopologyUtils', () => {
|
||||
|
||||
nodes = TopologyUtils.updateNodeDegrees(
|
||||
nodeSets.single3.nodes,
|
||||
nodeSets.single3.edges).toJS();
|
||||
nodeSets.single3.edges
|
||||
).toJS();
|
||||
|
||||
expect(nodes.n1.degree).toEqual(0);
|
||||
expect(nodes.n2.degree).toEqual(0);
|
||||
|
||||
@@ -8,8 +8,7 @@ export function uniformSelect(array, size) {
|
||||
}
|
||||
|
||||
return range(size).map(index =>
|
||||
array[parseInt(index * (array.length / (size - (1 - 1e-9))), 10)]
|
||||
);
|
||||
array[parseInt(index * (array.length / (size - (1 - 1e-9))), 10)]);
|
||||
}
|
||||
|
||||
export function insertElement(array, index, element) {
|
||||
|
||||
@@ -76,7 +76,8 @@ function download(source, name) {
|
||||
filename = `${window.document.title.replace(/[^a-z0-9]/gi, '-').toLowerCase()}-${(+new Date())}`;
|
||||
}
|
||||
|
||||
const url = window.URL.createObjectURL(new Blob(source,
|
||||
const url = window.URL.createObjectURL(new Blob(
|
||||
source,
|
||||
{ type: 'text/xml' }
|
||||
));
|
||||
|
||||
|
||||
@@ -72,8 +72,10 @@ function findNodeMatch(nodeMatches, keyPath, text, query, prefix, label, truncat
|
||||
if (matches) {
|
||||
const firstMatch = matches[0];
|
||||
const index = text.search(queryRe);
|
||||
nodeMatches = nodeMatches.setIn(keyPath,
|
||||
{text, label, start: index, length: firstMatch.length, truncate});
|
||||
nodeMatches = nodeMatches.setIn(
|
||||
keyPath,
|
||||
{text, label, start: index, length: firstMatch.length, truncate}
|
||||
);
|
||||
}
|
||||
}
|
||||
return nodeMatches;
|
||||
@@ -110,8 +112,10 @@ function findNodeMatchMetric(nodeMatches, keyPath, fieldValue, fieldLabel, metri
|
||||
}
|
||||
}
|
||||
if (matched) {
|
||||
nodeMatches = nodeMatches.setIn(keyPath,
|
||||
{fieldLabel, metric: true});
|
||||
nodeMatches = nodeMatches.setIn(
|
||||
keyPath,
|
||||
{fieldLabel, metric: true}
|
||||
);
|
||||
}
|
||||
}
|
||||
return nodeMatches;
|
||||
@@ -125,8 +129,10 @@ export function searchNode(node, { prefix, query, metric, comp, value }) {
|
||||
SEARCH_FIELDS.forEach((field, label) => {
|
||||
const keyPath = [label];
|
||||
if (node.has(field)) {
|
||||
nodeMatches = findNodeMatch(nodeMatches, keyPath, node.get(field),
|
||||
query, prefix, label);
|
||||
nodeMatches = findNodeMatch(
|
||||
nodeMatches, keyPath, node.get(field),
|
||||
query, prefix, label
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -134,8 +140,10 @@ export function searchNode(node, { prefix, query, metric, comp, value }) {
|
||||
if (node.get('metadata')) {
|
||||
node.get('metadata').forEach((field) => {
|
||||
const keyPath = ['metadata', field.get('id')];
|
||||
nodeMatches = findNodeMatch(nodeMatches, keyPath, field.get('value'),
|
||||
query, prefix, field.get('label'), field.get('truncate'));
|
||||
nodeMatches = findNodeMatch(
|
||||
nodeMatches, keyPath, field.get('value'),
|
||||
query, prefix, field.get('label'), field.get('truncate')
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -143,8 +151,10 @@ export function searchNode(node, { prefix, query, metric, comp, value }) {
|
||||
if (node.get('parents')) {
|
||||
node.get('parents').forEach((parent) => {
|
||||
const keyPath = ['parents', parent.get('id')];
|
||||
nodeMatches = findNodeMatch(nodeMatches, keyPath, parent.get('label'),
|
||||
query, prefix, parent.get('topologyId'));
|
||||
nodeMatches = findNodeMatch(
|
||||
nodeMatches, keyPath, parent.get('label'),
|
||||
query, prefix, parent.get('topologyId')
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -153,8 +163,10 @@ export function searchNode(node, { prefix, query, metric, comp, value }) {
|
||||
(propertyList.get('rows') || []).forEach((row) => {
|
||||
const entries = row.get('entries');
|
||||
const keyPath = ['property-lists', row.get('id')];
|
||||
nodeMatches = findNodeMatch(nodeMatches, keyPath, entries.get('value'),
|
||||
query, prefix, entries.get('label'));
|
||||
nodeMatches = findNodeMatch(
|
||||
nodeMatches, keyPath, entries.get('value'),
|
||||
query, prefix, entries.get('label')
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -173,8 +185,10 @@ export function searchNode(node, { prefix, query, metric, comp, value }) {
|
||||
if (metrics) {
|
||||
metrics.forEach((field) => {
|
||||
const keyPath = ['metrics', field.get('id')];
|
||||
nodeMatches = findNodeMatchMetric(nodeMatches, keyPath, field.get('value'),
|
||||
field.get('label'), metric, comp, value);
|
||||
nodeMatches = findNodeMatchMetric(
|
||||
nodeMatches, keyPath, field.get('value'),
|
||||
field.get('label'), metric, comp, value
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -259,8 +273,7 @@ export function getSearchableFields(nodes) {
|
||||
// Consider only property lists (and not generic tables).
|
||||
const tableRowLabels = nodes.reduce((labels, node) => (
|
||||
labels.union(get(node, 'tables').filter(isPropertyList).flatMap(t => (t.get('rows') || makeList)
|
||||
.map(f => f.getIn(['entries', 'label']))
|
||||
))
|
||||
.map(f => f.getIn(['entries', 'label']))))
|
||||
), makeSet());
|
||||
|
||||
const metricLabels = nodes.reduce((labels, node) => (
|
||||
@@ -282,8 +295,10 @@ export function getSearchableFields(nodes) {
|
||||
*/
|
||||
export function applyPinnedSearches(state) {
|
||||
// clear old filter state
|
||||
state = state.update('nodes',
|
||||
nodes => nodes.map(node => node.set('filtered', false)));
|
||||
state = state.update(
|
||||
'nodes',
|
||||
nodes => nodes.map(node => node.set('filtered', false))
|
||||
);
|
||||
|
||||
const pinnedSearches = state.get('pinnedSearches');
|
||||
if (pinnedSearches.size > 0) {
|
||||
@@ -292,10 +307,12 @@ export function applyPinnedSearches(state) {
|
||||
if (parsed) {
|
||||
const nodeMatches = searchTopology(state.get('nodes'), parsed);
|
||||
const filteredNodes = state.get('nodes')
|
||||
.map(node => node.set('filtered',
|
||||
.map(node => node.set(
|
||||
'filtered',
|
||||
node.get('filtered') // matched by previous pinned search
|
||||
|| nodeMatches.size === 0 // no match, filter all nodes
|
||||
|| !nodeMatches.has(node.get('id')))); // filter matches
|
||||
|| !nodeMatches.has(node.get('id'))
|
||||
)); // filter matches
|
||||
state = state.set('nodes', filteredNodes);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -167,8 +167,10 @@ function createWebsocket(websocketUrl, getState, dispatch) {
|
||||
firstMessageOnWebsocketAt = new Date();
|
||||
const timeToFirstMessage = firstMessageOnWebsocketAt - createWebsocketAt;
|
||||
if (timeToFirstMessage > FIRST_RENDER_TOO_LONG_THRESHOLD) {
|
||||
log('Time (ms) to first nodes render after websocket was created',
|
||||
firstMessageOnWebsocketAt - createWebsocketAt);
|
||||
log(
|
||||
'Time (ms) to first nodes render after websocket was created',
|
||||
firstMessageOnWebsocketAt - createWebsocketAt
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -197,13 +199,15 @@ function getNodesForTopologies(state, dispatch, topologyIds, topologyOptions = m
|
||||
// fetch sequentially
|
||||
state.get('topologyUrlsById')
|
||||
.filter((_, topologyId) => topologyIds.contains(topologyId))
|
||||
.reduce((sequence, topologyUrl, topologyId) => sequence
|
||||
.then(() => {
|
||||
const optionsQuery = buildUrlQuery(topologyOptions.get(topologyId), state);
|
||||
return doRequest({ url: `${getApiPath()}${topologyUrl}?${optionsQuery}` });
|
||||
})
|
||||
.then(json => dispatch(receiveNodesForTopology(json.nodes, topologyId))),
|
||||
Promise.resolve());
|
||||
.reduce(
|
||||
(sequence, topologyUrl, topologyId) => sequence
|
||||
.then(() => {
|
||||
const optionsQuery = buildUrlQuery(topologyOptions.get(topologyId), state);
|
||||
return doRequest({ url: `${getApiPath()}${topologyUrl}?${optionsQuery}` });
|
||||
})
|
||||
.then(json => dispatch(receiveNodesForTopology(json.nodes, topologyId))),
|
||||
Promise.resolve()
|
||||
);
|
||||
}
|
||||
|
||||
function getNodesOnce(getState, dispatch) {
|
||||
|
||||
+4
-2
@@ -100,8 +100,10 @@ const proxyPathServer = http.createServer((req, res) => {
|
||||
return pathProxy.web(req, res, {target});
|
||||
}).listen(pathProxyPort, 'localhost', () => {
|
||||
const pathProxyHost = proxyPathServer.address().address;
|
||||
console.log('Scope Proxy Path UI listening at http://%s:%s/scoped/',
|
||||
pathProxyHost, pathProxyPort);
|
||||
console.log(
|
||||
'Scope Proxy Path UI listening at http://%s:%s/scoped/',
|
||||
pathProxyHost, pathProxyPort
|
||||
);
|
||||
});
|
||||
|
||||
proxyPathServer.on('upgrade', (req, socket, head) => {
|
||||
|
||||
Reference in New Issue
Block a user