mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* refactor(loki-test): move mock creation to mock module * refactor(loki-test): allow to pass custom settings to the mock constructor * refactor(loki-test): refactor mock factory in datasource test * refactor(loki-test): revert change in undefined test case for dsMaxLines * refactor(loki-test): move type assertion to mock definition * refactor(loki-test): fix more type issues * refactor(loki-explore-query-editor): refactor test to use createLokiDatasource() and fix type issues * refactor(loki-test): replace makeMockLokiDatasource with metadataRequest factory * fix: remove any * fix(loki-test): fix remaining usages of any * Fix: add missing exported type
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
// Libraries
|
|
import React, { memo } from 'react';
|
|
|
|
// Types
|
|
import { QueryEditorProps } from '@grafana/data';
|
|
|
|
import { LokiDatasource } from '../datasource';
|
|
import { LokiQuery, LokiOptions } from '../types';
|
|
|
|
import { LokiOptionFields } from './LokiOptionFields';
|
|
import { LokiQueryField } from './LokiQueryField';
|
|
|
|
export type Props = QueryEditorProps<LokiDatasource, LokiQuery, LokiOptions>;
|
|
|
|
export const LokiExploreQueryEditor = memo((props: Props) => {
|
|
const { query, data, datasource, history, onChange, onRunQuery, range } = props;
|
|
|
|
return (
|
|
<LokiQueryField
|
|
datasource={datasource}
|
|
query={query}
|
|
onChange={onChange}
|
|
onBlur={() => {}}
|
|
onRunQuery={onRunQuery}
|
|
history={history}
|
|
data={data}
|
|
range={range}
|
|
data-testid={testIds.editor}
|
|
ExtraFieldElement={
|
|
<LokiOptionFields
|
|
lineLimitValue={query?.maxLines?.toString() || ''}
|
|
resolution={query.resolution || 1}
|
|
query={query}
|
|
onRunQuery={onRunQuery}
|
|
onChange={onChange}
|
|
/>
|
|
}
|
|
/>
|
|
);
|
|
});
|
|
|
|
LokiExploreQueryEditor.displayName = 'LokiExploreQueryEditor';
|
|
|
|
export const testIds = {
|
|
editor: 'loki-editor-explore',
|
|
};
|