mirror of
https://github.com/grafana/grafana.git
synced 2025-02-03 12:11:09 -06:00
QueryEditorRow: Fixes issue loading query editor when data source variable selected (#61927)
* QueryEditorRow: Fixes issue loading query editor when data source variable selected * Fix func name * Removed wait * restore waiting for with better check * restore waiting for with better check
This commit is contained in:
parent
a3b396854a
commit
9f7ddf1f0b
@ -19094,6 +19094,7 @@
|
||||
}
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"active",
|
||||
|
@ -6,9 +6,15 @@ import { Provider } from 'react-redux';
|
||||
import { Route, Router } from 'react-router-dom';
|
||||
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
||||
|
||||
import { DataSourceApi, DataSourceInstanceSettings, QueryEditorProps, ScopedVars, UrlQueryValue } from '@grafana/data';
|
||||
import {
|
||||
DataSourceApi,
|
||||
DataSourceInstanceSettings,
|
||||
DataSourceRef,
|
||||
QueryEditorProps,
|
||||
ScopedVars,
|
||||
UrlQueryValue,
|
||||
} from '@grafana/data';
|
||||
import { locationSearchToObject, locationService, setDataSourceSrv, setEchoSrv, config } from '@grafana/runtime';
|
||||
import { DataSourceRef } from '@grafana/schema';
|
||||
import { GrafanaContext } from 'app/core/context/GrafanaContext';
|
||||
import { GrafanaRoute } from 'app/core/navigation/GrafanaRoute';
|
||||
import { Echo } from 'app/core/services/echo/Echo';
|
||||
|
@ -63,8 +63,10 @@ interface Props<TQuery extends DataQuery> {
|
||||
}
|
||||
|
||||
interface State<TQuery extends DataQuery> {
|
||||
/** DatasourceUid or ds variable expression used to resolve current datasource */
|
||||
loadedDataSourceIdentifier?: string | null;
|
||||
datasource: DataSourceApi<TQuery> | null;
|
||||
datasourceUid?: string | null;
|
||||
hasTextEditMode: boolean;
|
||||
data?: PanelData;
|
||||
isOpen?: boolean;
|
||||
@ -238,17 +240,17 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
|
||||
}
|
||||
}
|
||||
|
||||
waitingForDatasourceToLoad = (): boolean => {
|
||||
isWaitingForDatasourceToLoad(): boolean {
|
||||
// if we not yet have loaded the datasource in state the
|
||||
// ds in props and the ds in state will have different values.
|
||||
return this.props.dataSource.uid !== this.state.datasource?.uid;
|
||||
};
|
||||
return this.props.dataSource.uid !== this.state.loadedDataSourceIdentifier;
|
||||
}
|
||||
|
||||
renderPluginEditor = () => {
|
||||
const { query, onChange, queries, onRunQuery, onAddQuery, app = CoreApp.PanelEditor, history } = this.props;
|
||||
const { datasource, data } = this.state;
|
||||
|
||||
if (this.waitingForDatasourceToLoad()) {
|
||||
if (this.isWaitingForDatasourceToLoad()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user