feat(ui): inform about disabled Flux for v2 server
parent
04b0817ec1
commit
b445c511e0
|
@ -82,7 +82,7 @@ var (
|
|||
func hasFlux(ctx context.Context, src chronograf.Source) (bool, error) {
|
||||
// flux is always available in v2 version, but it requires v2 Token authentication (distinguished by Type)
|
||||
// and a non-empty Organization (stored in Username)
|
||||
if src.Version == "" || strings.HasPrefix(src.Version, "2.") {
|
||||
if src.Version == "" /* v2 OSS reports no version */ || strings.HasPrefix(src.Version, "2.") {
|
||||
return src.Type == chronograf.InfluxDBv2 && src.Username != "", nil
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,14 @@ interface Props {
|
|||
onChangeSource: (source: SourcesModels.Source, type: QueryType) => void
|
||||
}
|
||||
|
||||
function fluxDisabledTooltip(source: SourcesModels.Source): string {
|
||||
// if source is version 2, recommend InfluxDB v2 authentication
|
||||
if (!source.version || source.version.startsWith('2.')) {
|
||||
return 'To enable Flux modify the connection to use InfluxDB v2 Auth with an organization and a token.'
|
||||
}
|
||||
return 'The current source does not support Flux.'
|
||||
}
|
||||
|
||||
const SourceSelector: FunctionComponent<Props> = ({
|
||||
source,
|
||||
sources = [],
|
||||
|
@ -77,7 +85,7 @@ const SourceSelector: FunctionComponent<Props> = ({
|
|||
{!sourceSupportsFlux && (
|
||||
<QuestionMarkTooltip
|
||||
tipID="token"
|
||||
tipContent={`<p>The current source does not support Flux.</p>`}
|
||||
tipContent={`<p>${fluxDisabledTooltip(source)}</p>`}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
@ -233,7 +233,7 @@ class SourceStep extends PureComponent<Props, State> {
|
|||
source: {
|
||||
...source,
|
||||
type: v2 ? SOURCE_TYPE_INFLUX_V2 : SOURCE_TYPE_INFLUX_V1,
|
||||
version: v2 ? '2.x' : '1.x'
|
||||
version: v2 ? '2.x' : '1.x',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue