Correct QueryConfig to Query type in Visualization & VisView
parent
a900224f95
commit
1d3df7ae10
|
@ -4,12 +4,12 @@ import Table from './Table'
|
|||
import RefreshingGraph from 'src/shared/components/RefreshingGraph'
|
||||
import {DEFAULT_LINE_COLORS} from 'src/shared/constants/graphColorPalettes'
|
||||
|
||||
import {QueryConfig, Template} from 'src/types'
|
||||
import {Query, Template} from 'src/types'
|
||||
|
||||
interface Props {
|
||||
view: string
|
||||
query?: QueryConfig
|
||||
queries: QueryConfig[]
|
||||
query?: Query
|
||||
queries: Query[]
|
||||
templates: Template[]
|
||||
autoRefresh: number
|
||||
editQueryStatus: () => void
|
||||
|
|
|
@ -9,7 +9,7 @@ import {GRAPH, TABLE} from 'src/shared/constants'
|
|||
import buildQueries from 'src/utils/buildQueriesForGraphs'
|
||||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||
|
||||
import {Source, QueryConfig, Template, TimeRange} from 'src/types'
|
||||
import {Source, Query, QueryConfig, Template, TimeRange} from 'src/types'
|
||||
|
||||
const META_QUERY_REGEX = /^(show|create|drop)/i
|
||||
|
||||
|
@ -101,12 +101,12 @@ class DataExplorerVisualization extends PureComponent<Props, State> {
|
|||
})
|
||||
}
|
||||
|
||||
private get queries(): QueryConfig[] {
|
||||
private get queries(): Query[] {
|
||||
const {source, queryConfigs, timeRange} = this.props
|
||||
return buildQueries(source.links.proxy, queryConfigs, timeRange)
|
||||
}
|
||||
|
||||
private get query(): QueryConfig {
|
||||
private get query(): Query {
|
||||
const {activeQueryIndex} = this.props
|
||||
const activeQuery = this.queries[activeQueryIndex]
|
||||
const defaultQuery = this.queries[0]
|
||||
|
|
|
@ -117,7 +117,6 @@ const AutoRefresh = (
|
|||
queries,
|
||||
resolution,
|
||||
templates,
|
||||
// TODO: how is sourceLink being used? or do we need to be setting db & rp on query?
|
||||
editQueryStatus
|
||||
)
|
||||
const newSeries = timeSeries.map((response: TimeSeriesResponse) => ({
|
||||
|
|
|
@ -2,6 +2,7 @@ import {AuthLinks, Organization, Role, User, Me} from './auth'
|
|||
import {Template, Cell, CellQuery, Legend, Axes} from './dashboard'
|
||||
import {
|
||||
GroupBy,
|
||||
Query,
|
||||
QueryConfig,
|
||||
Status,
|
||||
TimeRange,
|
||||
|
@ -31,6 +32,7 @@ export {
|
|||
CellQuery,
|
||||
Legend,
|
||||
Status,
|
||||
Query,
|
||||
QueryConfig,
|
||||
TimeShift,
|
||||
ApplyFuncsToFieldArgs,
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
import {Source} from 'src/types'
|
||||
|
||||
export interface Query {
|
||||
host: string[]
|
||||
text: string
|
||||
id: string
|
||||
queryConfig: QueryConfig
|
||||
}
|
||||
|
||||
export interface QueryConfig {
|
||||
id?: string
|
||||
database?: string
|
||||
|
|
|
@ -2,7 +2,7 @@ import _ from 'lodash'
|
|||
import {buildQuery} from 'src/utils/influxql'
|
||||
import {TYPE_QUERY_CONFIG, TYPE_SHIFTED} from 'src/dashboards/constants'
|
||||
|
||||
import {QueryConfig, TimeRange} from 'src/types'
|
||||
import {Query, QueryConfig, TimeRange} from 'src/types'
|
||||
|
||||
interface Statement {
|
||||
queryConfig: QueryConfig
|
||||
|
@ -10,19 +10,12 @@ interface Statement {
|
|||
text: string
|
||||
}
|
||||
|
||||
interface Query {
|
||||
host: string[]
|
||||
text: string
|
||||
id: string
|
||||
queryConfig: QueryConfig
|
||||
}
|
||||
|
||||
const buildQueries = (
|
||||
proxy: string,
|
||||
queryConfigs: QueryConfig[],
|
||||
tR: TimeRange
|
||||
): Query[] => {
|
||||
const statements: Statement[] = queryConfigs.map(query => {
|
||||
const statements: Statement[] = queryConfigs.map((query: QueryConfig) => {
|
||||
const {rawText, range, id, shifts, database, measurement, fields} = query
|
||||
const timeRange: TimeRange = range || tR
|
||||
const text: string =
|
||||
|
|
Loading…
Reference in New Issue