Change default global time range to past 1 hour (#1395)
* Change default global timeRange to 1 hour * Update changelogpull/10616/head
parent
e54554e8de
commit
ce12d1dce7
|
@ -11,6 +11,7 @@
|
|||
1. [#1365](https://github.com/influxdata/chronograf/pull/1365): Show red indicator on Hosts Page for an offline host
|
||||
1. [#1373](https://github.com/influxdata/chronograf/pull/1373): Re-address dashboard cell stacking contexts
|
||||
1. [#602](https://github.com/influxdata/chronograf/pull/602): Normalize terminology in app
|
||||
1. [#1395](https://github.com/influxdata/chronograf/pull/1395): Change default global time range to past 1 hour
|
||||
|
||||
## v1.2.0-beta10 [2017-04-28]
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import reducer from 'src/data_explorer/reducers/timeRange'
|
||||
|
||||
import {
|
||||
setTimeRange,
|
||||
} from 'src/data_explorer/actions/view'
|
||||
import {setTimeRange} from 'src/data_explorer/actions/view'
|
||||
|
||||
const noopAction = () => {
|
||||
return {type: 'NOOP'}
|
||||
|
@ -12,7 +10,7 @@ describe('DataExplorer.Reducers.TimeRange', () => {
|
|||
it('it sets the default timeRange', () => {
|
||||
const state = reducer(undefined, noopAction())
|
||||
const expected = {
|
||||
lower: 'now() - 15m',
|
||||
lower: 'now() - 1h',
|
||||
upper: null,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from 'lodash'
|
||||
import timeRanges from 'hson!../../shared/data/timeRanges.hson'
|
||||
|
||||
const {lower, upper} = timeRanges[1]
|
||||
const {lower, upper} = timeRanges[2]
|
||||
|
||||
const initialState = {
|
||||
dashboards: [],
|
||||
|
|
|
@ -97,10 +97,12 @@ export function editRawText(queryId, rawText) {
|
|||
}
|
||||
}
|
||||
|
||||
export function setTimeRange(range) {
|
||||
export function setTimeRange(bounds) {
|
||||
return {
|
||||
type: 'SET_TIME_RANGE',
|
||||
payload: range,
|
||||
payload: {
|
||||
bounds,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,18 @@
|
|||
import timeRanges from 'hson!../../shared/data/timeRanges.hson'
|
||||
|
||||
const initialLower = timeRanges[1].lower
|
||||
const initialUpper = timeRanges[1].upper
|
||||
const {lower, upper} = timeRanges[2]
|
||||
|
||||
const initialState = {
|
||||
upper: initialUpper,
|
||||
lower: initialLower,
|
||||
upper,
|
||||
lower,
|
||||
}
|
||||
|
||||
export default function timeRange(state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case 'SET_TIME_RANGE': {
|
||||
const {upper, lower} = action.payload
|
||||
const newState = {
|
||||
upper,
|
||||
lower,
|
||||
}
|
||||
const {bounds} = action.payload
|
||||
|
||||
return {...state, ...newState}
|
||||
return {...state, ...bounds}
|
||||
}
|
||||
}
|
||||
return state
|
||||
|
|
|
@ -45,12 +45,12 @@ export const HostPage = React.createClass({
|
|||
},
|
||||
|
||||
getInitialState() {
|
||||
const fifteenMinutesIndex = 1
|
||||
const timeRange = timeRanges[2]
|
||||
|
||||
return {
|
||||
layouts: [],
|
||||
hosts: [],
|
||||
timeRange: timeRanges[fifteenMinutesIndex],
|
||||
timeRange,
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue