Add :interval: to DataExplorer

pull/2450/head
Andrew Watkins 2017-11-30 15:25:32 -08:00
parent de352b0f16
commit 80b88beaad
2 changed files with 24 additions and 4 deletions

View File

@ -8,10 +8,9 @@ import Dropdown from 'shared/components/Dropdown'
import {AUTO_GROUP_BY} from 'shared/constants'
const isInRuleBuilder = pathname => pathname.includes('alert-rules')
const isInDataExplorer = pathname => pathname.includes('data-explorer')
const getOptions = pathname =>
isInDataExplorer(pathname) || isInRuleBuilder(pathname)
isInRuleBuilder(pathname)
? groupByTimeOptions.filter(({menuOption}) => menuOption !== AUTO_GROUP_BY)
: groupByTimeOptions

View File

@ -14,7 +14,7 @@ import ResizeContainer from 'shared/components/ResizeContainer'
import OverlayTechnologies from 'shared/components/OverlayTechnologies'
import ManualRefresh from 'src/shared/components/ManualRefresh'
import {VIS_VIEWS, INITIAL_GROUP_BY_TIME} from 'shared/constants'
import {VIS_VIEWS, AUTO_GROUP_BY} from 'shared/constants'
import {MINIMUM_HEIGHTS, INITIAL_HEIGHTS} from '../constants'
import {errorThrown} from 'shared/actions/errors'
import {setAutoRefresh} from 'shared/actions/app'
@ -88,6 +88,26 @@ class DataExplorer extends Component {
const {showWriteForm} = this.state
const selectedDatabase = _.get(queryConfigs, ['0', 'database'], null)
const interval = {
id: 'interval',
type: 'autoGroupBy',
tempVar: ':interval:',
label: 'automatically determine the best group by time',
values: [
{
value: '1000', // pixels
type: 'resolution',
selected: true,
},
{
value: '3',
type: 'pointsPerPixel',
selected: true,
},
],
}
const templates = [interval]
return (
<div className="data-explorer">
@ -122,12 +142,13 @@ class DataExplorer extends Component {
actions={queryConfigActions}
timeRange={timeRange}
activeQuery={this.getActiveQuery()}
initialGroupByTime={INITIAL_GROUP_BY_TIME}
initialGroupByTime={AUTO_GROUP_BY}
/>
<Visualization
views={VIS_VIEWS}
activeQueryIndex={0}
timeRange={timeRange}
templates={templates}
autoRefresh={autoRefresh}
queryConfigs={queryConfigs}
manualRefresh={manualRefresh}