diff --git a/public/app/plugins/datasource/azuremonitor/components/VariableEditor/VariableEditor.test.tsx b/public/app/plugins/datasource/azuremonitor/components/VariableEditor/VariableEditor.test.tsx index de3b4cfd9db..0547882c7d2 100644 --- a/public/app/plugins/datasource/azuremonitor/components/VariableEditor/VariableEditor.test.tsx +++ b/public/app/plugins/datasource/azuremonitor/components/VariableEditor/VariableEditor.test.tsx @@ -258,12 +258,10 @@ describe('VariableEditor:', () => { await waitFor(() => expect(screen.getByText('Logs')).toBeInTheDocument()); await selectAndRerender('select query type', 'Resource Names', onChange, rerender); await selectAndRerender('select subscription', 'Primary Subscription', onChange, rerender); - await selectAndRerender('select region', 'North Europe', onChange, rerender); expect(onChange).toHaveBeenCalledWith( expect.objectContaining({ queryType: AzureQueryType.ResourceNamesQuery, subscription: 'sub', - region: 'northeurope', refId: 'A', }) ); @@ -325,21 +323,5 @@ describe('VariableEditor:', () => { }) ); }); - - it('should run the query if requesting regions', async () => { - const onChange = jest.fn(); - const { rerender } = render(); - // wait for initial load - await waitFor(() => expect(screen.getByText('Logs')).toBeInTheDocument()); - await selectAndRerender('select query type', 'Regions', onChange, rerender); - await selectAndRerender('select subscription', 'Primary Subscription', onChange, rerender); - expect(onChange).toHaveBeenCalledWith( - expect.objectContaining({ - queryType: AzureQueryType.LocationsQuery, - subscription: 'sub', - refId: 'A', - }) - ); - }); }); }); diff --git a/public/app/plugins/datasource/azuremonitor/components/VariableEditor/VariableEditor.tsx b/public/app/plugins/datasource/azuremonitor/components/VariableEditor/VariableEditor.tsx index 321cc7a887f..f9dce486d07 100644 --- a/public/app/plugins/datasource/azuremonitor/components/VariableEditor/VariableEditor.tsx +++ b/public/app/plugins/datasource/azuremonitor/components/VariableEditor/VariableEditor.tsx @@ -30,7 +30,6 @@ const VariableEditor = (props: Props) => { { label: 'Subscriptions', value: AzureQueryType.SubscriptionsQuery }, { label: 'Resource Groups', value: AzureQueryType.ResourceGroupsQuery }, { label: 'Namespaces', value: AzureQueryType.NamespacesQuery }, - { label: 'Regions', value: AzureQueryType.LocationsQuery }, { label: 'Resource Names', value: AzureQueryType.ResourceNamesQuery }, { label: 'Metric Names', value: AzureQueryType.MetricNamesQuery }, { label: 'Workspaces', value: AzureQueryType.WorkspacesQuery }, @@ -51,7 +50,6 @@ const VariableEditor = (props: Props) => { const [requireSubscription, setRequireSubscription] = useState(false); const [hasResourceGroup, setHasResourceGroup] = useState(false); const [hasNamespace, setHasNamespace] = useState(false); - const [hasRegion, setHasRegion] = useState(false); const [requireResourceGroup, setRequireResourceGroup] = useState(false); const [requireNamespace, setRequireNamespace] = useState(false); const [requireResource, setRequireResource] = useState(false); @@ -59,7 +57,6 @@ const VariableEditor = (props: Props) => { const [resourceGroups, setResourceGroups] = useState([]); const [namespaces, setNamespaces] = useState([]); const [resources, setResources] = useState([]); - const [regions, setRegions] = useState([]); const [errorMessage, setError] = useLastError(); const queryType = typeof query === 'string' ? '' : query.queryType; @@ -91,7 +88,6 @@ const VariableEditor = (props: Props) => { setRequireSubscription(true); setHasResourceGroup(true); setHasNamespace(true); - setHasRegion(true); break; case AzureQueryType.MetricNamesQuery: setRequireSubscription(true); @@ -99,9 +95,6 @@ const VariableEditor = (props: Props) => { setRequireNamespace(true); setRequireResource(true); break; - case AzureQueryType.LocationsQuery: - setRequireSubscription(true); - break; } }, [queryType]); @@ -142,16 +135,6 @@ const VariableEditor = (props: Props) => { } }, [datasource, subscription, resourceGroup]); - useEffect(() => { - if (subscription) { - datasource.azureMonitorDatasource.getLocations([subscription]).then((rgs) => { - const regions: SelectableValue[] = []; - rgs.forEach((r) => regions.push({ label: r.displayName, value: r.name })); - setRegions(regions); - }); - } - }, [datasource, subscription, resourceGroup]); - const namespace = (typeof query === 'object' && query.namespace) || ''; useEffect(() => { if (subscription) { @@ -208,13 +191,6 @@ const VariableEditor = (props: Props) => { }); }; - const onChangeRegion = (selectableValue: SelectableValue) => { - onChange({ - ...query, - region: selectableValue.value, - }); - }; - const onChangeResource = (selectableValue: SelectableValue) => { onChange({ ...query, @@ -320,22 +296,6 @@ const VariableEditor = (props: Props) => { /> )} - {hasRegion && ( - -