mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DataSource: Allow data source plugins to set query default values (#49581)
* make it possible to set default query * set default query in cloudwatch ds * remove cloudwatch example code * apply feedback * Update public/app/features/explore/state/query.ts Co-authored-by: Giordano Ricci <me@giordanoricci.com> * Update public/app/features/query/components/QueryGroup.tsx Co-authored-by: Giordano Ricci <me@giordanoricci.com> * add alpha tag to method definiton Co-authored-by: Giordano Ricci <me@giordanoricci.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import React, { PureComponent } from 'react';
|
||||
import { Unsubscribable } from 'rxjs';
|
||||
|
||||
import {
|
||||
CoreApp,
|
||||
DataQuery,
|
||||
DataSourceApi,
|
||||
DataSourceInstanceSettings,
|
||||
@@ -137,6 +138,7 @@ export class QueryGroup extends PureComponent<Props, State> {
|
||||
const ds = !dsSettings?.meta.mixed ? dsSettings : defaultDataSource;
|
||||
|
||||
return {
|
||||
...this.state.dataSource?.getDefaultQuery?.(CoreApp.PanelEditor),
|
||||
datasource: { uid: ds?.uid, type: ds?.type },
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user