Update dashboard loki query editor (#37541) (#37548)

(cherry picked from commit a0f94866b4)

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2021-08-04 16:51:46 +02:00
committed by GitHub
co-authored by Ivana Huckova
parent 8ad4703f6d
commit a91f08222e
2 changed files with 14 additions and 1 deletions
@@ -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
@@ -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",
}
}
/>
`;