From 454e0ac02274883fc1038f71503c7efc42a5cd8c Mon Sep 17 00:00:00 2001 From: Deniz Kusefoglu Date: Tue, 6 Mar 2018 16:27:14 -0800 Subject: [PATCH] Convert hoverTime to string --- ui/src/dashboards/components/Dashboard.js | 2 +- ui/src/dashboards/containers/DashboardPage.js | 2 +- ui/src/shared/components/Dygraph.js | 12 ++++++++---- ui/src/shared/components/Layout.js | 2 +- ui/src/shared/components/LayoutRenderer.js | 2 +- ui/src/shared/components/LineGraph.js | 2 +- ui/src/shared/components/RefreshingGraph.js | 2 +- ui/src/shared/components/TableGraph.js | 8 ++++---- 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ui/src/dashboards/components/Dashboard.js b/ui/src/dashboards/components/Dashboard.js index 2202d1b55..24a1496c6 100644 --- a/ui/src/dashboards/components/Dashboard.js +++ b/ui/src/dashboards/components/Dashboard.js @@ -116,7 +116,7 @@ Dashboard.propTypes = { onDeleteCell: func, onSummonOverlayTechnologies: func, synchronizer: func, - hoverTime: number, + hoverTime: string, onSetHoverTime: func, source: shape({ links: shape({ diff --git a/ui/src/dashboards/containers/DashboardPage.js b/ui/src/dashboards/containers/DashboardPage.js index 2c41428b4..bc5bc560d 100644 --- a/ui/src/dashboards/containers/DashboardPage.js +++ b/ui/src/dashboards/containers/DashboardPage.js @@ -53,7 +53,7 @@ class DashboardPage extends Component { zoomedTimeRange: {zoomedLower: null, zoomedUpper: null}, scrollTop: 0, windowHeight: window.innerHeight, - hoverTime: 0, + hoverTime: '0', } } diff --git a/ui/src/shared/components/Dygraph.js b/ui/src/shared/components/Dygraph.js index cba4e83b1..f3d890061 100644 --- a/ui/src/shared/components/Dygraph.js +++ b/ui/src/shared/components/Dygraph.js @@ -198,12 +198,16 @@ class Dygraph extends Component { highlightCallback = (e, x) => { const {onSetHoverTime} = this.props - onSetHoverTime(x) + if (onSetHoverTime) { + onSetHoverTime(x.toString()) + } } unhighlightCallback = () => { const {onSetHoverTime} = this.props - onSetHoverTime(0) + if (onSetHoverTime) { + onSetHoverTime('0') + } } hashColorDygraphSeries = () => { @@ -365,7 +369,7 @@ class Dygraph extends Component { } } -const {array, arrayOf, bool, func, node, number, shape, string} = PropTypes +const {array, arrayOf, bool, func, node, shape, string} = PropTypes Dygraph.defaultProps = { axes: { @@ -420,7 +424,7 @@ Dygraph.propTypes = { lower: string.isRequired, }), synchronizer: func, - hoverTime: number, + hoverTime: string, onSetHoverTime: func, setResolution: func, dygraphRef: func, diff --git a/ui/src/shared/components/Layout.js b/ui/src/shared/components/Layout.js index a3d8e6b87..160d608a5 100644 --- a/ui/src/shared/components/Layout.js +++ b/ui/src/shared/components/Layout.js @@ -153,7 +153,7 @@ const propTypes = { onDeleteCell: func, onSummonOverlayTechnologies: func, synchronizer: func, - hoverTime: number, + hoverTime: string, onSetHoverTime: func, isStatusPage: bool, isEditable: bool, diff --git a/ui/src/shared/components/LayoutRenderer.js b/ui/src/shared/components/LayoutRenderer.js index 25d16c408..25a2751e7 100644 --- a/ui/src/shared/components/LayoutRenderer.js +++ b/ui/src/shared/components/LayoutRenderer.js @@ -190,7 +190,7 @@ LayoutRenderer.propTypes = { onDeleteCell: func, onSummonOverlayTechnologies: func, synchronizer: func, - hoverTime: number, + hoverTime: string, onSetHoverTime: func, isStatusPage: bool, isEditable: bool, diff --git a/ui/src/shared/components/LineGraph.js b/ui/src/shared/components/LineGraph.js index bf7831d4e..c47ef37c0 100644 --- a/ui/src/shared/components/LineGraph.js +++ b/ui/src/shared/components/LineGraph.js @@ -190,7 +190,7 @@ LineGraph.propTypes = { }), isInDataExplorer: bool, synchronizer: func, - hoverTime: number, + hoverTime: string, onSetHoverTime: func, setResolution: func, cellHeight: number, diff --git a/ui/src/shared/components/RefreshingGraph.js b/ui/src/shared/components/RefreshingGraph.js index 7dfd3ea75..e39212600 100644 --- a/ui/src/shared/components/RefreshingGraph.js +++ b/ui/src/shared/components/RefreshingGraph.js @@ -142,7 +142,7 @@ RefreshingGraph.propTypes = { manualRefresh: number, templates: arrayOf(shape()), synchronizer: func, - hoverTime: number, + hoverTime: string, onSetHoverTime: func, type: string.isRequired, cellHeight: number, diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 2d3748e61..f4ee6510b 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -26,13 +26,13 @@ class TableGraph extends Component { handleHover = (columnIndex, rowIndex) => () => { const {onSetHoverTime} = this.props - onSetHoverTime(this._data[rowIndex][0]) + onSetHoverTime(this._data[rowIndex][0].toString()) this.setState({hoveredColumnIndex: columnIndex, hoveredRowIndex: rowIndex}) } handleMouseOut = () => { const {onSetHoverTime} = this.props - onSetHoverTime(0) + onSetHoverTime('0') this.setState({hoveredColumnIndex: -1, hoveredRowIndex: -1}) } @@ -95,12 +95,12 @@ class TableGraph extends Component { } } -const {arrayOf, number, shape, func} = PropTypes +const {arrayOf, number, shape, string, func} = PropTypes TableGraph.propTypes = { cellHeight: number, data: arrayOf(shape()), - hoverTime: number, + hoverTime: string, onSetHoverTime: func, }