QueryActionComponent.ts 971 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { DataQuery, DataSourceInstanceSettings, TimeRange } from '@grafana/data';
  2. interface ActionComponentProps {
  3. query?: DataQuery;
  4. queries?: Array<Partial<DataQuery>>;
  5. onAddQuery?: (q: DataQuery) => void;
  6. onChangeDataSource?: (ds: DataSourceInstanceSettings) => void;
  7. timeRange?: TimeRange;
  8. dataSource?: DataSourceInstanceSettings;
  9. key: string | number;
  10. }
  11. type QueryActionComponent = (props: ActionComponentProps) => JSX.Element | null;
  12. class QueryActionComponents {
  13. extraRenderActions: QueryActionComponent[] = [];
  14. addExtraRenderAction(extra: QueryActionComponent) {
  15. this.extraRenderActions = this.extraRenderActions.concat(extra);
  16. }
  17. getAllExtraRenderAction(): QueryActionComponent[] {
  18. return this.extraRenderActions;
  19. }
  20. }
  21. /**
  22. * @internal and experimental
  23. */
  24. export const GroupActionComponents = new QueryActionComponents();
  25. /**
  26. * @internal and experimental
  27. */
  28. export const RowActionComponents = new QueryActionComponents();