mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudMonitoring: Add project selector for MQL editor[fix] (#65567)
This commit is contained in:
parent
8f282b8a6e
commit
81cb84d098
@ -55,4 +55,13 @@ describe('MetricQueryEditor', () => {
|
|||||||
const l = await screen.findByLabelText('Project');
|
const l = await screen.findByLabelText('Project');
|
||||||
expect(l).toBeInTheDocument();
|
expect(l).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders a Project dropdown', async () => {
|
||||||
|
const query = createMockQuery();
|
||||||
|
query.queryType = QueryType.TIME_SERIES_QUERY;
|
||||||
|
|
||||||
|
render(<MetricQueryEditor {...defaultProps} />);
|
||||||
|
const projectDropdown = await screen.findByLabelText('Project');
|
||||||
|
expect(projectDropdown).toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -15,6 +15,7 @@ import {
|
|||||||
|
|
||||||
import { GraphPeriod } from './GraphPeriod';
|
import { GraphPeriod } from './GraphPeriod';
|
||||||
import { MQLQueryEditor } from './MQLQueryEditor';
|
import { MQLQueryEditor } from './MQLQueryEditor';
|
||||||
|
import { Project } from './Project';
|
||||||
import { VisualMetricQueryEditor } from './VisualMetricQueryEditor';
|
import { VisualMetricQueryEditor } from './VisualMetricQueryEditor';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@ -99,6 +100,13 @@ function Editor({
|
|||||||
|
|
||||||
{query.queryType === QueryType.TIME_SERIES_QUERY && query.timeSeriesQuery && (
|
{query.queryType === QueryType.TIME_SERIES_QUERY && query.timeSeriesQuery && (
|
||||||
<>
|
<>
|
||||||
|
<Project
|
||||||
|
refId={refId}
|
||||||
|
datasource={datasource}
|
||||||
|
onChange={(projectName) => onChangeTimeSeriesQuery({ ...query.timeSeriesQuery!, projectName: projectName })}
|
||||||
|
templateVariableOptions={variableOptionGroup.options}
|
||||||
|
projectName={query.timeSeriesQuery.projectName!}
|
||||||
|
/>
|
||||||
<MQLQueryEditor
|
<MQLQueryEditor
|
||||||
onChange={(q: string) => onChangeTimeSeriesQuery({ ...query.timeSeriesQuery!, query: q })}
|
onChange={(q: string) => onChangeTimeSeriesQuery({ ...query.timeSeriesQuery!, query: q })}
|
||||||
onRunQuery={onRunQuery}
|
onRunQuery={onRunQuery}
|
||||||
|
@ -22,7 +22,6 @@ export function Project({ refId, projectName, datasource, onChange, templateVari
|
|||||||
|
|
||||||
const projectsWithTemplateVariables = useMemo(
|
const projectsWithTemplateVariables = useMemo(
|
||||||
() => [
|
() => [
|
||||||
projects,
|
|
||||||
{
|
{
|
||||||
label: 'Template Variables',
|
label: 'Template Variables',
|
||||||
options: templateVariableOptions,
|
options: templateVariableOptions,
|
||||||
|
Loading…
Reference in New Issue
Block a user