Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Monitoring] [Pipeline Viewer] Remove obsolete code #20122

21 changes: 0 additions & 21 deletions x-pack/plugins/monitoring/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,27 +121,6 @@ export const LOGSTASH = {
* Constants used by Logstash Pipeline Viewer code
*/
PIPELINE_VIEWER: {
GRAPH: {
EDGES: {
SVG_CLASS: 'lspvEdge',
LABEL_RADIUS: 8,
// This is something we may play with later.
// 1 seems to be the best value however, without it the edges sometimes make weird loops in complex graphs
ROUTING_MARGIN_PX: 1,
ARROW_START: 5
},
VERTICES: {
BORDER_RADIUS_PX: 4,
MARGIN_PX: 35,
WIDTH_PX: 320,
HEIGHT_PX: 85,

/**
* Vertical distance between vertices, as measured from top-border-to-top-border
*/
VERTICAL_DISTANCE_PX: 20
}
},
ICON: {
HEIGHT_PX: 18,
WIDTH_PX: 18
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,77 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React from 'react';
import { ColaGraph } from './views/cola_graph';
import { DetailDrawer } from './views/detail_drawer';
import { PropTypes } from 'prop-types';

export class PipelineViewer extends React.Component {
constructor() {
super();
this.state = {
detailDrawer: {
vertex: null
}
};
}

onShowVertexDetails = (vertex) => {
if (vertex === this.state.detailDrawer.vertex) {
this.onHideVertexDetails();
}
else {
this.setState({
detailDrawer: {
vertex
}
});
}
}

onHideVertexDetails = () => {
this.setState({
detailDrawer: {
vertex: null
}
});
}

renderDetailDrawer = () => {
if (!this.state.detailDrawer.vertex) {
return null;
}

return (
<DetailDrawer
vertex={this.state.detailDrawer.vertex}
onHide={this.onHideVertexDetails}
timeseriesTooltipXValueFormatter={this.props.timeseriesTooltipXValueFormatter}
/>
);
}

render() {
const graph = this.props.pipelineState.config.graph;

return (
<div className="lspvContainer">
<ColaGraph
graph={graph}
onShowVertexDetails={this.onShowVertexDetails}
detailVertex={this.state.detailDrawer.vertex}
/>
{ this.renderDetailDrawer() }
</div>
);
}
}

PipelineViewer.propTypes = {
pipelineState: PropTypes.shape({
config: PropTypes.shape({
graph: PropTypes.object.isRequired
})
}),
timeseriesTooltipXValueFormatter: PropTypes.func.isRequired
};
export { ConfigViewer } from './views/config_viewer';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import expect from 'expect.js';
import { BooleanEdge } from '../boolean_edge';
import { Edge } from '../edge';
import { LOGSTASH } from '../../../../../../../common/constants';

describe('BooleanEdge', () => {
let graph;
Expand All @@ -32,10 +31,4 @@ describe('BooleanEdge', () => {
const booleanEdge = new BooleanEdge(graph, edgeJson);
expect(booleanEdge).to.be.a(Edge);
});

it('should have the correct SVG CSS class', () => {
const booleanEdge = new BooleanEdge(graph, edgeJson);
const edgeSvgClass = LOGSTASH.PIPELINE_VIEWER.GRAPH.EDGES.SVG_CLASS;
expect(booleanEdge.svgClass).to.be(`${edgeSvgClass} ${edgeSvgClass}Boolean ${edgeSvgClass}Boolean--true`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import expect from 'expect.js';
import { Edge } from '../edge';
import { LOGSTASH } from '../../../../../../../common/constants';

describe('Edge', () => {
let graph;
Expand All @@ -26,20 +25,6 @@ describe('Edge', () => {
};
});

it('should initialize the webcola representation', () => {
const edge = new Edge(graph, edgeJson);
expect(edge.cola).to.eql({
edge: edge,
source: 'bar',
target: 17
});
});

it('should have a D3-friendly ID', () => {
const edge = new Edge(graph, edgeJson);
expect(edge.htmlAttrId).to.be('myif_myes');
});

it('should have the correct from vertex', () => {
const edge = new Edge(graph, edgeJson);
expect(edge.fromId).to.be('myif');
Expand All @@ -51,9 +36,4 @@ describe('Edge', () => {
expect(edge.toId).to.be('myes');
expect(edge.to).to.be(graph.verticesById.myes);
});

it('should have the correct SVG CSS class', () => {
const edge = new Edge(graph, edgeJson);
expect(edge.svgClass).to.be(LOGSTASH.PIPELINE_VIEWER.GRAPH.EDGES.SVG_CLASS);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import expect from 'expect.js';
import { edgeFactory } from '../edge_factory';
import { PlainEdge } from '../plain_edge';
import { Edge } from '../edge';
import { BooleanEdge } from '../boolean_edge';

describe('edgeFactory', () => {
Expand All @@ -27,9 +27,9 @@ describe('edgeFactory', () => {
};
});

it('returns a PlainEdge when edge type is plain', () => {
it('returns an Edge when edge type is plain', () => {
edgeJson.type = 'plain';
expect(edgeFactory(graph, edgeJson)).to.be.a(PlainEdge);
expect(edgeFactory(graph, edgeJson)).to.be.a(Edge);
});

it('returns a BooleanEdge when edge type is boolean', () => {
Expand Down
Loading