mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 02:10:45 -06:00
Prometheus: Variable query editor, display selected label when using query type of label values (#92513)
display label, add test
This commit is contained in:
parent
cffaefddc3
commit
4bf350cc62
@ -265,6 +265,8 @@ describe('PromVariableQueryEditor', () => {
|
||||
const labelSelect = screen.getByLabelText('label-select');
|
||||
await userEvent.type(labelSelect, 'this');
|
||||
await selectOptionInTest(labelSelect, 'this');
|
||||
//display label in label select
|
||||
await waitFor(() => expect(screen.getByText('this')).toBeInTheDocument());
|
||||
|
||||
await waitFor(() =>
|
||||
expect(onChange).toHaveBeenCalledWith({
|
||||
|
@ -2,7 +2,7 @@
|
||||
import debounce from 'debounce-promise';
|
||||
import { FormEvent, useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { QueryEditorProps, SelectableValue } from '@grafana/data';
|
||||
import { QueryEditorProps, SelectableValue, toOption } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { AsyncSelect, InlineField, InlineFieldRow, Input, Select, TextArea } from '@grafana/ui';
|
||||
|
||||
@ -286,7 +286,7 @@ export const PromVariableQueryEditor = ({ onChange, query, datasource, range }:
|
||||
<AsyncSelect
|
||||
aria-label="label-select"
|
||||
onChange={onLabelChange}
|
||||
value={label}
|
||||
value={label ? toOption(label) : null}
|
||||
defaultOptions={truncatedLabelOptions}
|
||||
width={25}
|
||||
allowCustomValue
|
||||
|
Loading…
Reference in New Issue
Block a user