@@ -7,15 +7,16 @@ import {isEqual} from 'lodash'
77// API
88import { runQuery , RunQueryResult } from 'src/shared/apis/query'
99
10+ // Selectors
11+ import { getOrg } from 'src/organizations/selectors'
12+ import { getStartTime , getEndTime } from 'src/timeMachine/selectors/index'
13+ import { getAllVariablesForZoomRequery } from 'src/variables/selectors'
14+
1015// Utils
1116import { useOneWayState } from 'src/shared/utils/useOneWayState'
1217import { extent } from 'src/shared/utils/vis'
13- import { getStartTime , getEndTime } from 'src/timeMachine/selectors/index'
14- import { getOrg } from 'src/organizations/selectors'
15- import { getAllVariablesForZoomRequery } from 'src/variables/selectors'
1618import { buildUsedVarsOption } from 'src/variables/utils/buildVarsOption'
1719import { event } from 'src/cloud/utils/reporting'
18-
1920import {
2021 getWindowPeriodFromVariables ,
2122 getWindowVarsFromVariables ,
@@ -26,6 +27,7 @@ import {
2627// Types
2728import { AppState , InternalFromFluxResult , TimeRange } from 'src/types'
2829import { RemoteDataState } from '@influxdata/clockface'
30+
2931/*
3032 This hook helps map the domain setting stored for line graph to the
3133 appropriate settings on a @influxdata/giraffe `Config` object.
@@ -167,6 +169,7 @@ export const useZoomRequeryXDomainSettings = (args: ZoomRequeryArgs) => {
167169 timeRange = null ,
168170 } = args
169171
172+ const { type : timeRangeType } = timeRange ? timeRange : { type : 'duration' }
170173 const [ selectedTimeRange , setSelectedTimeRange ] = useState ( timeRange )
171174 const initialDomain = useMemo ( ( ) => {
172175 if ( storedDomain ) {
@@ -197,7 +200,7 @@ export const useZoomRequeryXDomainSettings = (args: ZoomRequeryArgs) => {
197200 const [ domain , setDomain ] = useState ( initialDomain )
198201
199202 const getAllVariablesWithTimeDomain = ( state : AppState ) =>
200- getAllVariablesForZoomRequery ( state , timeRange ? domain : [ ] )
203+ getAllVariablesForZoomRequery ( state , timeRange ? domain : [ ] , timeRangeType )
201204 const orgId = useSelector ( getOrg ) ?. id
202205 const variables = useSelector ( getAllVariablesWithTimeDomain )
203206
@@ -297,6 +300,7 @@ export const useZoomRequeryYDomainSettings = (args: ZoomRequeryArgs) => {
297300 timeRange = null ,
298301 } = args
299302
303+ const { type : timeRangeType } = timeRange ? timeRange : { type : 'duration' }
300304 const [ selectedTimeRange , setSelectedTimeRange ] = useState ( timeRange )
301305 const initialDomain = useMemo ( ( ) => {
302306 if (
@@ -332,7 +336,7 @@ export const useZoomRequeryYDomainSettings = (args: ZoomRequeryArgs) => {
332336 const [ domain , setDomain ] = useState ( initialDomain )
333337
334338 const getAllVariablesWithTimeDomain = ( state : AppState ) =>
335- getAllVariablesForZoomRequery ( state , timeRange ? domain : [ ] )
339+ getAllVariablesForZoomRequery ( state , timeRange ? domain : [ ] , timeRangeType )
336340 const orgId = useSelector ( getOrg ) ?. id
337341 const variables = useSelector ( getAllVariablesWithTimeDomain )
338342
0 commit comments