QueryEditor: Clean-up interface to only have one PanelData (#19249)

* QueryEditor: Clean-up interface to only have one PanelData

* Renamed to prop name to data
This commit is contained in:
Torkel Ödegaard
2019-09-23 11:13:33 +02:00
committed by GitHub
parent fd7e2a21a1
commit bbf2bd18fd
9 changed files with 32 additions and 39 deletions

View File

@@ -33,7 +33,7 @@ interface State {
datasource: DataSourceApi | null;
isCollapsed: boolean;
hasTextEditMode: boolean;
queryResponse?: PanelData;
data?: PanelData;
}
export class QueryEditorRow extends PureComponent<Props, State> {
@@ -46,7 +46,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
isCollapsed: false,
loadedDataSourceValue: undefined,
hasTextEditMode: false,
queryResponse: null,
data: null,
};
componentDidMount() {
@@ -92,7 +92,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
const { data, query, panel } = this.props;
if (data !== prevProps.data) {
this.setState({ queryResponse: filterPanelDataToQuery(data, query.refId) });
this.setState({ data: filterPanelDataToQuery(data, query.refId) });
if (this.angularScope) {
this.angularScope.range = getTimeSrv().timeRange();
@@ -133,8 +133,8 @@ export class QueryEditorRow extends PureComponent<Props, State> {
};
renderPluginEditor() {
const { query, data, onChange } = this.props;
const { datasource, queryResponse } = this.state;
const { query, onChange } = this.props;
const { datasource, data } = this.state;
if (datasource.components.QueryCtrl) {
return <div ref={element => (this.element = element)} />;
@@ -149,8 +149,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
datasource={datasource}
onChange={onChange}
onRunQuery={this.onRunQuery}
queryResponse={queryResponse}
panelData={data}
data={data}
/>
);
}