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