Merge remote-tracking branch 'origin/feature/1602-graph-bounds-setting' into feature/1602-graph-bounds-setting

pull/10616/head
Alex P 2017-08-01 14:41:02 -07:00
commit c177ee706c
4 changed files with 11 additions and 9 deletions

View File

@ -6,6 +6,7 @@
### Features ### Features
1. [#1717](https://github.com/influxdata/chronograf/pull/1717): View server generated TICKscripts 1. [#1717](https://github.com/influxdata/chronograf/pull/1717): View server generated TICKscripts
1. [#1681](https://github.com/influxdata/chronograf/pull/1681): Add the ability to select Custom Time Ranges in the Hostpages, Data Explorer, and Dashboards. 1. [#1681](https://github.com/influxdata/chronograf/pull/1681): Add the ability to select Custom Time Ranges in the Hostpages, Data Explorer, and Dashboards.
1. [#1714](https://github.com/influxdata/chronograf/pull/1714): Add ability for users to set y-axis bounds
### UI Improvements ### UI Improvements

View File

@ -17,10 +17,10 @@ describe.only('getRangeForDygraphSpec', () => {
it('does not get range when a range is provided', () => { it('does not get range when a range is provided', () => {
const timeSeries = [[date, min], [date, max], [date, mid]] const timeSeries = [[date, min], [date, max], [date, mid]]
const providedRange = [0, 4] const providedRange = ['0', '4']
const actual = getRange(timeSeries, providedRange) const actual = getRange(timeSeries, providedRange)
expect(actual).to.deep.equal(providedRange) expect(actual).to.deep.equal([0, 4])
}) })
it('gets the range for multiple timeSeries', () => { it('gets the range for multiple timeSeries', () => {

View File

@ -1,6 +1,7 @@
import React, {PropTypes} from 'react' import React, {PropTypes} from 'react'
import _ from 'lodash' import _ from 'lodash'
// TODO: add logic for for Prefix, Suffix, Scale, and Multiplier
const Ranger = ({onSetRange, axes}) => { const Ranger = ({onSetRange, axes}) => {
const min = _.get(axes, ['y', 'bounds', '0'], '') const min = _.get(axes, ['y', 'bounds', '0'], '')
const max = _.get(axes, ['y', 'bounds', '1'], '') const max = _.get(axes, ['y', 'bounds', '1'], '')
@ -9,7 +10,7 @@ const Ranger = ({onSetRange, axes}) => {
<div className="display-options--cell"> <div className="display-options--cell">
<h5 className="display-options--header">Y Axis Controls</h5> <h5 className="display-options--header">Y Axis Controls</h5>
<form autoComplete="off" style={{margin: '0 -6px'}}> <form autoComplete="off" style={{margin: '0 -6px'}}>
<div className="form-group col-sm-12"> {/*<div className="form-group col-sm-12">
<label htmlFor="prefix">Axis Title</label> <label htmlFor="prefix">Axis Title</label>
<input <input
className="form-control input-sm" className="form-control input-sm"
@ -17,7 +18,7 @@ const Ranger = ({onSetRange, axes}) => {
name="label" name="label"
id="label" id="label"
/> />
</div> </div>*/}
<div className="form-group col-sm-6"> <div className="form-group col-sm-6">
<label htmlFor="min">Min</label> <label htmlFor="min">Min</label>
<input <input
@ -42,7 +43,7 @@ const Ranger = ({onSetRange, axes}) => {
placeholder="auto" placeholder="auto"
/> />
</div> </div>
<div className="form-group col-sm-6"> {/*<div className="form-group col-sm-6">
<label htmlFor="prefix">Labels Prefix</label> <label htmlFor="prefix">Labels Prefix</label>
<input <input
className="form-control input-sm" className="form-control input-sm"
@ -73,7 +74,7 @@ const Ranger = ({onSetRange, axes}) => {
<li className="active">Linear</li> <li className="active">Linear</li>
<li>Logarithmic</li> <li>Logarithmic</li>
</ul> </ul>
</div> </div>*/}
</form> </form>
</div> </div>

View File

@ -18,9 +18,9 @@ const getRange = (
ruleValues = {value: null, rangeValue: null} ruleValues = {value: null, rangeValue: null}
) => { ) => {
const {value, rangeValue, operator} = ruleValues const {value, rangeValue, operator} = ruleValues
const [userMin, userMax] = userSelectedRange
if (userSelectedRange.length) { if (userMin && userMax) {
const [userMin, userMax] = userSelectedRange
return [considerZero(userMin), considerZero(userMax)] return [considerZero(userMin), considerZero(userMax)]
} }
@ -72,7 +72,7 @@ const getRange = (
const [min, max] = range const [min, max] = range
return [min, max] return [considerZero(userMin, min), considerZero(userMax, max)]
} }
export default getRange export default getRange