Merge pull request #4471 from influxdata/polish/fix-various-errors
Fix various errors with data explorerpull/4461/head
commit
f44b9fcb4d
|
@ -513,7 +513,7 @@ export class DataExplorer extends PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
private async createNewQueryDraft() {
|
||||
const {source, loadDE, timeRange} = this.props
|
||||
const {source, loadDE, timeRange, sourceLink} = this.props
|
||||
|
||||
const {query} = this.queryString
|
||||
const queryConfig = await getConfig(
|
||||
|
@ -523,13 +523,25 @@ export class DataExplorer extends PureComponent<Props, State> {
|
|||
this.templates
|
||||
)
|
||||
|
||||
const queryDraft = {
|
||||
query,
|
||||
queryConfig,
|
||||
source: source.links.self,
|
||||
type: QueryType.InfluxQL,
|
||||
const isFlux = !!this.service
|
||||
|
||||
if (isFlux) {
|
||||
const queryDraft = {
|
||||
query,
|
||||
queryConfig,
|
||||
source: sourceLink,
|
||||
type: QueryType.Flux,
|
||||
}
|
||||
loadDE([queryDraft], timeRange)
|
||||
} else {
|
||||
const queryDraft = {
|
||||
query,
|
||||
queryConfig,
|
||||
source: source.links.self,
|
||||
type: QueryType.InfluxQL,
|
||||
}
|
||||
loadDE([queryDraft], timeRange)
|
||||
}
|
||||
loadDE([queryDraft], timeRange)
|
||||
}
|
||||
|
||||
private get activeScript(): string {
|
||||
|
|
|
@ -37,7 +37,7 @@ import {
|
|||
const {lower, upper} = timeRanges.find(tr => tr.lower === 'now() - 1h')
|
||||
|
||||
export const initialState: DEState = {
|
||||
queryDrafts: null,
|
||||
queryDrafts: [],
|
||||
timeRange: {lower, upper},
|
||||
queryStatus: {queryID: null, status: null},
|
||||
script: editor.DEFAULT_SCRIPT,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {PureComponent, ReactElement, MouseEvent} from 'react'
|
||||
import React, {PureComponent, MouseEvent} from 'react'
|
||||
import FuncArg from 'src/flux/components/FuncArg'
|
||||
import {OnChangeArg} from 'src/types/flux'
|
||||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||
|
@ -32,7 +32,6 @@ export default class FuncArgs extends PureComponent<Props> {
|
|||
<div className="func-node--editor" onClick={onStopPropagation}>
|
||||
<div className="func-node--connector" />
|
||||
<div className="func-args">{this.renderArguments}</div>
|
||||
<div className="func-arg--buttons">{this.build}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -136,20 +135,4 @@ export default class FuncArgs extends PureComponent<Props> {
|
|||
/>
|
||||
)
|
||||
}
|
||||
|
||||
private get build(): ReactElement<HTMLDivElement> {
|
||||
const {func, onGenerateScript} = this.props
|
||||
if (func.name === funcNames.FILTER) {
|
||||
return (
|
||||
<div
|
||||
className="btn btn-sm btn-primary func-node--build"
|
||||
onClick={onGenerateScript}
|
||||
>
|
||||
Build
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,5 +59,4 @@ export const EXCLUDED_KEYS = [
|
|||
' ',
|
||||
]
|
||||
|
||||
export const DEFAULT_SCRIPT =
|
||||
'from(bucket: "pick a bucket")\n\t|> filter(fn: (r) => r._measurement == "your value here")\n\t|> range(start: -1m)\n\t|> yield(name: "Results")\n\n'
|
||||
export const DEFAULT_SCRIPT = ''
|
||||
|
|
|
@ -159,7 +159,7 @@ const findNext = (s: string, t: string, startIndex: number) => {
|
|||
}
|
||||
|
||||
const replaceAll = (query: string, search: string, replacement: string) => {
|
||||
return query.split(search).join(replacement)
|
||||
return (query || '').split(search).join(replacement)
|
||||
}
|
||||
|
||||
export const templateInternalReplace = (template: Template): string => {
|
||||
|
|
Loading…
Reference in New Issue