2021-05-19 09:24:27 -05:00
|
|
|
import React, { memo } from 'react';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2021-05-19 09:24:27 -05:00
|
|
|
import { CoreApp } from '@grafana/data';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { config } from '@grafana/runtime';
|
|
|
|
|
|
|
|
import { LokiQueryEditorSelector } from '../querybuilder/components/LokiQueryEditorSelector';
|
|
|
|
|
|
|
|
import { LokiExploreQueryEditor } from './LokiExploreQueryEditor';
|
2021-05-19 09:24:27 -05:00
|
|
|
import { LokiQueryEditor } from './LokiQueryEditor';
|
|
|
|
import { LokiQueryEditorForAlerting } from './LokiQueryEditorForAlerting';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { LokiQueryEditorProps } from './types';
|
2021-05-19 09:24:27 -05:00
|
|
|
|
|
|
|
export function LokiQueryEditorByApp(props: LokiQueryEditorProps) {
|
|
|
|
const { app } = props;
|
|
|
|
|
|
|
|
switch (app) {
|
|
|
|
case CoreApp.CloudAlerting:
|
|
|
|
return <LokiQueryEditorForAlerting {...props} />;
|
2022-02-04 05:19:18 -06:00
|
|
|
case CoreApp.Explore:
|
|
|
|
if (config.featureToggles.lokiQueryBuilder) {
|
|
|
|
return <LokiQueryEditorSelector {...props} />;
|
|
|
|
}
|
|
|
|
return <LokiExploreQueryEditor {...props} />;
|
2021-05-19 09:24:27 -05:00
|
|
|
default:
|
2022-01-31 00:57:14 -06:00
|
|
|
if (config.featureToggles.lokiQueryBuilder) {
|
|
|
|
return <LokiQueryEditorSelector {...props} />;
|
|
|
|
}
|
2021-05-19 09:24:27 -05:00
|
|
|
return <LokiQueryEditor {...props} />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default memo(LokiQueryEditorByApp);
|