Remove unused dygraph synchronizers
parent
805d8ca82b
commit
993137025f
|
@ -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({
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue