Remove concept of host from query object
parent
4305835299
commit
a724fdade9
|
@ -1,6 +1,5 @@
|
||||||
import React, {SFC} from 'react'
|
import React, {SFC} from 'react'
|
||||||
import {connect} from 'react-redux'
|
import {connect} from 'react-redux'
|
||||||
import _ from 'lodash'
|
|
||||||
|
|
||||||
import RefreshingGraph from 'src/shared/components/RefreshingGraph'
|
import RefreshingGraph from 'src/shared/components/RefreshingGraph'
|
||||||
import buildQueries from 'src/utils/buildQueriesForGraphs'
|
import buildQueries from 'src/utils/buildQueriesForGraphs'
|
||||||
|
@ -76,11 +75,7 @@ const DashVisualization: SFC<Props> = ({
|
||||||
axes={axes}
|
axes={axes}
|
||||||
type={type}
|
type={type}
|
||||||
tableOptions={tableOptions}
|
tableOptions={tableOptions}
|
||||||
queries={buildQueries(
|
queries={buildQueries(queryConfigs, timeRange)}
|
||||||
_.get(source, 'links.proxy'),
|
|
||||||
queryConfigs,
|
|
||||||
timeRange
|
|
||||||
)}
|
|
||||||
templates={templates}
|
templates={templates}
|
||||||
autoRefresh={autoRefresh}
|
autoRefresh={autoRefresh}
|
||||||
editQueryStatus={editQueryStatus}
|
editQueryStatus={editQueryStatus}
|
||||||
|
|
|
@ -102,8 +102,8 @@ class DataExplorerVisualization extends PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private get queries(): Query[] {
|
private get queries(): Query[] {
|
||||||
const {source, queryConfigs, timeRange} = this.props
|
const {queryConfigs, timeRange} = this.props
|
||||||
return buildQueries(source.links.proxy, queryConfigs, timeRange)
|
return buildQueries(queryConfigs, timeRange)
|
||||||
}
|
}
|
||||||
|
|
||||||
private get query(): Query {
|
private get query(): Query {
|
||||||
|
|
|
@ -14,7 +14,6 @@ interface Axes {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Query {
|
interface Query {
|
||||||
host: string | string[]
|
|
||||||
text: string
|
text: string
|
||||||
database: string
|
database: string
|
||||||
db: string
|
db: string
|
||||||
|
@ -212,7 +211,7 @@ const AutoRefresh = (
|
||||||
}
|
}
|
||||||
|
|
||||||
private queryDifference = (left, right) => {
|
private queryDifference = (left, right) => {
|
||||||
const mapper = q => `${q.host}${q.text}`
|
const mapper = q => `${q.text}`
|
||||||
const leftStrs = left.map(mapper)
|
const leftStrs = left.map(mapper)
|
||||||
const rightStrs = right.map(mapper)
|
const rightStrs = right.map(mapper)
|
||||||
return _.difference(
|
return _.difference(
|
||||||
|
|
|
@ -98,32 +98,27 @@ const Layout = (
|
||||||
<WidgetCell cell={cell} timeRange={timeRange} source={source} />
|
<WidgetCell cell={cell} timeRange={timeRange} source={source} />
|
||||||
) : (
|
) : (
|
||||||
<RefreshingGraph
|
<RefreshingGraph
|
||||||
colors={colors}
|
|
||||||
inView={cell.inView}
|
|
||||||
axes={axes}
|
axes={axes}
|
||||||
type={type}
|
type={type}
|
||||||
isDragging={isDragging}
|
|
||||||
tableOptions={tableOptions}
|
|
||||||
fieldOptions={fieldOptions}
|
|
||||||
timeFormat={timeFormat}
|
|
||||||
decimalPlaces={decimalPlaces}
|
|
||||||
staticLegend={IS_STATIC_LEGEND(legend)}
|
|
||||||
cellHeight={h}
|
cellHeight={h}
|
||||||
onZoom={onZoom}
|
onZoom={onZoom}
|
||||||
|
colors={colors}
|
||||||
sources={sources}
|
sources={sources}
|
||||||
|
inView={cell.inView}
|
||||||
timeRange={timeRange}
|
timeRange={timeRange}
|
||||||
templates={templates}
|
templates={templates}
|
||||||
|
isDragging={isDragging}
|
||||||
|
timeFormat={timeFormat}
|
||||||
autoRefresh={autoRefresh}
|
autoRefresh={autoRefresh}
|
||||||
|
tableOptions={tableOptions}
|
||||||
|
fieldOptions={fieldOptions}
|
||||||
|
decimalPlaces={decimalPlaces}
|
||||||
manualRefresh={manualRefresh}
|
manualRefresh={manualRefresh}
|
||||||
|
onSetResolution={onSetResolution}
|
||||||
|
staticLegend={IS_STATIC_LEGEND(legend)}
|
||||||
onStopAddAnnotation={onStopAddAnnotation}
|
onStopAddAnnotation={onStopAddAnnotation}
|
||||||
grabDataForDownload={grabDataForDownload}
|
grabDataForDownload={grabDataForDownload}
|
||||||
queries={buildQueriesForLayouts(
|
queries={buildQueriesForLayouts(cell, timeRange, host)}
|
||||||
cell,
|
|
||||||
getSource(cell, source, sources, defaultSource),
|
|
||||||
timeRange,
|
|
||||||
host
|
|
||||||
)}
|
|
||||||
onSetResolution={onSetResolution}
|
|
||||||
source={getSource(cell, source, sources, defaultSource)}
|
source={getSource(cell, source, sources, defaultSource)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -132,10 +127,6 @@ const Layout = (
|
||||||
|
|
||||||
const {arrayOf, bool, func, number, shape, string} = PropTypes
|
const {arrayOf, bool, func, number, shape, string} = PropTypes
|
||||||
|
|
||||||
Layout.contextTypes = {
|
|
||||||
source: shape(),
|
|
||||||
}
|
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
isDragging: bool,
|
isDragging: bool,
|
||||||
autoRefresh: number.isRequired,
|
autoRefresh: number.isRequired,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {Source} from 'src/types'
|
import {Source} from 'src/types'
|
||||||
|
|
||||||
export interface Query {
|
export interface Query {
|
||||||
host: string[] // doesn't come from server - is set in buildQueriesForGraphs
|
|
||||||
text: string
|
text: string
|
||||||
id: string
|
id: string
|
||||||
queryConfig: QueryConfig
|
queryConfig: QueryConfig
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import {getDeep} from 'src/utils/wrappers'
|
|
||||||
import {buildQuery} from 'src/utils/influxql'
|
import {buildQuery} from 'src/utils/influxql'
|
||||||
import {TYPE_QUERY_CONFIG, TYPE_SHIFTED} from 'src/dashboards/constants'
|
import {TYPE_QUERY_CONFIG, TYPE_SHIFTED} from 'src/dashboards/constants'
|
||||||
|
|
||||||
|
@ -11,11 +10,7 @@ interface Statement {
|
||||||
text: string
|
text: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildQueries = (
|
const buildQueries = (queryConfigs: QueryConfig[], tR: TimeRange): Query[] => {
|
||||||
proxy: string,
|
|
||||||
queryConfigs: QueryConfig[],
|
|
||||||
tR: TimeRange
|
|
||||||
): Query[] => {
|
|
||||||
const statements: Statement[] = queryConfigs.map((query: QueryConfig) => {
|
const statements: Statement[] = queryConfigs.map((query: QueryConfig) => {
|
||||||
const {rawText, range, id, shifts, database, measurement, fields} = query
|
const {rawText, range, id, shifts, database, measurement, fields} = query
|
||||||
const timeRange: TimeRange = range || tR
|
const timeRange: TimeRange = range || tR
|
||||||
|
@ -42,11 +37,7 @@ const buildQueries = (
|
||||||
const queries: Query[] = statements
|
const queries: Query[] = statements
|
||||||
.filter(s => s.text !== null)
|
.filter(s => s.text !== null)
|
||||||
.map(({queryConfig, text, id}) => {
|
.map(({queryConfig, text, id}) => {
|
||||||
const queryProxy = getDeep<string>(queryConfig, 'source.links.proxy', '')
|
|
||||||
const host: string[] = [queryProxy || proxy]
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
host,
|
|
||||||
text,
|
text,
|
||||||
id,
|
id,
|
||||||
queryConfig,
|
queryConfig,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
} from 'src/shared/constants'
|
} from 'src/shared/constants'
|
||||||
import {timeRanges} from 'src/shared/data/timeRanges'
|
import {timeRanges} from 'src/shared/data/timeRanges'
|
||||||
|
|
||||||
import {Cell, CellQuery, LayoutQuery, Source, TimeRange} from 'src/types'
|
import {Cell, CellQuery, LayoutQuery, TimeRange} from 'src/types'
|
||||||
|
|
||||||
const buildCannedDashboardQuery = (
|
const buildCannedDashboardQuery = (
|
||||||
query: LayoutQuery | CellQuery,
|
query: LayoutQuery | CellQuery,
|
||||||
|
@ -84,7 +84,6 @@ const addTimeBoundsToRawText = (rawText: string): string => {
|
||||||
|
|
||||||
export const buildQueriesForLayouts = (
|
export const buildQueriesForLayouts = (
|
||||||
cell: Cell,
|
cell: Cell,
|
||||||
source: Source,
|
|
||||||
timeRange: TimeRange,
|
timeRange: TimeRange,
|
||||||
host: string
|
host: string
|
||||||
): CellQuery[] => {
|
): CellQuery[] => {
|
||||||
|
@ -117,6 +116,6 @@ export const buildQueriesForLayouts = (
|
||||||
queryText = buildCannedDashboardQuery(query, timeRange, host)
|
queryText = buildCannedDashboardQuery(query, timeRange, host)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {...query, host: source.links.proxy, text: queryText}
|
return {...query, text: queryText}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue