From 993137025f2793f2e752f986eca095337716c2d4 Mon Sep 17 00:00:00 2001 From: Deniz Kusefoglu Date: Fri, 9 Mar 2018 10:51:49 -0800 Subject: [PATCH] Remove unused dygraph synchronizers --- ui/src/dashboards/components/Dashboard.js | 3 -- ui/src/dashboards/containers/DashboardPage.js | 29 ------------------- ui/src/hosts/containers/HostPage.js | 17 ----------- ui/src/shared/components/Dygraph.js | 14 --------- ui/src/shared/components/Layout.js | 3 -- ui/src/shared/components/LayoutRenderer.js | 3 -- ui/src/shared/components/LineGraph.js | 3 -- ui/src/shared/components/RefreshingGraph.js | 3 -- 8 files changed, 75 deletions(-) diff --git a/ui/src/dashboards/components/Dashboard.js b/ui/src/dashboards/components/Dashboard.js index 24a1496c6..65f888fed 100644 --- a/ui/src/dashboards/components/Dashboard.js +++ b/ui/src/dashboards/components/Dashboard.js @@ -15,7 +15,6 @@ const Dashboard = ({ autoRefresh, manualRefresh, onDeleteCell, - synchronizer, onPositionChange, inPresentationMode, onOpenTemplateManager, @@ -69,7 +68,6 @@ const Dashboard = ({ manualRefresh={manualRefresh} hoverTime={hoverTime} onSetHoverTime={onSetHoverTime} - synchronizer={synchronizer} onDeleteCell={onDeleteCell} onPositionChange={onPositionChange} templates={templatesIncludingDashTime} @@ -115,7 +113,6 @@ Dashboard.propTypes = { onPositionChange: func, onDeleteCell: func, onSummonOverlayTechnologies: func, - synchronizer: func, hoverTime: string, onSetHoverTime: func, source: shape({ diff --git a/ui/src/dashboards/containers/DashboardPage.js b/ui/src/dashboards/containers/DashboardPage.js index bc5bc560d..59697d791 100644 --- a/ui/src/dashboards/containers/DashboardPage.js +++ b/ui/src/dashboards/containers/DashboardPage.js @@ -238,34 +238,6 @@ class DashboardPage extends Component { this.props.errorThrown(error) } - synchronizer = dygraph => { - const dygraphs = [...this.dygraphs, dygraph].filter(d => d.graphDiv) - const {dashboards, params: {dashboardID}} = this.props - - const dashboard = dashboards.find( - d => d.id === idNormalizer(TYPE_ID, dashboardID) - ) - - // Get only the graphs that can sync the hover line - const graphsToSync = dashboard.cells.filter(c => - DYGRAPH_CELL_TYPES.find(dct => dct === c.type) - ) - - if ( - dashboard && - dygraphs.length === graphsToSync.length && - dygraphs.length > 1 - ) { - Dygraph.synchronize(dygraphs, { - selection: true, - zoom: false, - range: false, - }) - } - - this.dygraphs = dygraphs - } - handleSetHoverTime = hoverTime => { this.setState({hoverTime}) } @@ -445,7 +417,6 @@ class DashboardPage extends Component { manualRefresh={manualRefresh} onZoom={this.handleZoomedTimeRange} onAddCell={this.handleAddCell} - synchronizer={this.synchronizer} hoverTime={hoverTime} onSetHoverTime={this.handleSetHoverTime} inPresentationMode={inPresentationMode} diff --git a/ui/src/hosts/containers/HostPage.js b/ui/src/hosts/containers/HostPage.js index d0d9d010c..e418708fb 100644 --- a/ui/src/hosts/containers/HostPage.js +++ b/ui/src/hosts/containers/HostPage.js @@ -83,22 +83,6 @@ class HostPage extends Component { } } - synchronizer = dygraph => { - const dygraphs = [...this.state.dygraphs, dygraph].filter(d => d.graphDiv) - const numGraphs = this.state.layouts.reduce((acc, {cells}) => { - return acc + cells.length - }, 0) - - if (dygraphs.length === numGraphs) { - Dygraph.synchronize(dygraphs, { - selection: true, - zoom: false, - range: false, - }) - } - this.setState({dygraphs}) - } - renderLayouts = layouts => { const {timeRange} = this.state const {source, autoRefresh, manualRefresh} = this.props @@ -156,7 +140,6 @@ class HostPage extends Component { autoRefresh={autoRefresh} manualRefresh={manualRefresh} host={this.props.params.hostID} - synchronizer={this.synchronizer} /> ) } diff --git a/ui/src/shared/components/Dygraph.js b/ui/src/shared/components/Dygraph.js index 654b841f2..8ea88ac0f 100644 --- a/ui/src/shared/components/Dygraph.js +++ b/ui/src/shared/components/Dygraph.js @@ -31,7 +31,6 @@ class Dygraph extends Component { constructor(props) { super(props) this.state = { - isSynced: false, isHidden: true, staticLegendHeight: null, isNotHovering: true, @@ -92,11 +91,6 @@ class Dygraph extends Component { const {w} = this.dygraph.getArea() this.props.setResolution(w) - - // Simple opt-out for now, if a graph should not be synced - if (this.props.synchronizer) { - this.sync() - } } componentWillUnmount() { @@ -239,13 +233,6 @@ class Dygraph extends Component { return hashColorDygraphSeries } - sync = () => { - if (!this.state.isSynced) { - this.props.synchronizer(this.dygraph) - this.setState({isSynced: true}) - } - } - handleHideLegend = e => { const {top, bottom, left, right} = this.graphRef.getBoundingClientRect() @@ -445,7 +432,6 @@ Dygraph.propTypes = { timeRange: shape({ lower: string.isRequired, }), - synchronizer: func, hoverTime: string, onSetHoverTime: func, setResolution: func, diff --git a/ui/src/shared/components/Layout.js b/ui/src/shared/components/Layout.js index 160d608a5..4f5bdb90b 100644 --- a/ui/src/shared/components/Layout.js +++ b/ui/src/shared/components/Layout.js @@ -52,7 +52,6 @@ const Layout = ( autoRefresh, manualRefresh, onDeleteCell, - synchronizer, resizeCoords, onCancelEditCell, onStopAddAnnotation, @@ -86,7 +85,6 @@ const Layout = ( timeRange={timeRange} templates={templates} autoRefresh={autoRefresh} - synchronizer={synchronizer} hoverTime={hoverTime} onSetHoverTime={onSetHoverTime} manualRefresh={manualRefresh} @@ -152,7 +150,6 @@ const propTypes = { onEditCell: func, onDeleteCell: func, onSummonOverlayTechnologies: func, - synchronizer: func, hoverTime: string, onSetHoverTime: func, isStatusPage: bool, diff --git a/ui/src/shared/components/LayoutRenderer.js b/ui/src/shared/components/LayoutRenderer.js index 25a2751e7..9d35b3062 100644 --- a/ui/src/shared/components/LayoutRenderer.js +++ b/ui/src/shared/components/LayoutRenderer.js @@ -77,7 +77,6 @@ class LayoutRenderer extends Component { autoRefresh, manualRefresh, onDeleteCell, - synchronizer, onCancelEditCell, onSummonOverlayTechnologies, hoverTime, @@ -132,7 +131,6 @@ class LayoutRenderer extends Component { autoRefresh={autoRefresh} resizeCoords={resizeCoords} onDeleteCell={onDeleteCell} - synchronizer={synchronizer} hoverTime={hoverTime} onSetHoverTime={onSetHoverTime} manualRefresh={manualRefresh} @@ -189,7 +187,6 @@ LayoutRenderer.propTypes = { onEditCell: func, onDeleteCell: func, onSummonOverlayTechnologies: func, - synchronizer: func, hoverTime: string, onSetHoverTime: func, isStatusPage: bool, diff --git a/ui/src/shared/components/LineGraph.js b/ui/src/shared/components/LineGraph.js index c47ef37c0..bb83c5943 100644 --- a/ui/src/shared/components/LineGraph.js +++ b/ui/src/shared/components/LineGraph.js @@ -48,7 +48,6 @@ class LineGraph extends Component { ruleValues, isBarGraph, resizeCoords, - synchronizer, isRefreshing, setResolution, isGraphFilled, @@ -112,7 +111,6 @@ class LineGraph extends Component { isBarGraph={isBarGraph} timeSeries={timeSeries} ruleValues={ruleValues} - synchronizer={synchronizer} hoverTime={hoverTime} onSetHoverTime={onSetHoverTime} resizeCoords={resizeCoords} @@ -189,7 +187,6 @@ LineGraph.propTypes = { lower: string.isRequired, }), isInDataExplorer: bool, - synchronizer: func, hoverTime: string, onSetHoverTime: func, setResolution: func, diff --git a/ui/src/shared/components/RefreshingGraph.js b/ui/src/shared/components/RefreshingGraph.js index e39212600..0da2b8631 100644 --- a/ui/src/shared/components/RefreshingGraph.js +++ b/ui/src/shared/components/RefreshingGraph.js @@ -28,7 +28,6 @@ const RefreshingGraph = ({ resizerTopHeight, staticLegend, manualRefresh, // when changed, re-mounts the component - synchronizer, resizeCoords, editQueryStatus, grabDataForDownload, @@ -119,7 +118,6 @@ const RefreshingGraph = ({ timeRange={timeRange} autoRefresh={autoRefresh} isBarGraph={type === 'bar'} - synchronizer={synchronizer} hoverTime={hoverTime} onSetHoverTime={onSetHoverTime} resizeCoords={resizeCoords} @@ -141,7 +139,6 @@ RefreshingGraph.propTypes = { autoRefresh: number.isRequired, manualRefresh: number, templates: arrayOf(shape()), - synchronizer: func, hoverTime: string, onSetHoverTime: func, type: string.isRequired,