[release-12.0.3] Azure: Fix resource name determination in template variable queries (#106942)
Backend Unit Tests / Grafana (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Backend Unit Tests / Grafana Enterprise (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
CodeQL checks / Analyze (go) (push) Has been cancelled Details
CodeQL checks / Analyze (javascript) (push) Has been cancelled Details
CodeQL checks / Analyze (python) (push) Has been cancelled Details
Lint Frontend / Verify i18n (push) Has been cancelled Details
Lint Frontend / Lint (push) Has been cancelled Details
Lint Frontend / Typecheck (push) Has been cancelled Details
Lint Frontend / Betterer (push) Has been cancelled Details
End-to-end tests / Build & Package Grafana (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (1) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (2) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (3) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (4) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (5) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (6) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (7) (push) Has been cancelled Details
Frontend tests / Unit tests (${{ matrix.chunk }} / 8) (8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Integration Tests / Sqlite (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Integration Tests / MySQL (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (1/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (2/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (3/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (4/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (5/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (6/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (7/8) (push) Has been cancelled Details
Integration Tests / Postgres (${{ matrix.shard }}) (8/8) (push) Has been cancelled Details
Dispatch sync to mirror / dispatch-job (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (dashboards-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (panels-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (smoke-tests-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (various-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (old arch) (old-arch/dashboards-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (old arch) (old-arch/panels-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (old arch) (old-arch/smoke-tests-suite) (push) Has been cancelled Details
End-to-end tests / ${{ matrix.suite }} (old arch) (old-arch/various-suite) (push) Has been cancelled Details

Azure: Fix resource name determination in template variable queries (#105705)

* Correctly parse resource URIs

* Update test

* Update variable function

(cherry picked from commit 4020a3d96a)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
This commit is contained in:
grafana-delivery-bot[bot] 2025-06-18 20:20:12 +02:00 committed by GitHub
parent e0b1e649b8
commit 384797ba3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 4 deletions

View File

@ -37,11 +37,11 @@ jest.mock('@grafana/runtime', () => ({
const getResourceGroups = jest.fn().mockResolvedValue([{ resourceGroupURI: 'rg', resourceGroupName: 'rg', count: 1 }]);
const getResourceNames = jest.fn().mockResolvedValue([
{
id: 'foobarID',
id: '/subscriptions/subID/resourceGroups/resourceGroup/providers/foobarProvider/foobarType/foobar',
name: 'foobar',
subscriptionId: 'subID',
resourceGroup: 'resourceGroup',
type: 'foobarType',
type: 'foobarProvider/foobarType',
location: 'london',
},
]);

View File

@ -14,6 +14,7 @@ import { AzureMonitorOption, AzureMonitorQuery, AzureQueryType } from '../../typ
import useLastError from '../../utils/useLastError';
import ArgQueryEditor from '../ArgQueryEditor';
import LogsQueryEditor from '../LogsQueryEditor';
import { parseResourceURI } from '../ResourcePicker/utils';
import GrafanaTemplateVariableFnInput from './GrafanaTemplateVariableFn';
@ -180,7 +181,12 @@ const VariableEditor = (props: Props) => {
useEffect(() => {
if (subscription && resourceGroup && namespace) {
datasource.getResourceNames(subscription, resourceGroup, namespace).then((resources) => {
setResources(resources.map((s) => ({ label: s.name, value: s.name })));
setResources(
resources.map((s) => {
const parsedResource = parseResourceURI(s.id);
return { label: s.name, value: parsedResource.resourceName };
})
);
});
}
}, [datasource, subscription, resourceGroup, namespace]);

View File

@ -11,6 +11,7 @@ import {
import { getTemplateSrv, TemplateSrv } from '@grafana/runtime';
import UrlBuilder from './azure_monitor/url_builder';
import { parseResourceURI } from './components/ResourcePicker/utils';
import VariableEditor from './components/VariableEditor/VariableEditor';
import DataSource from './datasource';
import { migrateQuery } from './grafanaTemplateVariableFns';
@ -29,7 +30,7 @@ export function parseResourceNamesAsTemplateVariable(resources: RawAzureResource
return {
text: r.name,
value: r.name,
value: parseResourceURI(r.id).resourceName,
};
});
}