mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
minor code refactor
This commit is contained in:
parent
6f6825c53a
commit
df83c4650d
@ -50,17 +50,21 @@ export class QueriesTab extends PureComponent<Props, State> {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const { panel } = props;
|
||||
|
||||
this.state = {
|
||||
currentDS: this.datasources.find(datasource => datasource.value === panel.datasource),
|
||||
isLoadingHelp: false,
|
||||
currentDS: this.findCurrentDataSource(),
|
||||
helpContent: null,
|
||||
isPickerOpen: false,
|
||||
isAddingMixed: false,
|
||||
};
|
||||
}
|
||||
|
||||
findCurrentDataSource(): DataSourceSelectItem {
|
||||
const { panel } = this.props;
|
||||
return this.datasources.find(datasource => datasource.value === panel.datasource) || this.datasources[0];
|
||||
}
|
||||
|
||||
getAngularQueryComponentScope(): AngularQueryComponentScope {
|
||||
const { panel, dashboard } = this.props;
|
||||
|
||||
|
@ -94,7 +94,7 @@ export class QueryOptions extends PureComponent<Props, State> {
|
||||
|
||||
renderOptions() {
|
||||
const { datasource, panel } = this.props;
|
||||
const queryOptions = datasource && datasource.meta ? datasource.meta.queryOptions : undefined;
|
||||
const { queryOptions } = datasource.meta;
|
||||
|
||||
if (!queryOptions) {
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user