mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix create a dashboard from Explorer and edit panel flow (#54551)
This commit is contained in:
parent
7e2238cf6f
commit
29ff97a4b8
@ -26,6 +26,22 @@ describe('PromQueryBuilderOptions', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('Can set query type to "Both" on render for PanelEditor', async () => {
|
||||
setup({ instant: true, range: true });
|
||||
|
||||
screen.getByTitle('Click to edit options').click();
|
||||
|
||||
expect(screen.getByLabelText('Both')).toBeChecked();
|
||||
});
|
||||
|
||||
it('Can set query type to "Both" on render for Explorer', async () => {
|
||||
setup({ instant: true, range: true }, CoreApp.Explore);
|
||||
|
||||
screen.getByTitle('Click to edit options').click();
|
||||
|
||||
expect(screen.getByLabelText('Both')).toBeChecked();
|
||||
});
|
||||
|
||||
it('Legend format default to Auto', async () => {
|
||||
setup();
|
||||
expect(screen.getByText('Legend: Auto')).toBeInTheDocument();
|
||||
@ -85,8 +101,9 @@ describe('PromQueryBuilderOptions', () => {
|
||||
});
|
||||
});
|
||||
|
||||
function setup(queryOverrides: Partial<PromQuery> = {}) {
|
||||
function setup(queryOverrides: Partial<PromQuery> = {}, app: CoreApp = CoreApp.PanelEditor) {
|
||||
const props = {
|
||||
app,
|
||||
query: {
|
||||
...getQueryWithDefaults({ refId: 'A' } as PromQuery, CoreApp.PanelEditor),
|
||||
...queryOverrides,
|
||||
|
@ -37,7 +37,7 @@ export const PromQueryBuilderOptions = React.memo<Props>(({ query, app, onChange
|
||||
onRunQuery();
|
||||
};
|
||||
|
||||
const queryTypeOptions = getQueryTypeOptions(app === CoreApp.Explore);
|
||||
const queryTypeOptions = getQueryTypeOptions(app === CoreApp.Explore || app === CoreApp.PanelEditor);
|
||||
const onQueryTypeChange = getQueryTypeChangeHandler(query, onChange);
|
||||
|
||||
const onExemplarChange = (event: SyntheticEvent<HTMLInputElement>) => {
|
||||
|
Loading…
Reference in New Issue
Block a user