mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Azure Monitor: Fix multi-resource bug "Missing required region params, requested QueryParams: api-version:2017-12-01-preview..." (#79669)
* actually fix the bug * prettier
This commit is contained in:
@@ -174,6 +174,22 @@ describe('AzureMonitorUrlBuilder', () => {
|
||||
'/subscriptions/sub/resource-uri/resource/providers/microsoft.insights/metricdefinitions?api-version=2017-05-01-preview&metricnamespace=custom%2Fnamespace'
|
||||
);
|
||||
});
|
||||
|
||||
it('adds a region with multiple resources', () => {
|
||||
const url = UrlBuilder.buildAzureMonitorGetMetricNamesUrl(
|
||||
'baseUrl',
|
||||
'apiVersion',
|
||||
{
|
||||
resourceUri: '/subscriptions/sub/resource-uri/resource',
|
||||
},
|
||||
templateSrv,
|
||||
true,
|
||||
'region'
|
||||
);
|
||||
expect(url).toBe(
|
||||
'baseUrl/subscriptions/sub/resource-uri/resource/providers/microsoft.insights/metricdefinitions?api-version=apiVersion®ion=region'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Legacy query object', () => {
|
||||
|
||||
@@ -104,10 +104,10 @@ export default class UrlBuilder {
|
||||
|
||||
if (multipleResources && !customNamespace && metricNamespace) {
|
||||
url += `&metricnamespace=${encodeURIComponent(metricNamespace)}`;
|
||||
}
|
||||
|
||||
if (region) {
|
||||
url += `®ion=${region}`;
|
||||
}
|
||||
if (region && multipleResources) {
|
||||
url += `®ion=${region}`;
|
||||
}
|
||||
|
||||
return url;
|
||||
|
||||
Reference in New Issue
Block a user