Merge pull request #4407 from influxdata/flux/error-for-dynamic-source-without-flux
Add tooltip for dynamic source that does not support fluxpull/4404/head
commit
423c0e38ac
|
@ -1,9 +1,10 @@
|
|||
// Libraries
|
||||
import React, {SFC} from 'react'
|
||||
|
||||
// Componentes
|
||||
// Components
|
||||
import SourceDropdown from 'src/flux/components/SourceDropdown'
|
||||
import {Radio} from 'src/reusable_ui'
|
||||
import QuestionMarkTooltip from 'src/shared/components/QuestionMarkTooltip'
|
||||
|
||||
// Types
|
||||
import * as QueriesModels from 'src/types/queries'
|
||||
|
@ -55,28 +56,36 @@ const SourceSelector: SFC<Props> = ({
|
|||
onChangeService={onChangeService}
|
||||
onSelectDynamicSource={onSelectDynamicSource}
|
||||
/>
|
||||
{isDynamicSourceSelected && (
|
||||
<Radio>
|
||||
<Radio.Button
|
||||
id="flux-source"
|
||||
titleText="Flux"
|
||||
value="Flux"
|
||||
onClick={toggleFlux}
|
||||
active={isFluxSource}
|
||||
disabled={!sourceSupportsFlux}
|
||||
>
|
||||
Flux
|
||||
</Radio.Button>
|
||||
<Radio.Button
|
||||
id="influxql-source"
|
||||
titleText="InfluxQL"
|
||||
value="InfluxQL"
|
||||
onClick={toggleFlux}
|
||||
active={!isFluxSource}
|
||||
disabled={!sourceSupportsFlux}
|
||||
>
|
||||
InfluxQL
|
||||
</Radio.Button>
|
||||
</Radio>
|
||||
)}
|
||||
{isDynamicSourceSelected &&
|
||||
sourceSupportsFlux && (
|
||||
<Radio>
|
||||
<Radio.Button
|
||||
id="flux-source"
|
||||
titleText="Flux"
|
||||
value="Flux"
|
||||
onClick={toggleFlux}
|
||||
active={isFluxSource}
|
||||
>
|
||||
Flux
|
||||
</Radio.Button>
|
||||
<Radio.Button
|
||||
id="influxql-source"
|
||||
titleText="InfluxQL"
|
||||
value="InfluxQL"
|
||||
onClick={toggleFlux}
|
||||
active={!isFluxSource}
|
||||
>
|
||||
InfluxQL
|
||||
</Radio.Button>
|
||||
</Radio>
|
||||
!sourceSupportsFlux && (
|
||||
<QuestionMarkTooltip
|
||||
tipID="token"
|
||||
tipContent={`<p>The current source does not support Flux.</p>`}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -405,16 +405,15 @@ class TimeMachine extends PureComponent<Props, State> {
|
|||
private get source(): Source {
|
||||
const {source, sources, queryDrafts} = this.props
|
||||
const {selectedSource, useDynamicSource} = this.state
|
||||
|
||||
if (selectedSource) {
|
||||
return selectedSource
|
||||
}
|
||||
|
||||
// return current source
|
||||
if (useDynamicSource) {
|
||||
return source
|
||||
}
|
||||
|
||||
if (selectedSource) {
|
||||
return selectedSource
|
||||
}
|
||||
|
||||
const queryDraft = _.get(queryDrafts, 0)
|
||||
const querySource = _.get(queryDraft, 'source')
|
||||
|
||||
|
|
Loading…
Reference in New Issue