Update dashboard loki query editor (#37541)

This commit is contained in:
Ivana Huckova 2021-08-04 10:23:16 -04:00 committed by GitHub
parent cc7c54be0e
commit a0f94866b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -8,7 +8,7 @@ import { LokiOptionFields } from './LokiOptionFields';
import { LokiQueryEditorProps } from './types';
export function LokiQueryEditor(props: LokiQueryEditorProps) {
const { query, data, datasource, onChange, onRunQuery } = props;
const { query, data, datasource, onChange, onRunQuery, range } = props;
const onLegendChange = (e: React.SyntheticEvent<HTMLInputElement>) => {
const nextQuery = { ...query, legendFormat: e.currentTarget.value };
@ -47,6 +47,7 @@ export function LokiQueryEditor(props: LokiQueryEditorProps) {
history={[]}
data={data}
data-testid={testIds.editor}
range={range}
ExtraFieldElement={
<>
<LokiOptionFields

View File

@ -56,6 +56,12 @@ exports[`Render LokiQueryEditor with legend should render 1`] = `
"refId": "A",
}
}
range={
Object {
"from": "2020-01-01T00:00:00.000Z",
"to": "2020-01-02T00:00:00.000Z",
}
}
/>
`;
@ -115,5 +121,11 @@ exports[`Render LokiQueryEditor with legend should update timerange 1`] = `
"refId": "A",
}
}
range={
Object {
"from": "2019-01-01T00:00:00.000Z",
"to": "2020-01-02T00:00:00.000Z",
}
}
/>
`;