Stop passing around queryASTs
parent
7d270d65ab
commit
5131b2cdd1
|
@ -259,8 +259,6 @@ class CellEditorOverlay extends Component {
|
|||
timeRange,
|
||||
autoRefresh,
|
||||
editQueryStatus,
|
||||
onNewQueryAST,
|
||||
queryASTs,
|
||||
} = this.props
|
||||
|
||||
const {
|
||||
|
@ -300,7 +298,6 @@ class CellEditorOverlay extends Component {
|
|||
queryConfigs={queriesWorkingDraft}
|
||||
editQueryStatus={editQueryStatus}
|
||||
staticLegend={staticLegend}
|
||||
onNewQueryAST={onNewQueryAST}
|
||||
/>
|
||||
<CEOBottom>
|
||||
<OverlayControls
|
||||
|
@ -317,7 +314,6 @@ class CellEditorOverlay extends Component {
|
|||
{isDisplayOptionsTabActive ? (
|
||||
<DisplayOptions
|
||||
queryConfigs={queriesWorkingDraft}
|
||||
queryASTs={queryASTs}
|
||||
onToggleStaticLegend={this.handleToggleStaticLegend}
|
||||
staticLegend={staticLegend}
|
||||
onResetFocus={this.handleResetFocus}
|
||||
|
@ -382,8 +378,6 @@ CellEditorOverlay.propTypes = {
|
|||
thresholdsListColors: colorsNumberSchema.isRequired,
|
||||
gaugeColors: colorsNumberSchema.isRequired,
|
||||
lineColors: colorsStringSchema.isRequired,
|
||||
onNewQueryAST: func,
|
||||
queryASTs: arrayOf(shape()),
|
||||
}
|
||||
|
||||
CEOBottom.propTypes = {
|
||||
|
|
|
@ -26,8 +26,6 @@ const Dashboard = ({
|
|||
showTemplateControlBar,
|
||||
setScrollTop,
|
||||
inView,
|
||||
queryASTs,
|
||||
onNewQueryAST,
|
||||
}) => {
|
||||
const cells = dashboard.cells.map(cell => {
|
||||
const dashboardCell = {
|
||||
|
@ -73,8 +71,6 @@ const Dashboard = ({
|
|||
onPositionChange={onPositionChange}
|
||||
templates={templatesIncludingDashTime}
|
||||
onSummonOverlayTechnologies={onSummonOverlayTechnologies}
|
||||
queryASTs={queryASTs}
|
||||
onNewQueryAST={onNewQueryAST}
|
||||
/>
|
||||
) : (
|
||||
<div className="dashboard__empty">
|
||||
|
@ -134,8 +130,6 @@ Dashboard.propTypes = {
|
|||
onZoom: func,
|
||||
setScrollTop: func,
|
||||
inView: func,
|
||||
onNewQueryAST: func,
|
||||
queryASTs: arrayOf(shape()),
|
||||
}
|
||||
|
||||
export default Dashboard
|
||||
|
|
|
@ -43,7 +43,6 @@ class DisplayOptions extends Component {
|
|||
onToggleStaticLegend,
|
||||
onResetFocus,
|
||||
queryConfigs,
|
||||
queryASTs,
|
||||
} = this.props
|
||||
switch (type) {
|
||||
case 'gauge':
|
||||
|
@ -55,7 +54,6 @@ class DisplayOptions extends Component {
|
|||
<TableOptions
|
||||
onResetFocus={onResetFocus}
|
||||
queryConfigs={queryConfigs}
|
||||
queryASTs={queryASTs}
|
||||
/>
|
||||
)
|
||||
default:
|
||||
|
@ -95,7 +93,6 @@ DisplayOptions.propTypes = {
|
|||
onToggleStaticLegend: func.isRequired,
|
||||
staticLegend: bool,
|
||||
onResetFocus: func.isRequired,
|
||||
queryASTs: arrayOf(shape()),
|
||||
}
|
||||
|
||||
const mapStateToProps = ({cellEditorOverlay: {cell, cell: {axes}}}) => ({
|
||||
|
|
|
@ -66,7 +66,6 @@ interface QueryAST {
|
|||
|
||||
interface Props {
|
||||
queryConfigs: QueryConfig[]
|
||||
queryASTs: QueryAST[]
|
||||
handleUpdateTableOptions: (options: Options) => void
|
||||
tableOptions: Options
|
||||
onResetFocus: () => void
|
||||
|
@ -173,17 +172,13 @@ export class TableOptions extends PureComponent<Props, {}> {
|
|||
// }
|
||||
|
||||
private moveField(dragIndex, hoverIndex) {
|
||||
const {handleUpdateTableOptions, tableOptions, queryASTs} = this.props
|
||||
const {handleUpdateTableOptions, tableOptions} = this.props
|
||||
const {fieldNames} = tableOptions
|
||||
const fields =
|
||||
fieldNames.length > 1
|
||||
? fieldNames
|
||||
: computeFieldNames(fieldNames, queryASTs)
|
||||
|
||||
const dragField = fields[dragIndex]
|
||||
const dragField = fieldNames[dragIndex]
|
||||
const removedFields = _.concat(
|
||||
_.slice(fields, 0, dragIndex),
|
||||
_.slice(fields, dragIndex + 1)
|
||||
_.slice(fieldNames, 0, dragIndex),
|
||||
_.slice(fieldNames, dragIndex + 1)
|
||||
)
|
||||
const addedFields = _.concat(
|
||||
_.slice(removedFields, 0, hoverIndex),
|
||||
|
|
|
@ -24,7 +24,6 @@ const DashVisualization = (
|
|||
staticLegend,
|
||||
thresholdsListColors,
|
||||
tableOptions,
|
||||
onNewQueryAST,
|
||||
},
|
||||
{source: {links: {proxy}}}
|
||||
) => {
|
||||
|
@ -50,7 +49,6 @@ const DashVisualization = (
|
|||
editQueryStatus={editQueryStatus}
|
||||
resizerTopHeight={resizerTopHeight}
|
||||
staticLegend={staticLegend}
|
||||
onNewQueryAST={onNewQueryAST}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -80,7 +78,6 @@ DashVisualization.propTypes = {
|
|||
gaugeColors: colorsNumberSchema,
|
||||
lineColors: colorsStringSchema,
|
||||
staticLegend: bool,
|
||||
onNewQueryAST: func,
|
||||
}
|
||||
|
||||
DashVisualization.contextTypes = {
|
||||
|
|
|
@ -57,7 +57,6 @@ class DashboardPage extends Component {
|
|||
zoomedTimeRange: {zoomedLower: null, zoomedUpper: null},
|
||||
scrollTop: 0,
|
||||
windowHeight: window.innerHeight,
|
||||
queryASTs: [],
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,10 +280,6 @@ class DashboardPage extends Component {
|
|||
this.props.errorThrown(error)
|
||||
}
|
||||
|
||||
handleQueryAST = queryASTs => {
|
||||
this.setState({queryASTs})
|
||||
}
|
||||
|
||||
handleToggleTempVarControls = () => {
|
||||
this.props.templateControlBarVisibilityToggled()
|
||||
}
|
||||
|
@ -298,7 +293,7 @@ class DashboardPage extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const {zoomedTimeRange, queryASTs} = this.state
|
||||
const {zoomedTimeRange} = this.state
|
||||
const {zoomedLower, zoomedUpper} = zoomedTimeRange
|
||||
const {
|
||||
source,
|
||||
|
@ -376,7 +371,6 @@ class DashboardPage extends Component {
|
|||
name: d.name,
|
||||
link: `/sources/${sourceID}/dashboards/${d.id}`,
|
||||
}))
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
{isTemplating ? (
|
||||
|
@ -407,8 +401,6 @@ class DashboardPage extends Component {
|
|||
thresholdsListColors={thresholdsListColors}
|
||||
gaugeColors={gaugeColors}
|
||||
lineColors={lineColors}
|
||||
queryASTs={queryASTs}
|
||||
onNewQueryAST={this.handleQueryAST}
|
||||
/>
|
||||
) : null}
|
||||
<DashboardHeader
|
||||
|
@ -454,8 +446,6 @@ class DashboardPage extends Component {
|
|||
onOpenTemplateManager={this.handleOpenTemplateManager}
|
||||
templatesIncludingDashTime={templatesIncludingDashTime}
|
||||
onSummonOverlayTechnologies={handleShowCellEditorOverlay}
|
||||
queryASTs={queryASTs}
|
||||
onNewQueryAST={this.handleQueryAST}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
|
|
|
@ -20,11 +20,10 @@ const AutoRefresh = ComposedComponent => {
|
|||
}
|
||||
|
||||
async componentDidMount() {
|
||||
const {queries, templates, autoRefresh, onNewQueryAST} = this.props
|
||||
const {queries, templates, autoRefresh} = this.props
|
||||
this.executeQueries(queries, templates)
|
||||
if (onNewQueryAST) {
|
||||
if (true) {
|
||||
const queryASTs = await this.getQueryASTs(queries, templates)
|
||||
onNewQueryAST(queryASTs)
|
||||
this.setState({queryASTs})
|
||||
}
|
||||
if (autoRefresh) {
|
||||
|
@ -64,12 +63,11 @@ const AutoRefresh = ComposedComponent => {
|
|||
queriesDidUpdate || tempVarsDidUpdate || inViewDidUpdate
|
||||
|
||||
if (shouldRefetch) {
|
||||
if (nextProps.onNewQueryAST) {
|
||||
if (true) {
|
||||
const queryASTs = await this.getQueryASTs(
|
||||
nextProps.queries,
|
||||
nextProps.templates
|
||||
)
|
||||
nextProps.onNewQueryAST(queryASTs)
|
||||
this.setState({queryASTs})
|
||||
}
|
||||
|
||||
|
@ -281,7 +279,6 @@ const AutoRefresh = ComposedComponent => {
|
|||
}),
|
||||
editQueryStatus: func,
|
||||
grabDataForDownload: func,
|
||||
onNewQueryAST: func,
|
||||
}
|
||||
|
||||
return wrapper
|
||||
|
|
|
@ -61,8 +61,6 @@ const Layout = (
|
|||
onStopAddAnnotation,
|
||||
onSummonOverlayTechnologies,
|
||||
grabDataForDownload,
|
||||
queryASTs,
|
||||
onNewQueryAST,
|
||||
},
|
||||
{source: defaultSource}
|
||||
) => (
|
||||
|
@ -96,8 +94,6 @@ const Layout = (
|
|||
onStopAddAnnotation={onStopAddAnnotation}
|
||||
grabDataForDownload={grabDataForDownload}
|
||||
resizeCoords={resizeCoords}
|
||||
queryASTs={queryASTs}
|
||||
onNewQueryAST={onNewQueryAST}
|
||||
queries={buildQueriesForLayouts(
|
||||
cell,
|
||||
getSource(cell, source, sources, defaultSource),
|
||||
|
@ -158,8 +154,6 @@ const propTypes = {
|
|||
resizeCoords: shape(),
|
||||
onZoom: func,
|
||||
sources: arrayOf(shape()),
|
||||
onNewQueryAST: func,
|
||||
queryASTs: arrayOf(shape()),
|
||||
}
|
||||
|
||||
LayoutState.propTypes = {...propTypes}
|
||||
|
|
|
@ -75,8 +75,6 @@ class LayoutRenderer extends Component {
|
|||
onCloneCell,
|
||||
onCancelEditCell,
|
||||
onSummonOverlayTechnologies,
|
||||
queryASTs,
|
||||
onNewQueryAST,
|
||||
} = this.props
|
||||
|
||||
const {rowHeight, resizeCoords} = this.state
|
||||
|
@ -136,8 +134,6 @@ class LayoutRenderer extends Component {
|
|||
onCancelEditCell={onCancelEditCell}
|
||||
onStopAddAnnotation={this.handleStopAddAnnotation}
|
||||
onSummonOverlayTechnologies={onSummonOverlayTechnologies}
|
||||
queryASTs={queryASTs}
|
||||
onNewQueryAST={onNewQueryAST}
|
||||
/>
|
||||
</Authorized>
|
||||
</div>
|
||||
|
@ -194,8 +190,6 @@ LayoutRenderer.propTypes = {
|
|||
onCancelEditCell: func,
|
||||
onZoom: func,
|
||||
sources: arrayOf(shape({})),
|
||||
onNewQueryAST: func,
|
||||
queryASTs: arrayOf(shape()),
|
||||
}
|
||||
|
||||
export default LayoutRenderer
|
||||
|
|
|
@ -40,7 +40,6 @@ const RefreshingGraph = ({
|
|||
editQueryStatus,
|
||||
handleSetHoverTime,
|
||||
grabDataForDownload,
|
||||
onNewQueryAST,
|
||||
}) => {
|
||||
const prefix = (axes && axes.y.prefix) || ''
|
||||
const suffix = (axes && axes.y.suffix) || ''
|
||||
|
@ -102,7 +101,6 @@ const RefreshingGraph = ({
|
|||
cellHeight={cellHeight}
|
||||
resizeCoords={resizeCoords}
|
||||
tableOptions={tableOptions}
|
||||
onNewQueryAST={onNewQueryAST}
|
||||
resizerTopHeight={resizerTopHeight}
|
||||
handleSetHoverTime={handleSetHoverTime}
|
||||
/>
|
||||
|
@ -161,8 +159,6 @@ RefreshingGraph.propTypes = {
|
|||
cellID: string,
|
||||
inView: bool,
|
||||
tableOptions: shape({}),
|
||||
onNewQueryAST: func,
|
||||
queryASTs: arrayOf(shape()),
|
||||
hoverTime: string.isRequired,
|
||||
handleSetHoverTime: func.isRequired,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue