PromQueryEditorByApp.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. import React, { memo } from 'react';
  2. import { CoreApp } from '@grafana/data';
  3. import { config } from '@grafana/runtime';
  4. import { PromQueryEditorSelector } from '../querybuilder/components/PromQueryEditorSelector';
  5. import { PromExploreQueryEditor } from './PromExploreQueryEditor';
  6. import { PromQueryEditor } from './PromQueryEditor';
  7. import { PromQueryEditorForAlerting } from './PromQueryEditorForAlerting';
  8. import { PromQueryEditorProps } from './types';
  9. export function PromQueryEditorByApp(props: PromQueryEditorProps) {
  10. const { app } = props;
  11. switch (app) {
  12. case CoreApp.CloudAlerting:
  13. return <PromQueryEditorForAlerting {...props} />;
  14. case CoreApp.Explore:
  15. if (config.featureToggles.promQueryBuilder) {
  16. return <PromQueryEditorSelector {...props} />;
  17. }
  18. return <PromExploreQueryEditor {...props} />;
  19. default:
  20. if (config.featureToggles.promQueryBuilder) {
  21. return <PromQueryEditorSelector {...props} />;
  22. }
  23. return <PromQueryEditor {...props} />;
  24. }
  25. }
  26. export default memo(PromQueryEditorByApp);