Files
grafana/public/app/features/query/components/QueryActionComponent.ts
Andrew Hackmann d96a9171ae Recorded Queries: Adding create and add recorded query buttons to (#38049)
* add create and add buttons that will be linked to enterprise

* wip

* wip

* clean up

* Co-authored-by: Travis Patterson <masslessparticle@gmail.com>
Added Query Modal that can be accessed from enterprise.

* reset docs

* reset docs

* docs changing

* docs

* docs

* unexporting props

* added generic ways to add more query actions and create actions

* cleanup

* adding internal tag

* adding onAddQuery to props so actions can add queries

* created a single query action component

* adding partial to query

* casting dataquery

Co-authored-by: Travis Patterson <travis.patterson@grafana.com>
2021-09-20 09:36:04 -05:00

33 lines
801 B
TypeScript

import { DataQuery, TimeRange } from '@grafana/data';
interface ActionComponentProps {
query?: DataQuery;
queries?: Array<Partial<DataQuery>>;
onAddQuery?: (q: DataQuery) => void;
timeRange?: TimeRange;
}
type QueryActionComponent = React.ComponentType<ActionComponentProps>;
class QueryActionComponents {
extraRenderActions: QueryActionComponent[] = [];
addExtraRenderAction(extra: QueryActionComponent) {
this.extraRenderActions = this.extraRenderActions.concat(extra);
}
getAllExtraRenderAction(): QueryActionComponent[] {
return this.extraRenderActions;
}
}
/**
* @internal and experimental
*/
export const GroupActionComponents = new QueryActionComponents();
/**
* @internal and experimental
*/
export const RowActionComponents = new QueryActionComponents();