mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Fix input history (#57344)
This commit is contained in:
@@ -18,7 +18,7 @@ type Props = LokiQueryEditorProps & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const LokiAnnotationsQueryEditor = memo(function LokiAnnotationQueryEditor(props: Props) {
|
export const LokiAnnotationsQueryEditor = memo(function LokiAnnotationQueryEditor(props: Props) {
|
||||||
const { annotation, onAnnotationChange } = props;
|
const { annotation, onAnnotationChange, history } = props;
|
||||||
|
|
||||||
// this should never happen, but we want to keep typescript happy
|
// this should never happen, but we want to keep typescript happy
|
||||||
if (annotation === undefined || onAnnotationChange === undefined) {
|
if (annotation === undefined || onAnnotationChange === undefined) {
|
||||||
@@ -56,7 +56,7 @@ export const LokiAnnotationsQueryEditor = memo(function LokiAnnotationQueryEdito
|
|||||||
onChange={onChangeQuery}
|
onChange={onChangeQuery}
|
||||||
onRunQuery={() => {}}
|
onRunQuery={() => {}}
|
||||||
onBlur={() => {}}
|
onBlur={() => {}}
|
||||||
history={[]}
|
history={history}
|
||||||
ExtraFieldElement={
|
ExtraFieldElement={
|
||||||
<LokiOptionFields
|
<LokiOptionFields
|
||||||
lineLimitValue={queryWithRefId?.maxLines?.toString() || ''}
|
lineLimitValue={queryWithRefId?.maxLines?.toString() || ''}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { LokiQueryField } from './LokiQueryField';
|
|||||||
import { LokiQueryEditorProps } from './types';
|
import { LokiQueryEditorProps } from './types';
|
||||||
|
|
||||||
export function LokiQueryEditorForAlerting(props: LokiQueryEditorProps) {
|
export function LokiQueryEditorForAlerting(props: LokiQueryEditorProps) {
|
||||||
const { query, data, datasource, onChange, onRunQuery } = props;
|
const { query, data, datasource, onChange, onRunQuery, history } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LokiQueryField
|
<LokiQueryField
|
||||||
@@ -13,7 +13,7 @@ export function LokiQueryEditorForAlerting(props: LokiQueryEditorProps) {
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onRunQuery={onRunQuery}
|
onRunQuery={onRunQuery}
|
||||||
onBlur={onRunQuery}
|
onBlur={onRunQuery}
|
||||||
history={[]}
|
history={history}
|
||||||
data={data}
|
data={data}
|
||||||
placeholder="Enter a Loki query"
|
placeholder="Enter a Loki query"
|
||||||
data-testid={testIds.editor}
|
data-testid={testIds.editor}
|
||||||
|
|||||||
@@ -14,7 +14,17 @@ type Props = LokiQueryEditorProps & {
|
|||||||
showExplain: boolean;
|
showExplain: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function LokiQueryCodeEditor({ query, datasource, range, onRunQuery, onChange, data, app, showExplain }: Props) {
|
export function LokiQueryCodeEditor({
|
||||||
|
query,
|
||||||
|
datasource,
|
||||||
|
range,
|
||||||
|
onRunQuery,
|
||||||
|
onChange,
|
||||||
|
data,
|
||||||
|
app,
|
||||||
|
showExplain,
|
||||||
|
history,
|
||||||
|
}: Props) {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
|
||||||
// the inner QueryField works like this when a blur event happens:
|
// the inner QueryField works like this when a blur event happens:
|
||||||
@@ -35,7 +45,7 @@ export function LokiQueryCodeEditor({ query, datasource, range, onRunQuery, onCh
|
|||||||
onRunQuery={onRunQuery}
|
onRunQuery={onRunQuery}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
history={[]}
|
history={history}
|
||||||
data={data}
|
data={data}
|
||||||
app={app}
|
app={app}
|
||||||
data-testid={testIds.editor}
|
data-testid={testIds.editor}
|
||||||
|
|||||||
Reference in New Issue
Block a user