From 1a1b077a907585e9a9581a285a2f713723f3dfd6 Mon Sep 17 00:00:00 2001 From: Andrew Watkins Date: Mon, 31 Jul 2017 14:00:54 -0700 Subject: [PATCH] Remove axes normalizer With the `bounds` returning from the backend and the values saved as strings there's no longer a need to normalize cell state. --- .../components/CellEditorOverlay.js | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/ui/src/dashboards/components/CellEditorOverlay.js b/ui/src/dashboards/components/CellEditorOverlay.js index 001aa5fa01..ae97b8d837 100644 --- a/ui/src/dashboards/components/CellEditorOverlay.js +++ b/ui/src/dashboards/components/CellEditorOverlay.js @@ -34,7 +34,6 @@ class CellEditorOverlay extends Component { this.handleSetActiveQueryIndex = ::this.handleSetActiveQueryIndex this.handleEditRawText = ::this.handleEditRawText this.handleSetRange = ::this.handleSetRange - this.normalizeAxes = ::this.normalizeAxes const {cell: {name, type, queries, axes}} = props @@ -82,7 +81,6 @@ class CellEditorOverlay extends Component { handleSetRange(e) { const {min, max} = e.target.form - // TODO: handle "" for min and max value this.setState({ axes: { y: { @@ -111,10 +109,10 @@ class CellEditorOverlay extends Component { queriesWorkingDraft, cellWorkingType: type, cellWorkingName: name, + axes, } = this.state const {cell} = this.props - const axes = this.normalizeAxes() const queries = queriesWorkingDraft.map(q => { const timeRange = q.range || {upper: null, lower: ':dashboardTime:'} @@ -137,22 +135,6 @@ class CellEditorOverlay extends Component { }) } - normalizeAxes() { - const axes = this.state.axes - const bounds = _.get(axes, ['y', 'bounds'], false) - if (!bounds && !bounds.length) { - return {...axes, y: {bounds: []}} - } - - const [min, max] = bounds - if (min === '' || max === '') { - // TODO: throw requirement error - return - } - - return {...axes, y: {bounds: [+min, +max]}} - } - handleSelectGraphType(graphType) { this.setState({cellWorkingType: graphType}) }