LokiQueryEditorByApp.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 { LokiQueryEditorSelector } from '../querybuilder/components/LokiQueryEditorSelector';
  5. import { LokiExploreQueryEditor } from './LokiExploreQueryEditor';
  6. import { LokiQueryEditor } from './LokiQueryEditor';
  7. import { LokiQueryEditorForAlerting } from './LokiQueryEditorForAlerting';
  8. import { LokiQueryEditorProps } from './types';
  9. export function LokiQueryEditorByApp(props: LokiQueryEditorProps) {
  10. const { app } = props;
  11. switch (app) {
  12. case CoreApp.CloudAlerting:
  13. return <LokiQueryEditorForAlerting {...props} />;
  14. case CoreApp.Explore:
  15. if (config.featureToggles.lokiQueryBuilder) {
  16. return <LokiQueryEditorSelector {...props} />;
  17. }
  18. return <LokiExploreQueryEditor {...props} />;
  19. default:
  20. if (config.featureToggles.lokiQueryBuilder) {
  21. return <LokiQueryEditorSelector {...props} />;
  22. }
  23. return <LokiQueryEditor {...props} />;
  24. }
  25. }
  26. export default memo(LokiQueryEditorByApp);