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2C,cAC3C,kDAAmD,UACnD,oDAAqD,yBACrD,kDAAmD,oBACnD,gDAAiD,oBACjD,4BAA6B,qBAC7B,+CAAgD,aAChD,+CAAgD,aAChD,+CAAgD,sBAChD,4CAA6C,mBAC7C,yCAA0C,gBAC1C,oCAAqC,UACrC,6CAA8C,+CAC9C,sCAAuC,mBCnY5BC,GAA4B,CACvC,+BACA,kCACA,qCACA,kCACA,8BACA,iDACA,+BACA,0CACA,8BACA,gCACA,+BACA,0BACA,yCACA,mCACA,wBACA,kCACA,kDACA,yBACA,mDACA,2CACA,2CACA,wDACA,wDACA,yDACA,yDACA,kCACA,4BACA,8BACA,uCACA,gDACA,kCACA,wCACA,0BACA,oCACA,4CACA,4DACA,sCACA,8CACA,8CACA,yCACA,6CACA,8CACA,2CACA,yCACA,sCACA,kCACA,uCACA,mCACA,wCACA,+BACA,iCACA,uCACA,+BACA,4CACA,2CACA,oCACA,sCACA,iCACA,+CACA,4BACA,yCACA,+CACA,yCACA,wCACA,gCACA,8BACA,yCACA,sCACA,wCACA,oCACA,mCACA,6BACA,8BACA,gCACA,+BACA,oCACA,mDACA,oDACA,2CACA,kDACA,uCACA,gCACA,+BACA,iCACA,4BACA,yCACA,2BACA,iDACA,4BACA,+CACA,0BACA,gCACA,2CACA,mDACA,iCACA,iDACA,gDACA,gDACA,wDACA,wCACA,mCACA,iCACA,gCACA,0CACA,iCACA,6BACA,yCACA,kDACA,yCACA,sCACA,+BACA,kCACA,gCACA,sCACA,uDACA,mCACA,oCACA,qCACA,wCACA,sCACA,2CACA,gCACA,2CACA,oCACA,mCACA,gCACA,yDACA,2CACA,6BACA,oCACA,wCACA,6BACA,oCACA,6BACA,oCACA,kCACA,wCACA,kCACA,mCACA,qCACA,iCACA,kCACA,qCACA,oCACA,iDACA,iDACA,kDACA,kDACA,gCACA,4CACA,0CACA,+BACA,4CACA,0CACA,wCACA,4CACA,yDACA,8CACA,4BACA,8BACA,oCACA,mDACA,gDACA,4BACA,sBACA,4BACA,4B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,EAAeqgB,mBAC1B7d,cAAAA,EACAwH,mBAAoB,CAClBqO,aAAc,QACd3P,MAAAA,K,yHClBR,MAEM0mB,GCJ2B,CAC/B,+BACA,kCACA,2BACA,qCACA,qCACA,kCACA,iDACA,+BACA,6CACA,0CACA,mDACA,oDACA,qDACA,8BACA,4DACA,gCACA,+BACA,yCACA,oCACA,mCACA,wBACA,kCACA,kDACA,yBACA,mCACA,uCACA,2CACA,iDACA,2CACA,uCACA,gDACA,0BACA,oCACA,4CACA,sCACA,8CACA,8CACA,yCACA,6CACA,kCACA,8CACA,2CACA,8BACA,2CACA,kCACA,yCACA,sCACA,kCACA,uCACA,mCACA,+BACA,iCACA,uCACA,+BACA,4CACA,2CACA,oCACA,sCACA,oDACA,4CACA,+CACA,6CACA,+CACA,4BACA,yCACA,+CACA,yCACA,wCACA,8BACA,wCACA,oCACA,mCACA,6BACA,8BACA,gCACA,iDACA,yCACA,+BACA,oCACA,oDACA,mDACA,uCACA,gCACA,yBACA,+BACA,iCACA,4BACA,yCACA,2BACA,sCACA,sCACA,iDACA,4BACA,+CACA,gCACA,2CACA,mDACA,iCACA,gDACA,wDACA,wCACA,mCACA,iCACA,gCACA,6BACA,yCACA,yCACA,sCACA,+BACA,kCACA,gCACA,sCACA,0CACA,8CACA,6CACA,oCACA,uDACA,mCACA,qCACA,wCACA,sCACA,2CACA,2CACA,oCACA,gCACA,mDACA,wCACA,yDACA,6CACA,2CACA,2CACA,oCACA,4BACA,uCACA,wCACA,6BACA,oCACA,6BACA,oCACA,mDACA,kCACA,yCACA,sCACA,kCACA,mCACA,qCACA,iCACA,iCACA,2CACA,kCACA,qCACA,oCACA,iDACA,iDACA,kDACA,kDACA,gCACA,4CACA,0CACA,+BACA,4CACA,0CACA,0CACA,wCACA,4CACA,yDACA,kCACA,8CACA,oCACA,gDACA,4BACA,sBACA,6BDzKwD7wB,KAAKf,GAAO,IAAGA,OAAMuC,KAAK,KAC9EsvB,GAAiCtC,GAA0BxuB,KAAKf,G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AG,IAAIzB,EAAEA,EAAEzgB,MAAMkiB,EAAE,IAAI,IAAIzhB,EAAEy7B,EAAE,WAAWuD,EAAE,OAAOxK,EAAEqF,GAAG75B,EAAE65B,EAAE7Z,GAAGxW,KAAKkN,QAAQmjB,GAAE,SAAUA,GAAG,OAAO75B,EAAE65B,EAAE7Z,OAAOyB,EAAh7D,GAAq7Dwd,EAAG,IAAIX,EAAGvS,GAAGkT,EAAGvoB,QAAWuoB,EAAGV,mBAAmBpH,KAAK8H,GAAOA,EAAGN,cAAcxH,KAAK8H,GAAOA,EAAGR,cAActH,KAAK8H,GAAOA,EAAGH,aAAa3H,KAAK8H,GAAOA,EAAGL,YAAYzH,KAAK8H,GAAOA,EAAGJ,YAAY1H,KAAK8H,GAAI","sources":["webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/time_grain_converter.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/response_parser.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/utils/common.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/types/query.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/types/types.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/credentials.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/AzureCredentialsForm.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MonitorConfig.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ConfigEditor.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/utils/useLastError.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/Field.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/SubscriptionField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ArgQueryEditor/QueryField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ArgQueryEditor/ArgQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/Space.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/types.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/EntryIcon.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/styles.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/NestedEntry.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/utils.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/NestedRow.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/Search.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/ResourcePicker.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ResourceField/ResourceField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/LogsQueryEditor/setQueryValue.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/LogsQueryEditor/FormatAsField.tsx","webpack://grafana/./public/app/core/utils/deferred.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/LogsQueryEditor/QueryField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/LogsQueryEditor/useMigrations.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/LogsQueryEditor/LogsQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/setQueryValue.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/AggregationField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/DimensionFields.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/LegendFormatField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricNameField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricNamespaceField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/TimeGrainField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/TopField.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/utils/useAsyncState.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/dataHooks.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricsQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryHeader.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/url_builder.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/utils/migrateQuery.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/usePreparedQuery.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/log_analytics/querystring_builder.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/response_parser.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/azure_log_analytics_datasource.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/locations.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/resourceTypes.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/metricNamespaces.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_resource_graph/azure_resource_graph_datasource.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/resourcePicker/resourcePickerData.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/logsResourceTypes.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/utils/migrateAnnotation.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/grafanaTemplateVariableFns.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/components/VariableEditor/VariableEditor.tsx","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/variables.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/datasource.ts","webpack://grafana/./public/app/plugins/datasource/grafana-azure-monitor-datasource/module.ts","webpack://grafana/../../opt/drone/yarncache/immer-npm-9.0.14-0baed19a8d-17f1365c06.zip/node_modules/immer/dist/immer.esm.mjs"],"sourcesContent":["import { includes, filter } from 'lodash';\n\nimport { rangeUtil } from '@grafana/data';\n\nexport default class TimeGrainConverter {\n static createISO8601Duration(timeGrain: string | number, timeGrainUnit: any) {\n const timeIntervals = ['hour', 'minute', 'h', 'm'];\n if (includes(timeIntervals, timeGrainUnit)) {\n return `PT${timeGrain}${timeGrainUnit[0].toUpperCase()}`;\n }\n\n return `P${timeGrain}${timeGrainUnit[0].toUpperCase()}`;\n }\n\n static createISO8601DurationFromInterval(interval: string) {\n const timeGrain = +interval.slice(0, interval.length - 1);\n const unit = interval[interval.length - 1];\n\n if (interval.indexOf('ms') > -1) {\n return TimeGrainConverter.createISO8601Duration(1, 'm');\n }\n\n if (interval[interval.length - 1] === 's') {\n let toMinutes = (timeGrain * 60) % 60;\n\n if (toMinutes < 1) {\n toMinutes = 1;\n }\n\n return TimeGrainConverter.createISO8601Duration(toMinutes, 'm');\n }\n\n return TimeGrainConverter.createISO8601Duration(timeGrain, unit);\n }\n\n static findClosestTimeGrain(interval: any, allowedTimeGrains: string[]) {\n const timeGrains = filter(allowedTimeGrains, (o) => o !== 'auto');\n\n let closest = timeGrains[0];\n const intervalMs = rangeUtil.intervalToMs(interval);\n\n for (let i = 0; i < timeGrains.length; i++) {\n // abs (num - val) < abs (num - curr):\n if (intervalMs > rangeUtil.intervalToMs(timeGrains[i])) {\n if (i + 1 < timeGrains.length) {\n closest = timeGrains[i + 1];\n } else {\n closest = timeGrains[i];\n }\n }\n }\n\n return closest;\n }\n\n static createTimeGrainFromISO8601Duration(duration: string) {\n let offset = 1;\n if (duration.substring(0, 2) === 'PT') {\n offset = 2;\n }\n\n const value = duration.substring(offset, duration.length - 1);\n const unit = duration.substring(duration.length - 1);\n\n return value + ' ' + TimeGrainConverter.timeUnitToText(+value, unit);\n }\n\n static timeUnitToText(value: number, unit: string) {\n let text = '';\n\n if (unit === 'S') {\n text = 'second';\n }\n if (unit === 'M') {\n text = 'minute';\n }\n if (unit === 'H') {\n text = 'hour';\n }\n if (unit === 'D') {\n text = 'day';\n }\n\n if (value > 1) {\n return text + 's';\n }\n\n return text;\n }\n\n static createKbnUnitFromISO8601Duration(duration: string) {\n if (duration === 'auto') {\n return 'auto';\n }\n\n let offset = 1;\n if (duration.substring(0, 2) === 'PT') {\n offset = 2;\n }\n\n const value = duration.substring(offset, duration.length - 1);\n const unit = duration.substring(duration.length - 1);\n\n return value + TimeGrainConverter.timeUnitToKbn(+value, unit);\n }\n\n static timeUnitToKbn(value: number, unit: string) {\n if (unit === 'S') {\n return 's';\n }\n if (unit === 'M') {\n return 'm';\n }\n if (unit === 'H') {\n return 'h';\n }\n if (unit === 'D') {\n return 'd';\n }\n\n return '';\n }\n}\n","import { find, get } from 'lodash';\n\nimport TimeGrainConverter from '../time_grain_converter';\nimport {\n AzureMonitorLocalizedValue,\n AzureMonitorMetricAvailabilityMetadata,\n AzureMonitorMetricsMetadataResponse,\n AzureMonitorOption,\n} from '../types';\nexport default class ResponseParser {\n static parseResponseValues(\n result: any,\n textFieldName: string,\n valueFieldName: string\n ): Array<{ text: string; value: string }> {\n const list: Array<{ text: string; value: string }> = [];\n\n if (!result) {\n return list;\n }\n\n for (let i = 0; i < result.value.length; i++) {\n if (!find(list, ['value', get(result.value[i], valueFieldName)])) {\n const value = get(result.value[i], valueFieldName);\n const text = get(result.value[i], textFieldName, value);\n\n list.push({\n text: text,\n value: value,\n });\n }\n }\n return list;\n }\n\n static parseResourceNames(result: any, metricDefinition: string): Array<{ text: string; value: string }> {\n const list: Array<{ text: string; value: string }> = [];\n\n if (!result) {\n return list;\n }\n\n for (let i = 0; i < result.value.length; i++) {\n if (\n typeof result.value[i].type === 'string' &&\n result.value[i].type.toLocaleLowerCase() === metricDefinition.toLocaleLowerCase()\n ) {\n list.push({\n text: result.value[i].name,\n value: result.value[i].name,\n });\n }\n }\n\n return list;\n }\n\n static parseMetadata(result: AzureMonitorMetricsMetadataResponse, metricName: string) {\n const defaultAggTypes = ['None', 'Average', 'Minimum', 'Maximum', 'Total', 'Count'];\n const metricData = result?.value.find((v) => v.name.value === metricName);\n\n if (!metricData) {\n return {\n primaryAggType: '',\n supportedAggTypes: defaultAggTypes,\n supportedTimeGrains: [],\n dimensions: [],\n };\n }\n\n return {\n primaryAggType: metricData.primaryAggregationType,\n supportedAggTypes: metricData.supportedAggregationTypes || defaultAggTypes,\n\n supportedTimeGrains: [\n { label: 'Auto', value: 'auto' },\n ...ResponseParser.parseTimeGrains(metricData.metricAvailabilities ?? []),\n ],\n dimensions: ResponseParser.parseDimensions(metricData.dimensions ?? []),\n };\n }\n\n static parseTimeGrains(metricAvailabilities: AzureMonitorMetricAvailabilityMetadata[]): AzureMonitorOption[] {\n const timeGrains: AzureMonitorOption[] = [];\n\n if (!metricAvailabilities) {\n return timeGrains;\n }\n\n metricAvailabilities.forEach((avail) => {\n if (avail.timeGrain) {\n timeGrains.push({\n label: TimeGrainConverter.createTimeGrainFromISO8601Duration(avail.timeGrain),\n value: avail.timeGrain,\n });\n }\n });\n\n return timeGrains;\n }\n\n static parseDimensions(metadataDimensions: AzureMonitorLocalizedValue[]) {\n return metadataDimensions.map((dimension) => {\n return {\n label: dimension.localizedValue || dimension.value,\n value: dimension.value,\n };\n });\n }\n\n static parseSubscriptions(result: any): Array<{ text: string; value: string }> {\n const list: Array<{ text: string; value: string }> = [];\n\n if (!result) {\n return list;\n }\n\n const valueFieldName = 'subscriptionId';\n const textFieldName = 'displayName';\n for (let i = 0; i < result.value.length; i++) {\n if (!find(list, ['value', get(result.value[i], valueFieldName)])) {\n list.push({\n text: `${get(result.value[i], textFieldName)}`,\n value: get(result.value[i], valueFieldName),\n });\n }\n }\n\n return list;\n }\n\n static parseSubscriptionsForSelect(result: any): Array<{ label: string; value: string }> {\n const list: Array<{ label: string; value: string }> = [];\n\n if (!result) {\n return list;\n }\n\n const valueFieldName = 'subscriptionId';\n const textFieldName = 'displayName';\n for (let i = 0; i < result.data.value.length; i++) {\n if (!find(list, ['value', get(result.data.value[i], valueFieldName)])) {\n list.push({\n label: `${get(result.data.value[i], textFieldName)} - ${get(result.data.value[i], valueFieldName)}`,\n value: get(result.data.value[i], valueFieldName),\n });\n }\n }\n\n return list;\n }\n\n static parseWorkspacesForSelect(result: any): Array<{ label: string; value: string }> {\n const list: Array<{ label: string; value: string }> = [];\n\n if (!result) {\n return list;\n }\n\n const valueFieldName = 'customerId';\n const textFieldName = 'name';\n for (let i = 0; i < result.data.value.length; i++) {\n if (!find(list, ['value', get(result.data.value[i].properties, valueFieldName)])) {\n list.push({\n label: get(result.data.value[i], textFieldName),\n value: get(result.data.value[i].properties, valueFieldName),\n });\n }\n }\n\n return list;\n }\n}\n","import { map } from 'lodash';\n\nimport { rangeUtil } from '@grafana/data';\nimport { VariableWithMultiSupport } from 'app/features/variables/types';\n\nimport TimegrainConverter from '../time_grain_converter';\nimport { AzureMonitorOption } from '../types';\n\nexport const hasOption = (options: AzureMonitorOption[], value: string): boolean =>\n options.some((v) => (v.options ? hasOption(v.options, value) : v.value === value));\n\nexport const findOptions = (options: AzureMonitorOption[], values: string[] = []) => {\n if (values.length === 0) {\n return [];\n }\n const set = values.reduce((accum, item) => {\n accum.add(item);\n return accum;\n }, new Set());\n return options.filter((option) => set.has(option.value));\n};\n\nexport const toOption = (v: { text: string; value: string }) => ({ value: v.value, label: v.text });\n\nexport function convertTimeGrainsToMs<T extends { value: string }>(timeGrains: T[]) {\n const allowedTimeGrainsMs: number[] = [];\n timeGrains.forEach((tg: any) => {\n if (tg.value !== 'auto') {\n allowedTimeGrainsMs.push(rangeUtil.intervalToMs(TimegrainConverter.createKbnUnitFromISO8601Duration(tg.value)));\n }\n });\n return allowedTimeGrainsMs;\n}\n\n// Route definitions shared with the backend.\n// Check: /pkg/tsdb/azuremonitor/azuremonitor-resource-handler.go <registerRoutes>\nexport const routeNames = {\n azureMonitor: 'azuremonitor',\n logAnalytics: 'loganalytics',\n appInsights: 'appinsights',\n resourceGraph: 'resourcegraph',\n};\n\nexport function interpolateVariable(value: any, variable: VariableWithMultiSupport) {\n if (typeof value === 'string') {\n // When enabling multiple responses, quote the value to mimic the array result below\n // even if only one response is selected. This does not apply if only the \"include all\"\n // option is enabled but with a custom value.\n if (variable.multi || (variable.includeAll && !variable.allValue)) {\n return \"'\" + value + \"'\";\n } else {\n return value;\n }\n }\n\n if (typeof value === 'number') {\n return value;\n }\n\n const quotedValues = map(value, (val) => {\n if (typeof value === 'number') {\n return value;\n }\n\n return \"'\" + val + \"'\";\n });\n return quotedValues.join(',');\n}\n","import { DataQuery } from '@grafana/data';\n\nimport { GrafanaTemplateVariableQuery } from './templateVariables';\n\nexport enum AzureQueryType {\n AzureMonitor = 'Azure Monitor',\n LogAnalytics = 'Azure Log Analytics',\n AzureResourceGraph = 'Azure Resource Graph',\n GrafanaTemplateVariableFn = 'Grafana Template Variable Function',\n}\n\n/**\n * Represents the query as it moves through the frontend query editor and datasource files.\n * It can represent new queries that are still being edited, so all properties are optional\n */\nexport interface AzureMonitorQuery extends DataQuery {\n queryType?: AzureQueryType;\n\n subscription?: string;\n\n /** ARG uses multiple subscriptions */\n subscriptions?: string[];\n\n azureMonitor?: AzureMetricQuery;\n azureLogAnalytics?: AzureLogsQuery;\n azureResourceGraph?: AzureResourceGraphQuery;\n grafanaTemplateVariableFn?: GrafanaTemplateVariableQuery;\n}\n\n/**\n * Azure Monitor Metrics sub-query properties\n */\nexport interface AzureMetricQuery {\n resourceUri?: string;\n resourceGroup?: string;\n\n /** Resource type */\n metricDefinition?: string;\n\n resourceName?: string;\n metricNamespace?: string;\n metricName?: string;\n timeGrain?: string;\n aggregation?: string;\n dimensionFilters?: AzureMetricDimension[];\n alias?: string;\n top?: string;\n allowedTimeGrainsMs?: number[];\n\n /** @deprecated */\n timeGrainUnit?: string;\n\n /** @deprecated This property was migrated to dimensionFilters and should only be accessed in the migration */\n dimension?: string;\n\n /** @deprecated This property was migrated to dimensionFilters and should only be accessed in the migration */\n dimensionFilter?: string;\n}\n\n/**\n * Azure Monitor Logs sub-query properties\n */\nexport interface AzureLogsQuery {\n query?: string;\n resultFormat?: string;\n resource?: string;\n\n workspace?: string;\n}\n\n/**\n * Azure Monitor ARG sub-query properties\n */\nexport interface AzureResourceGraphQuery {\n query?: string;\n resultFormat?: string;\n}\n\nexport interface AzureMetricDimension {\n dimension: string;\n operator: string;\n filters?: string[];\n /**\n * @deprecated filter is deprecated in favour of filters to support multiselect\n */\n filter?: string;\n}\n","import {\n DataSourceInstanceSettings,\n DataSourceJsonData,\n DataSourceSettings,\n PanelData,\n TableData,\n} from '@grafana/data';\n\nimport Datasource from '../datasource';\n\nimport { AzureMonitorQuery } from './query';\n\nexport type AzureDataSourceSettings = DataSourceSettings<AzureDataSourceJsonData, AzureDataSourceSecureJsonData>;\nexport type AzureDataSourceInstanceSettings = DataSourceInstanceSettings<AzureDataSourceJsonData>;\n\nexport interface DatasourceValidationResult {\n status: 'success' | 'error';\n message: string;\n title?: string;\n}\n\n/**\n * Azure clouds known to Azure Monitor.\n */\nexport enum AzureCloud {\n Public = 'AzureCloud',\n China = 'AzureChinaCloud',\n USGovernment = 'AzureUSGovernment',\n Germany = 'AzureGermanCloud',\n None = '',\n}\n\nexport type AzureAuthType = 'msi' | 'clientsecret';\n\nexport type ConcealedSecret = symbol;\n\ninterface AzureCredentialsBase {\n authType: AzureAuthType;\n defaultSubscriptionId?: string;\n}\n\nexport interface AzureManagedIdentityCredentials extends AzureCredentialsBase {\n authType: 'msi';\n}\n\nexport interface AzureClientSecretCredentials extends AzureCredentialsBase {\n authType: 'clientsecret';\n azureCloud?: string;\n tenantId?: string;\n clientId?: string;\n clientSecret?: string | ConcealedSecret;\n}\n\nexport type AzureCredentials = AzureManagedIdentityCredentials | AzureClientSecretCredentials;\n\nexport interface AzureDataSourceJsonData extends DataSourceJsonData {\n cloudName: string;\n azureAuthType?: AzureAuthType;\n\n // monitor\n tenantId?: string;\n clientId?: string;\n subscriptionId?: string;\n\n // logs\n /** @deprecated Azure Logs credentials */\n azureLogAnalyticsSameAs?: boolean;\n /** @deprecated Azure Logs credentials */\n logAnalyticsTenantId?: string;\n /** @deprecated Azure Logs credentials */\n logAnalyticsClientId?: string;\n /** @deprecated Azure Logs credentials */\n logAnalyticsSubscriptionId?: string;\n /** @deprecated Azure Logs credentials */\n logAnalyticsDefaultWorkspace?: string;\n\n // App Insights\n appInsightsAppId?: string;\n}\n\nexport interface AzureDataSourceSecureJsonData {\n clientSecret?: string;\n appInsightsApiKey?: string;\n}\n\n// Represents an errors that come back from frontend requests.\n// Not totally sure how accurate this type is.\nexport type AzureMonitorErrorish = Error | string | React.ReactElement;\n\n// Azure Monitor API Types\nexport interface AzureMonitorMetricsMetadataResponse {\n value: AzureMonitorMetricMetadataItem[];\n}\n\nexport interface AzureMonitorMetricMetadataItem {\n id: string;\n resourceId: string;\n primaryAggregationType: string;\n supportedAggregationTypes: string[];\n name: AzureMonitorLocalizedValue;\n dimensions?: AzureMonitorLocalizedValue[];\n metricAvailabilities?: AzureMonitorMetricAvailabilityMetadata[];\n}\n\nexport interface AzureMonitorMetricNamespacesResponse {\n value: AzureMonitorMetricNamespaceItem[];\n}\n\nexport interface AzureMonitorMetricNamespaceItem {\n name: string;\n properties: { metricNamespacename: string };\n}\n\nexport interface AzureMonitorMetricNamesResponse {\n value: AzureMonitorMetricNameItem[];\n}\n\nexport interface AzureMonitorMetricNameItem {\n name: { value: string; localizedValue: string };\n}\n\nexport interface AzureMonitorMetricAvailabilityMetadata {\n timeGrain: string;\n retention: string;\n}\n\nexport interface AzureMonitorLocalizedValue {\n value: string;\n localizedValue: string;\n}\n\nexport interface AzureMonitorMetricDefinitionsResponse {\n data: {\n value: Array<{ name: string; type: string; location?: string }>;\n };\n status: number;\n statusText: string;\n}\n\nexport interface AzureMonitorResourceGroupsResponse {\n data: {\n value: Array<{ name: string }>;\n };\n status: number;\n statusText: string;\n}\n\nexport interface AzureLogsVariable {\n text: string;\n value: string;\n}\n\nexport interface AzureLogsTableData extends TableData {\n columns: AzureLogsTableColumn[];\n rows: any[];\n type: string;\n}\n\nexport interface AzureLogsTableColumn {\n text: string;\n type: string;\n}\n\nexport interface AzureMonitorOption<T = string> {\n label: string;\n value: T;\n options?: AzureMonitorOption[];\n}\n\nexport interface AzureQueryEditorFieldProps {\n data?: PanelData;\n query: AzureMonitorQuery;\n datasource: Datasource;\n subscriptionId?: string;\n variableOptionGroup: { label: string; options: AzureMonitorOption[] };\n\n onQueryChange: (newQuery: AzureMonitorQuery) => void;\n setError: (source: string, error: AzureMonitorErrorish | undefined) => void;\n}\n\nexport interface AzureResourceSummaryItem {\n subscriptionName: string;\n resourceGroupName: string | undefined;\n resourceName: string | undefined;\n}\n\nexport interface RawAzureSubscriptionItem {\n subscriptionName: string;\n subscriptionId: string;\n}\n\nexport interface RawAzureResourceGroupItem {\n resourceGroupURI: string;\n resourceGroupName: string;\n}\n\nexport interface RawAzureResourceItem {\n id: string;\n name: string;\n subscriptionId: string;\n resourceGroup: string;\n type: string;\n location: string;\n}\n\nexport interface AzureGraphResponse<T = unknown> {\n data: T;\n // skipToken is used for pagination, to get the next page\n $skipToken?: string;\n}\n\n// https://docs.microsoft.com/en-us/rest/api/azureresourcegraph/resourcegraph(2021-03-01)/resources/resources#queryrequestoptions\nexport interface AzureResourceGraphOptions {\n $skip: number;\n $skipToken: string;\n $top: number;\n allowPartialScopes: boolean;\n resultFormat: 'objectArray' | 'table';\n}\n\n// Azure Monitor Metrics query API data fetcher argument types.\n// The types prefixed by Legacy are applicable to pre-version 9 of Grafana\n// that do not have a resourceUri, instead the resourceUri is built up from\n// the subscription, resource group, metric definition (a.k.a. resource type)\n// and the resource name.\nexport type GetMetricNamespacesQuery = AzureGetMetricNamespacesQuery | LegacyAzureGetMetricNamespacesQuery;\nexport type GetMetricNamesQuery = AzureGetMetricNamesQuery | LegacyAzureGetMetricNamesQuery;\nexport type GetMetricMetadataQuery = AzureGetMetricMetadataQuery | LegacyAzureGetMetricMetadataQuery;\n\nexport interface AzureGetMetricNamespacesQuery {\n resourceUri: string;\n}\nexport interface LegacyAzureGetMetricNamespacesQuery {\n subscription: string;\n resourceGroup: string;\n metricDefinition: string;\n resourceName: string;\n}\n\nexport interface AzureGetMetricNamesQuery {\n resourceUri: string;\n metricNamespace: string;\n}\n\nexport interface LegacyAzureGetMetricNamesQuery {\n subscription: string;\n resourceGroup: string;\n metricDefinition: string;\n resourceName: string;\n metricNamespace: string;\n}\n\nexport interface AzureGetMetricMetadataQuery {\n resourceUri: string;\n metricNamespace: string;\n metricName: string;\n}\n\nexport interface LegacyAzureGetMetricMetadataQuery {\n subscription: string;\n resourceGroup: string;\n metricDefinition: string;\n resourceName: string;\n metricNamespace: string;\n metricName: string;\n}\n","import { config } from '@grafana/runtime';\n\nimport {\n AzureAuthType,\n AzureCloud,\n AzureCredentials,\n AzureDataSourceInstanceSettings,\n AzureDataSourceSettings,\n ConcealedSecret,\n} from './types';\n\nconst concealed: ConcealedSecret = Symbol('Concealed client secret');\n\nexport function getAuthType(options: AzureDataSourceSettings | AzureDataSourceInstanceSettings): AzureAuthType {\n if (!options.jsonData.azureAuthType) {\n // If authentication type isn't explicitly specified and datasource has client credentials,\n // then this is existing datasource which is configured for app registration (client secret)\n if (options.jsonData.tenantId && options.jsonData.clientId) {\n return 'clientsecret';\n }\n\n // For newly created datasource with no configuration, managed identity is the default authentication type\n // if they are enabled in Grafana config\n return config.azure.managedIdentityEnabled ? 'msi' : 'clientsecret';\n }\n\n return options.jsonData.azureAuthType;\n}\n\nfunction getDefaultAzureCloud(): string {\n switch (config.azure.cloud) {\n case AzureCloud.Public:\n case AzureCloud.None:\n case undefined:\n return 'azuremonitor';\n case AzureCloud.China:\n return 'chinaazuremonitor';\n case AzureCloud.USGovernment:\n return 'govazuremonitor';\n case AzureCloud.Germany:\n return 'germanyazuremonitor';\n default:\n throw new Error(`The cloud '${config.azure.cloud}' not supported.`);\n }\n}\n\nexport function getAzurePortalUrl(azureCloud: string): string {\n switch (azureCloud) {\n case 'azuremonitor':\n return 'https://portal.azure.com';\n case 'chinaazuremonitor':\n return 'https://portal.azure.cn';\n case 'govazuremonitor':\n return 'https://portal.azure.us';\n case 'germanyazuremonitor':\n return 'https://portal.microsoftazure.de';\n default:\n throw new Error('The cloud not supported.');\n }\n}\n\nexport function getAzureCloud(options: AzureDataSourceSettings | AzureDataSourceInstanceSettings): string {\n const authType = getAuthType(options);\n switch (authType) {\n case 'msi':\n // In case of managed identity, the cloud is always same as where Grafana is hosted\n return getDefaultAzureCloud();\n case 'clientsecret':\n return options.jsonData.cloudName || getDefaultAzureCloud();\n }\n}\n\nfunction getSecret(options: AzureDataSourceSettings): undefined | string | ConcealedSecret {\n if (options.secureJsonFields.clientSecret) {\n // The secret is concealed on server\n return concealed;\n } else {\n const secret = options.secureJsonData?.clientSecret;\n return typeof secret === 'string' && secret.length > 0 ? secret : undefined;\n }\n}\n\nexport function isCredentialsComplete(credentials: AzureCredentials): boolean {\n switch (credentials.authType) {\n case 'msi':\n return true;\n case 'clientsecret':\n return !!(credentials.azureCloud && credentials.tenantId && credentials.clientId && credentials.clientSecret);\n }\n}\n\nexport function getCredentials(options: AzureDataSourceSettings): AzureCredentials {\n const authType = getAuthType(options);\n switch (authType) {\n case 'msi':\n if (config.azure.managedIdentityEnabled) {\n return {\n authType: 'msi',\n defaultSubscriptionId: options.jsonData.subscriptionId,\n };\n } else {\n // If authentication type is managed identity but managed identities were disabled in Grafana config,\n // then we should fallback to an empty app registration (client secret) configuration\n return {\n authType: 'clientsecret',\n azureCloud: getDefaultAzureCloud(),\n };\n }\n case 'clientsecret':\n return {\n authType: 'clientsecret',\n azureCloud: options.jsonData.cloudName || getDefaultAzureCloud(),\n tenantId: options.jsonData.tenantId,\n clientId: options.jsonData.clientId,\n clientSecret: getSecret(options),\n defaultSubscriptionId: options.jsonData.subscriptionId,\n };\n }\n}\n\nexport function updateCredentials(\n options: AzureDataSourceSettings,\n credentials: AzureCredentials\n): AzureDataSourceSettings {\n switch (credentials.authType) {\n case 'msi':\n if (!config.azure.managedIdentityEnabled) {\n throw new Error('Managed Identity authentication is not enabled in Grafana config.');\n }\n\n options = {\n ...options,\n jsonData: {\n ...options.jsonData,\n azureAuthType: 'msi',\n subscriptionId: credentials.defaultSubscriptionId,\n },\n };\n\n return options;\n\n case 'clientsecret':\n options = {\n ...options,\n jsonData: {\n ...options.jsonData,\n azureAuthType: 'clientsecret',\n cloudName: credentials.azureCloud || getDefaultAzureCloud(),\n tenantId: credentials.tenantId,\n clientId: credentials.clientId,\n subscriptionId: credentials.defaultSubscriptionId,\n },\n secureJsonData: {\n ...options.secureJsonData,\n clientSecret:\n typeof credentials.clientSecret === 'string' && credentials.clientSecret.length > 0\n ? credentials.clientSecret\n : undefined,\n },\n secureJsonFields: {\n ...options.secureJsonFields,\n clientSecret: typeof credentials.clientSecret === 'symbol',\n },\n };\n\n return options;\n }\n}\n","import React, { ChangeEvent, FunctionComponent, useEffect, useReducer, useState } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { InlineFormLabel, LegacyForms, Button, Select } from '@grafana/ui';\n\nimport { isCredentialsComplete } from '../credentials';\nimport { AzureAuthType, AzureCredentials } from '../types';\nconst { Input } = LegacyForms;\n\nexport interface Props {\n managedIdentityEnabled: boolean;\n credentials: AzureCredentials;\n azureCloudOptions?: SelectableValue[];\n onCredentialsChange?: (updatedCredentials: AzureCredentials) => void;\n getSubscriptions?: () => Promise<SelectableValue[]>;\n disabled?: boolean;\n children?: JSX.Element;\n}\n\nconst authTypeOptions: Array<SelectableValue<AzureAuthType>> = [\n {\n value: 'msi',\n label: 'Managed Identity',\n },\n {\n value: 'clientsecret',\n label: 'App Registration',\n },\n];\n\nexport const AzureCredentialsForm: FunctionComponent<Props> = (props: Props) => {\n const { credentials, azureCloudOptions, onCredentialsChange, getSubscriptions, disabled } = props;\n const hasRequiredFields = isCredentialsComplete(credentials);\n\n const [subscriptions, setSubscriptions] = useState<Array<SelectableValue<string>>>([]);\n const [loadSubscriptionsClicked, onLoadSubscriptions] = useReducer((val) => val + 1, 0);\n useEffect(() => {\n if (!getSubscriptions || !hasRequiredFields) {\n updateSubscriptions([]);\n return;\n }\n let canceled = false;\n getSubscriptions().then((result) => {\n if (!canceled) {\n updateSubscriptions(result, loadSubscriptionsClicked);\n }\n });\n return () => {\n canceled = true;\n };\n // This effect is intended to be called only once initially and on Load Subscriptions click\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loadSubscriptionsClicked]);\n\n const updateSubscriptions = (received: Array<SelectableValue<string>>, autoSelect = false) => {\n setSubscriptions(received);\n if (getSubscriptions) {\n if (autoSelect && !credentials.defaultSubscriptionId && received.length > 0) {\n // Selecting the default subscription if subscriptions received but no default subscription selected\n onSubscriptionChange(received[0]);\n } else if (credentials.defaultSubscriptionId) {\n const found = received.find((opt) => opt.value === credentials.defaultSubscriptionId);\n if (!found) {\n // Unselecting the default subscription if it isn't found among the received subscriptions\n onSubscriptionChange(undefined);\n }\n }\n }\n };\n\n const onAuthTypeChange = (selected: SelectableValue<AzureAuthType>) => {\n if (onCredentialsChange) {\n setSubscriptions([]);\n const updated: AzureCredentials = {\n ...credentials,\n authType: selected.value || 'msi',\n defaultSubscriptionId: undefined,\n };\n onCredentialsChange(updated);\n }\n };\n\n const onAzureCloudChange = (selected: SelectableValue<string>) => {\n if (onCredentialsChange && credentials.authType === 'clientsecret') {\n setSubscriptions([]);\n const updated: AzureCredentials = {\n ...credentials,\n azureCloud: selected.value,\n defaultSubscriptionId: undefined,\n };\n onCredentialsChange(updated);\n }\n };\n\n const onTenantIdChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (onCredentialsChange && credentials.authType === 'clientsecret') {\n setSubscriptions([]);\n const updated: AzureCredentials = {\n ...credentials,\n tenantId: event.target.value,\n defaultSubscriptionId: undefined,\n };\n onCredentialsChange(updated);\n }\n };\n\n const onClientIdChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (onCredentialsChange && credentials.authType === 'clientsecret') {\n setSubscriptions([]);\n const updated: AzureCredentials = {\n ...credentials,\n clientId: event.target.value,\n defaultSubscriptionId: undefined,\n };\n onCredentialsChange(updated);\n }\n };\n\n const onClientSecretChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (onCredentialsChange && credentials.authType === 'clientsecret') {\n setSubscriptions([]);\n const updated: AzureCredentials = {\n ...credentials,\n clientSecret: event.target.value,\n defaultSubscriptionId: undefined,\n };\n onCredentialsChange(updated);\n }\n };\n\n const onClientSecretReset = () => {\n if (onCredentialsChange && credentials.authType === 'clientsecret') {\n setSubscriptions([]);\n const updated: AzureCredentials = {\n ...credentials,\n clientSecret: '',\n defaultSubscriptionId: undefined,\n };\n onCredentialsChange(updated);\n }\n };\n\n const onSubscriptionChange = (selected: SelectableValue<string> | undefined) => {\n if (onCredentialsChange) {\n const updated: AzureCredentials = {\n ...credentials,\n defaultSubscriptionId: selected?.value,\n };\n onCredentialsChange(updated);\n }\n };\n\n return (\n <div className=\"gf-form-group\">\n {props.managedIdentityEnabled && (\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <InlineFormLabel className=\"width-12\" tooltip=\"Choose the type of authentication to Azure services\">\n Authentication\n </InlineFormLabel>\n <Select\n className=\"width-15\"\n value={authTypeOptions.find((opt) => opt.value === credentials.authType)}\n options={authTypeOptions}\n onChange={onAuthTypeChange}\n disabled={disabled}\n />\n </div>\n </div>\n )}\n {credentials.authType === 'clientsecret' && (\n <>\n {azureCloudOptions && (\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <InlineFormLabel className=\"width-12\" tooltip=\"Choose an Azure Cloud\">\n Azure Cloud\n </InlineFormLabel>\n <Select\n aria-label=\"Azure Cloud\"\n className=\"width-15\"\n value={azureCloudOptions.find((opt) => opt.value === credentials.azureCloud)}\n options={azureCloudOptions}\n onChange={onAzureCloudChange}\n disabled={disabled}\n />\n </div>\n </div>\n )}\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <InlineFormLabel className=\"width-12\">Directory (tenant) ID</InlineFormLabel>\n <div className=\"width-15\">\n <Input\n className=\"width-30\"\n placeholder=\"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\"\n value={credentials.tenantId || ''}\n onChange={onTenantIdChange}\n disabled={disabled}\n />\n </div>\n </div>\n </div>\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <InlineFormLabel className=\"width-12\">Application (client) ID</InlineFormLabel>\n <div className=\"width-15\">\n <Input\n className=\"width-30\"\n placeholder=\"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\"\n value={credentials.clientId || ''}\n onChange={onClientIdChange}\n disabled={disabled}\n />\n </div>\n </div>\n </div>\n {!disabled &&\n (typeof credentials.clientSecret === 'symbol' ? (\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <InlineFormLabel className=\"width-12\">Client Secret</InlineFormLabel>\n <Input data-testid=\"client-secret\" className=\"width-25\" placeholder=\"configured\" disabled={true} />\n </div>\n <div className=\"gf-form\">\n <div className=\"max-width-30 gf-form-inline\">\n <Button variant=\"secondary\" type=\"button\" onClick={onClientSecretReset} disabled={disabled}>\n reset\n </Button>\n </div>\n </div>\n </div>\n ) : (\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <InlineFormLabel className=\"width-12\">Client Secret</InlineFormLabel>\n <div className=\"width-15\">\n <Input\n className=\"width-30\"\n placeholder=\"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\"\n value={credentials.clientSecret || ''}\n onChange={onClientSecretChange}\n disabled={disabled}\n />\n </div>\n </div>\n </div>\n ))}\n </>\n )}\n {getSubscriptions && (\n <>\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <InlineFormLabel className=\"width-12\">Default Subscription</InlineFormLabel>\n <div className=\"width-30\">\n <Select\n aria-label=\"Default Subscription\"\n value={\n credentials.defaultSubscriptionId\n ? subscriptions.find((opt) => opt.value === credentials.defaultSubscriptionId)\n : undefined\n }\n options={subscriptions}\n onChange={onSubscriptionChange}\n disabled={disabled}\n />\n </div>\n </div>\n </div>\n {!disabled && (\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <div className=\"max-width-30 gf-form-inline\">\n <Button\n variant=\"secondary\"\n size=\"sm\"\n type=\"button\"\n onClick={onLoadSubscriptions}\n disabled={!hasRequiredFields}\n >\n Load Subscriptions\n </Button>\n </div>\n </div>\n </div>\n )}\n </>\n )}\n {props.children}\n </div>\n );\n};\n\nexport default AzureCredentialsForm;\n","import React, { FunctionComponent, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { config } from '@grafana/runtime';\n\nimport { getCredentials, updateCredentials } from '../credentials';\nimport { AzureDataSourceSettings, AzureCredentials } from '../types';\n\nimport { AzureCredentialsForm } from './AzureCredentialsForm';\n\nconst azureClouds = [\n { value: 'azuremonitor', label: 'Azure' },\n { value: 'govazuremonitor', label: 'Azure US Government' },\n { value: 'germanyazuremonitor', label: 'Azure Germany' },\n { value: 'chinaazuremonitor', label: 'Azure China' },\n] as SelectableValue[];\n\nexport interface Props {\n options: AzureDataSourceSettings;\n updateOptions: (optionsFunc: (options: AzureDataSourceSettings) => AzureDataSourceSettings) => void;\n getSubscriptions: () => Promise<Array<SelectableValue<string>>>;\n}\n\nexport const MonitorConfig: FunctionComponent<Props> = (props: Props) => {\n const { updateOptions, getSubscriptions } = props;\n const credentials = useMemo(() => getCredentials(props.options), [props.options]);\n\n const onCredentialsChange = (credentials: AzureCredentials): void => {\n updateOptions((options) => updateCredentials(options, credentials));\n };\n\n return (\n <>\n <h3 className=\"page-heading\">Authentication</h3>\n <AzureCredentialsForm\n managedIdentityEnabled={config.azure.managedIdentityEnabled}\n credentials={credentials}\n azureCloudOptions={azureClouds}\n onCredentialsChange={onCredentialsChange}\n getSubscriptions={getSubscriptions}\n disabled={props.options.readOnly}\n />\n </>\n );\n};\n\nexport default MonitorConfig;\n","import React, { PureComponent } from 'react';\n\nimport { DataSourcePluginOptionsEditorProps, SelectableValue, updateDatasourcePluginOption } from '@grafana/data';\nimport { getBackendSrv, getTemplateSrv, TemplateSrv } from '@grafana/runtime';\nimport { Alert } from '@grafana/ui';\n\nimport ResponseParser from '../azure_monitor/response_parser';\nimport { AzureDataSourceJsonData, AzureDataSourceSecureJsonData, AzureDataSourceSettings } from '../types';\nimport { routeNames } from '../utils/common';\n\nimport { MonitorConfig } from './MonitorConfig';\n\nexport type Props = DataSourcePluginOptionsEditorProps<AzureDataSourceJsonData, AzureDataSourceSecureJsonData>;\n\ninterface ErrorMessage {\n title: string;\n description: string;\n details?: string;\n}\n\nexport interface State {\n unsaved: boolean;\n error?: ErrorMessage;\n}\n\nexport class ConfigEditor extends PureComponent<Props, State> {\n templateSrv: TemplateSrv = getTemplateSrv();\n baseURL: string;\n\n constructor(props: Props) {\n super(props);\n\n this.state = {\n unsaved: false,\n };\n this.baseURL = `/api/datasources/${this.props.options.id}/resources/${routeNames.azureMonitor}/subscriptions`;\n }\n\n private updateOptions = (optionsFunc: (options: AzureDataSourceSettings) => AzureDataSourceSettings): void => {\n const updated = optionsFunc(this.props.options);\n this.props.onOptionsChange(updated);\n\n this.setState({ unsaved: true });\n };\n\n private saveOptions = async (): Promise<void> => {\n if (this.state.unsaved) {\n await getBackendSrv()\n .put(`/api/datasources/${this.props.options.id}`, this.props.options)\n .then((result: { datasource: AzureDataSourceSettings }) => {\n updateDatasourcePluginOption(this.props, 'version', result.datasource.version);\n });\n\n this.setState({ unsaved: false });\n }\n };\n\n private getSubscriptions = async (): Promise<Array<SelectableValue<string>>> => {\n await this.saveOptions();\n\n const query = `?api-version=2019-03-01`;\n try {\n const result = await getBackendSrv()\n .fetch({\n url: this.baseURL + query,\n method: 'GET',\n })\n .toPromise();\n\n this.setState({ error: undefined });\n return ResponseParser.parseSubscriptionsForSelect(result);\n } catch (err) {\n this.setState({\n error: {\n title: 'Error requesting subscriptions',\n description: 'Could not request subscriptions from Azure. Check your credentials and try again.',\n details: err?.data?.message,\n },\n });\n return Promise.resolve([]);\n }\n };\n\n render() {\n const { options } = this.props;\n const { error } = this.state;\n\n return (\n <>\n <MonitorConfig options={options} updateOptions={this.updateOptions} getSubscriptions={this.getSubscriptions} />\n {error && (\n <Alert severity=\"error\" title={error.title}>\n <p>{error.description}</p>\n {error.details && <details style={{ whiteSpace: 'pre-wrap' }}>{error.details}</details>}\n </Alert>\n )}\n </>\n );\n }\n}\n\nexport default ConfigEditor;\n","import { useState, useCallback, useMemo } from 'react';\n\nimport { AzureMonitorErrorish } from '../types';\n\nimport { messageFromElement } from './messageFromError';\n\ntype SourcedError = [string, AzureMonitorErrorish];\n\nexport default function useLastError() {\n const [errors, setErrors] = useState<SourcedError[]>([]);\n\n // Handles errors from any child components that request data to display their options\n const addError = useCallback((errorSource: string, error: AzureMonitorErrorish | undefined) => {\n setErrors((errors) => {\n const errorsCopy = [...errors];\n const index = errors.findIndex(([vSource]) => vSource === errorSource);\n\n // If there's already an error, remove it. If we're setting a new error\n // below, we'll move it to the front\n if (index > -1) {\n errorsCopy.splice(index, 1);\n }\n\n // And then add the new error to the top of the array. If error is defined, it was already\n // removed above.\n if (error) {\n errorsCopy.unshift([errorSource, error]);\n }\n\n return errorsCopy;\n });\n }, []);\n\n const errorMessage = useMemo(() => {\n const recentError = errors[0];\n return recentError && messageFromElement(recentError[1]);\n }, [errors]);\n\n return [errorMessage, addError] as const;\n}\n","import React from 'react';\n\nimport { EditorField } from '@grafana/experimental';\nimport { InlineField } from '@grafana/ui';\nimport { Props as InlineFieldProps } from '@grafana/ui/src/components/Forms/InlineField';\n\ninterface Props extends InlineFieldProps {\n label: string;\n inlineField?: boolean;\n labelWidth?: number;\n}\n\nconst DEFAULT_LABEL_WIDTH = 18;\n\nexport const Field = (props: Props) => {\n const { labelWidth, inlineField, ...remainingProps } = props;\n\n if (!inlineField) {\n return <EditorField width={labelWidth || DEFAULT_LABEL_WIDTH} {...remainingProps} />;\n } else {\n return <InlineField labelWidth={labelWidth || DEFAULT_LABEL_WIDTH} {...remainingProps} />;\n }\n};\n","import React, { useCallback, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Select, MultiSelect } from '@grafana/ui';\n\nimport { AzureMonitorQuery, AzureQueryEditorFieldProps, AzureMonitorOption, AzureQueryType } from '../types';\nimport { findOptions } from '../utils/common';\n\nimport { Field } from './Field';\n\ninterface SubscriptionFieldProps extends AzureQueryEditorFieldProps {\n onQueryChange: (newQuery: AzureMonitorQuery) => void;\n subscriptions: AzureMonitorOption[];\n multiSelect?: boolean;\n}\n\nconst SubscriptionField: React.FC<SubscriptionFieldProps> = ({\n query,\n subscriptions,\n variableOptionGroup,\n onQueryChange,\n multiSelect = false,\n}) => {\n const handleChange = useCallback(\n (change: SelectableValue<string>) => {\n if (!change.value) {\n return;\n }\n\n let newQuery: AzureMonitorQuery = {\n ...query,\n subscription: change.value,\n };\n\n if (query.queryType === AzureQueryType.AzureMonitor) {\n newQuery.azureMonitor = {\n ...newQuery.azureMonitor,\n resourceGroup: undefined,\n metricDefinition: undefined,\n metricNamespace: undefined,\n resourceName: undefined,\n metricName: undefined,\n aggregation: undefined,\n timeGrain: '',\n dimensionFilters: [],\n };\n }\n\n onQueryChange(newQuery);\n },\n [query, onQueryChange]\n );\n\n const onSubscriptionsChange = useCallback(\n (change: Array<SelectableValue<string>>) => {\n if (!change) {\n return;\n }\n\n query.subscriptions = change.map((c) => c.value ?? '');\n\n onQueryChange(query);\n },\n [query, onQueryChange]\n );\n\n const options = useMemo(() => [...subscriptions, variableOptionGroup], [subscriptions, variableOptionGroup]);\n\n return multiSelect ? (\n <Field label=\"Subscriptions\">\n <MultiSelect\n isClearable\n value={findOptions([...subscriptions, ...variableOptionGroup.options], query.subscriptions)}\n inputId=\"azure-monitor-subscriptions-field\"\n onChange={onSubscriptionsChange}\n options={options}\n width={38}\n />\n </Field>\n ) : (\n <Field label=\"Subscription\">\n <Select\n value={query.subscription}\n inputId=\"azure-monitor-subscriptions-field\"\n onChange={handleChange}\n options={options}\n width={38}\n allowCustomValue\n />\n </Field>\n );\n};\n\nexport default SubscriptionField;\n","import React, { useCallback } from 'react';\n\nimport { CodeEditor } from '@grafana/ui';\n\nimport { AzureQueryEditorFieldProps } from '../../types';\n\nconst QueryField: React.FC<AzureQueryEditorFieldProps> = ({ query, onQueryChange }) => {\n const onChange = useCallback(\n (newQuery: string) => {\n onQueryChange({\n ...query,\n azureResourceGraph: {\n ...query.azureResourceGraph,\n query: newQuery,\n },\n });\n },\n [onQueryChange, query]\n );\n\n return (\n <CodeEditor\n value={query.azureResourceGraph?.query ?? ''}\n language=\"kusto\"\n height={200}\n width=\"100%\"\n showMiniMap={false}\n onBlur={onChange}\n onSave={onChange}\n />\n );\n};\n\nexport default QueryField;\n","import React, { useEffect, useState, useRef } from 'react';\n\nimport { EditorRows, EditorRow, EditorFieldGroup } from '@grafana/experimental';\n\nimport Datasource from '../../datasource';\nimport { AzureMonitorErrorish, AzureMonitorOption, AzureMonitorQuery } from '../../types';\nimport SubscriptionField from '../SubscriptionField';\n\nimport QueryField from './QueryField';\n\ninterface ArgQueryEditorProps {\n query: AzureMonitorQuery;\n datasource: Datasource;\n subscriptionId?: string;\n onChange: (newQuery: AzureMonitorQuery) => void;\n variableOptionGroup: { label: string; options: AzureMonitorOption[] };\n setError: (source: string, error: AzureMonitorErrorish | undefined) => void;\n}\n\nconst ERROR_SOURCE = 'arg-subscriptions';\nconst ArgQueryEditor: React.FC<ArgQueryEditorProps> = ({\n query,\n datasource,\n subscriptionId,\n variableOptionGroup,\n onChange,\n setError,\n}) => {\n const fetchedRef = useRef(false);\n const [subscriptions, setSubscriptions] = useState<AzureMonitorOption[]>([]);\n\n useEffect(() => {\n if (fetchedRef.current) {\n return;\n }\n\n fetchedRef.current = true;\n datasource.azureMonitorDatasource\n .getSubscriptions()\n .then((results) => {\n const fetchedSubscriptions = results.map((v) => ({ label: v.text, value: v.value, description: v.value }));\n setSubscriptions(fetchedSubscriptions);\n setError(ERROR_SOURCE, undefined);\n\n if (!query.subscriptions?.length && fetchedSubscriptions?.length) {\n onChange({\n ...query,\n subscriptions: [query.subscription ?? fetchedSubscriptions[0].value],\n });\n }\n })\n .catch((err) => setError(ERROR_SOURCE, err));\n }, [datasource, onChange, query, setError]);\n\n return (\n <span data-testid=\"azure-monitor-arg-query-editor-with-experimental-ui\">\n <EditorRows>\n <EditorRow>\n <EditorFieldGroup>\n <SubscriptionField\n multiSelect\n subscriptions={subscriptions}\n query={query}\n datasource={datasource}\n subscriptionId={subscriptionId}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n />\n </EditorFieldGroup>\n </EditorRow>\n </EditorRows>\n <QueryField\n query={query}\n datasource={datasource}\n subscriptionId={subscriptionId}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n />\n </span>\n );\n};\n\nexport default ArgQueryEditor;\n","import { css, cx } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { stylesFactory, useTheme2 } from '@grafana/ui';\n\nexport interface SpaceProps {\n v?: number;\n h?: number;\n layout?: 'block' | 'inline';\n}\n\nexport const Space = (props: SpaceProps) => {\n const theme = useTheme2();\n const styles = getStyles(theme, props);\n\n return <span className={cx(styles.wrapper)} />;\n};\n\nSpace.defaultProps = {\n v: 0,\n h: 0,\n layout: 'block',\n};\n\nconst getStyles = stylesFactory((theme: GrafanaTheme2, props: SpaceProps) => ({\n wrapper: css([\n {\n paddingRight: theme.spacing(props.h ?? 0),\n paddingBottom: theme.spacing(props.v ?? 0),\n },\n props.layout === 'inline' && {\n display: 'inline-block',\n },\n props.layout === 'block' && {\n display: 'block',\n },\n ]),\n}));\n","export enum ResourceRowType {\n Subscription = 'Subscription',\n ResourceGroup = 'ResourceGroup',\n Resource = 'Resource',\n VariableGroup = 'TemplateVariableGroup',\n Variable = 'TemplateVariable',\n}\n\nexport interface ResourceRow {\n id: string; // azure's raw data id usually passes along a uri (except in the case of subscriptions), to make things less confusing for ourselves we parse the id string out of the uri or vice versa\n uri: string; // ex: /subscriptions/subid123\n name: string;\n type: ResourceRowType;\n typeLabel: string;\n location?: string;\n children?: ResourceRowGroup;\n}\n\nexport type ResourceRowGroup = ResourceRow[];\n","import React from 'react';\n\nimport { Icon } from '@grafana/ui';\n\nimport { ResourceRow, ResourceRowType } from './types';\n\ninterface EntryIconProps {\n entry: ResourceRow;\n isOpen: boolean;\n}\n\nexport const EntryIcon: React.FC<EntryIconProps> = ({ isOpen, entry: { type } }) => {\n switch (type) {\n case ResourceRowType.Subscription:\n return <Icon name=\"layer-group\" />;\n\n case ResourceRowType.ResourceGroup:\n return <Icon name={isOpen ? 'folder-open' : 'folder'} />;\n\n case ResourceRowType.Resource:\n return <Icon name=\"cube\" />;\n\n case ResourceRowType.VariableGroup:\n return <Icon name=\"x\" />;\n\n case ResourceRowType.Variable:\n return <Icon name=\"x\" />;\n\n default:\n return null;\n }\n};\n","import { css } from '@emotion/css';\n\nimport { GrafanaTheme2 } from '@grafana/data';\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n table: css({\n width: '100%',\n tableLayout: 'fixed',\n }),\n\n tableScroller: css({\n maxHeight: '50vh',\n overflow: 'auto',\n }),\n\n header: css({\n background: theme.colors.background.secondary,\n }),\n\n row: css({\n borderBottom: `1px solid ${theme.colors.border.weak}`,\n\n '&:last-of-type': {\n borderBottomColor: theme.colors.border.medium,\n },\n }),\n\n disabledRow: css({\n opacity: 0.5,\n }),\n\n cell: css({\n padding: theme.spacing(1, 1, 1, 0),\n width: '25%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n '&:first-of-type': {\n width: '50%',\n padding: theme.spacing(1, 1, 1, 2),\n },\n }),\n\n collapseButton: css({ margin: 0 }),\n\n loadingCell: css({\n textAlign: 'center',\n }),\n\n spinner: css({\n marginBottom: 0,\n }),\n\n nestedEntry: css({\n display: 'flex',\n alignItems: 'center',\n }),\n\n entryContentItem: css({\n margin: theme.spacing(0, 1, 0, 0),\n }),\n\n truncated: css({\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n }),\n\n resourceField: css({\n maxWidth: theme.spacing(36),\n overflow: 'hidden',\n }),\n\n resourceFieldButton: css({\n padding: '7px',\n textAlign: 'left',\n }),\n\n nestedRowCheckbox: css({\n zIndex: 0,\n }),\n\n selectionFooter: css({\n position: 'sticky',\n bottom: 0,\n background: theme.colors.background.primary,\n paddingTop: theme.spacing(2),\n }),\n\n loadingWrapper: css({\n textAlign: 'center',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n color: theme.colors.text.secondary,\n }),\n\n resultLimit: css({\n margin: '4px 0',\n fontStyle: 'italic',\n }),\n\n modal: css({\n width: theme.breakpoints.values.lg,\n }),\n});\n\nexport default getStyles;\n","import { cx } from '@emotion/css';\nimport React, { useCallback, useEffect } from 'react';\n\nimport { Checkbox, IconButton, useStyles2, useTheme2 } from '@grafana/ui';\n\nimport { Space } from '../Space';\n\nimport { EntryIcon } from './EntryIcon';\nimport getStyles from './styles';\nimport { ResourceRow } from './types';\n\ninterface NestedEntryProps {\n level: number;\n entry: ResourceRow;\n isSelected: boolean;\n isSelectable: boolean;\n isOpen: boolean;\n isDisabled: boolean;\n scrollIntoView?: boolean;\n onToggleCollapse: (row: ResourceRow) => void;\n onSelectedChange: (row: ResourceRow, selected: boolean) => void;\n}\n\nexport const NestedEntry: React.FC<NestedEntryProps> = ({\n entry,\n isSelected,\n isDisabled,\n isOpen,\n isSelectable,\n level,\n scrollIntoView,\n onToggleCollapse,\n onSelectedChange,\n}) => {\n const theme = useTheme2();\n const styles = useStyles2(getStyles);\n const hasChildren = !!entry.children;\n\n const handleToggleCollapse = useCallback(() => {\n onToggleCollapse(entry);\n }, [onToggleCollapse, entry]);\n\n const handleSelectedChanged = useCallback(\n (ev: React.ChangeEvent<HTMLInputElement>) => {\n const isSelected = ev.target.checked;\n onSelectedChange(entry, isSelected);\n },\n [entry, onSelectedChange]\n );\n\n const checkboxId = `${scrollIntoView ? 'table' : 'summary'}_checkbox_${entry.uri}`;\n\n // Scroll to the selected element if it's not in the view\n // Only do it once, when the component is mounted\n useEffect(() => {\n if (isSelected && scrollIntoView) {\n document.getElementById(checkboxId)?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n });\n }\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <div className={styles.nestedEntry} style={{ marginLeft: level * (3 * theme.spacing.gridSize) }}>\n {hasChildren ? (\n <IconButton\n className={styles.collapseButton}\n name={isOpen ? 'angle-down' : 'angle-right'}\n aria-label={isOpen ? `Collapse ${entry.name}` : `Expand ${entry.name}`}\n onClick={handleToggleCollapse}\n id={entry.id}\n />\n ) : (\n <Space layout=\"inline\" h={2} />\n )}\n\n <Space layout=\"inline\" h={2} />\n\n {isSelectable && (\n <>\n <Checkbox\n id={checkboxId}\n onChange={handleSelectedChanged}\n disabled={isDisabled}\n value={isSelected}\n className={styles.nestedRowCheckbox}\n />\n <Space layout=\"inline\" h={2} />\n </>\n )}\n\n <EntryIcon entry={entry} isOpen={isOpen} />\n <Space layout=\"inline\" h={1} />\n\n <label htmlFor={checkboxId} className={cx(styles.entryContentItem, styles.truncated)}>\n {entry.name}\n </label>\n </div>\n );\n};\n","import produce from 'immer';\n\nimport { ResourceRow, ResourceRowGroup } from './types';\n\n// This regex matches URIs representing:\n// - subscriptions: /subscriptions/44693801-6ee6-49de-9b2d-9106972f9572\n// - resource groups: /subscriptions/44693801-6ee6-49de-9b2d-9106972f9572/resourceGroups/cloud-datasources\n// - resources: /subscriptions/44693801-6ee6-49de-9b2d-9106972f9572/resourceGroups/cloud-datasources/providers/Microsoft.Compute/virtualMachines/GithubTestDataVM\nconst RESOURCE_URI_REGEX =\n /\\/subscriptions\\/(?<subscriptionID>[^/]+)(?:\\/resourceGroups\\/(?<resourceGroup>[^/]+)(?:\\/providers.+\\/(?<resource>[^/]+))?)?/;\n\ntype RegexGroups = Record<string, string | undefined>;\n\nexport function parseResourceURI(resourceURI: string) {\n const matches = RESOURCE_URI_REGEX.exec(resourceURI);\n const groups: RegexGroups = matches?.groups ?? {};\n const { subscriptionID, resourceGroup, resource } = groups;\n\n if (!subscriptionID) {\n return undefined;\n }\n\n return { subscriptionID, resourceGroup, resource };\n}\n\nexport function isGUIDish(input: string) {\n return !!input.match(/^[A-Z0-9]+/i);\n}\n\nexport function findRow(rows: ResourceRowGroup, uri: string): ResourceRow | undefined {\n for (const row of rows) {\n if (row.uri.toLowerCase() === uri.toLowerCase()) {\n return row;\n }\n\n if (row.children) {\n const result = findRow(row.children, uri);\n\n if (result) {\n return result;\n }\n }\n }\n\n return undefined;\n}\n\nexport function addResources(rows: ResourceRowGroup, targetParentId: string, newResources: ResourceRowGroup) {\n return produce(rows, (draftState) => {\n const draftRow = findRow(draftState, targetParentId);\n\n // we can't find the selected resource in our list of resources,\n // probably means user has either mistyped in the input field\n // or is using template variables.\n // either way no need to throw, just show that none of the resources are checked\n if (!draftRow) {\n return;\n }\n\n draftRow.children = newResources;\n });\n}\n","import { cx } from '@emotion/css';\nimport React, { useEffect, useState } from 'react';\n\nimport { FadeTransition, LoadingPlaceholder, useStyles2 } from '@grafana/ui';\n\nimport { NestedEntry } from './NestedEntry';\nimport getStyles from './styles';\nimport { ResourceRow, ResourceRowGroup, ResourceRowType } from './types';\nimport { findRow } from './utils';\n\ninterface NestedRowProps {\n row: ResourceRow;\n level: number;\n selectedRows: ResourceRowGroup;\n requestNestedRows: (row: ResourceRow) => Promise<void>;\n onRowSelectedChange: (row: ResourceRow, selected: boolean) => void;\n selectableEntryTypes: ResourceRowType[];\n scrollIntoView?: boolean;\n}\n\nconst NestedRow: React.FC<NestedRowProps> = ({\n row,\n selectedRows,\n level,\n requestNestedRows,\n onRowSelectedChange,\n selectableEntryTypes,\n scrollIntoView,\n}) => {\n const styles = useStyles2(getStyles);\n const [rowStatus, setRowStatus] = useState<'open' | 'closed' | 'loading'>('closed');\n\n const isSelected = !!selectedRows.find((v) => v.uri === row.uri);\n const isDisabled = selectedRows.length > 0 && !isSelected;\n const isOpen = rowStatus === 'open';\n\n const onRowToggleCollapse = async () => {\n if (rowStatus === 'open') {\n setRowStatus('closed');\n return;\n }\n setRowStatus('loading');\n requestNestedRows(row)\n .then(() => setRowStatus('open'))\n .catch(() => setRowStatus('closed'));\n };\n\n // opens the resource group on load of component if there was a previously saved selection\n useEffect(() => {\n // Assuming we don't have multi-select yet\n const selectedRow = selectedRows[0];\n\n const containsChild = selectedRow && !!findRow(row.children ?? [], selectedRow.uri);\n\n if (containsChild) {\n setRowStatus('open');\n }\n }, [selectedRows, row]);\n\n return (\n <>\n <tr className={cx(styles.row, isDisabled && styles.disabledRow)} key={row.id}>\n <td className={styles.cell}>\n <NestedEntry\n level={level}\n isSelected={isSelected}\n isDisabled={isDisabled}\n isOpen={isOpen}\n entry={row}\n onToggleCollapse={onRowToggleCollapse}\n onSelectedChange={onRowSelectedChange}\n isSelectable={selectableEntryTypes.some((type) => type === row.type)}\n scrollIntoView={scrollIntoView}\n />\n </td>\n\n <td className={styles.cell}>{row.typeLabel}</td>\n\n <td className={styles.cell}>{row.location ?? '-'}</td>\n </tr>\n\n {isOpen &&\n row.children &&\n Object.keys(row.children).length > 0 &&\n row.children.map((childRow) => (\n <NestedRow\n key={childRow.uri}\n row={childRow}\n selectedRows={selectedRows}\n level={level + 1}\n requestNestedRows={requestNestedRows}\n onRowSelectedChange={onRowSelectedChange}\n selectableEntryTypes={selectableEntryTypes}\n scrollIntoView={scrollIntoView}\n />\n ))}\n\n <FadeTransition visible={rowStatus === 'loading'}>\n <tr>\n <td className={cx(styles.cell, styles.loadingCell)} colSpan={3}>\n <LoadingPlaceholder text=\"Loading...\" className={styles.spinner} />\n </td>\n </tr>\n </FadeTransition>\n </>\n );\n};\n\nexport default NestedRow;\n","import { debounce } from 'lodash';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { Icon, Input } from '@grafana/ui';\n\nconst Search = ({ searchFn }: { searchFn: (searchPhrase: string) => void }) => {\n const [searchFilter, setSearchFilter] = useState('');\n\n const debouncedSearch = useMemo(() => debounce(searchFn, 600), [searchFn]);\n useEffect(() => {\n return () => {\n // Stop the invocation of the debounced function after unmounting\n debouncedSearch.cancel();\n };\n }, [debouncedSearch]);\n\n return (\n <Input\n aria-label=\"resource search\"\n prefix={<Icon name=\"search\" />}\n value={searchFilter}\n onChange={(event) => {\n const searchPhrase = event.currentTarget.value;\n setSearchFilter(searchPhrase);\n debouncedSearch(searchPhrase);\n }}\n placeholder=\"search for a resource\"\n />\n );\n};\n\nexport default Search;\n","import { cx } from '@emotion/css';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { useEffectOnce } from 'react-use';\n\nimport { Alert, Button, Icon, Input, LoadingPlaceholder, Tooltip, useStyles2, Collapse, Label } from '@grafana/ui';\n\nimport ResourcePickerData, { ResourcePickerQueryType } from '../../resourcePicker/resourcePickerData';\nimport messageFromError from '../../utils/messageFromError';\nimport { Space } from '../Space';\n\nimport NestedRow from './NestedRow';\nimport Search from './Search';\nimport getStyles from './styles';\nimport { ResourceRow, ResourceRowGroup, ResourceRowType } from './types';\nimport { findRow } from './utils';\n\ninterface ResourcePickerProps {\n resourcePickerData: ResourcePickerData;\n resourceURI: string | undefined;\n selectableEntryTypes: ResourceRowType[];\n queryType: ResourcePickerQueryType;\n\n onApply: (resourceURI: string | undefined) => void;\n onCancel: () => void;\n}\n\nconst ResourcePicker = ({\n resourcePickerData,\n resourceURI,\n onApply,\n onCancel,\n selectableEntryTypes,\n queryType,\n}: ResourcePickerProps) => {\n const styles = useStyles2(getStyles);\n\n const [isLoading, setIsLoading] = useState(false);\n const [rows, setRows] = useState<ResourceRowGroup>([]);\n const [selectedRows, setSelectedRows] = useState<ResourceRowGroup>([]);\n const [internalSelectedURI, setInternalSelectedURI] = useState<string | undefined>(resourceURI);\n const [errorMessage, setErrorMessage] = useState<string | undefined>(undefined);\n const [isAdvancedOpen, setIsAdvancedOpen] = useState(resourceURI?.includes('$'));\n const [shouldShowLimitFlag, setShouldShowLimitFlag] = useState(false);\n\n // Sync the resourceURI prop to internal state\n useEffect(() => {\n setInternalSelectedURI(resourceURI);\n }, [resourceURI]);\n\n const loadInitialData = useCallback(async () => {\n if (!isLoading) {\n try {\n setIsLoading(true);\n const resources = await resourcePickerData.fetchInitialRows(queryType, internalSelectedURI || '');\n setRows(resources);\n } catch (error) {\n setErrorMessage(messageFromError(error));\n }\n setIsLoading(false);\n }\n }, [internalSelectedURI, isLoading, resourcePickerData, queryType]);\n\n useEffectOnce(() => {\n loadInitialData();\n });\n\n // set selected row data whenever row or selection changes\n useEffect(() => {\n if (!internalSelectedURI) {\n setSelectedRows([]);\n }\n\n const found = internalSelectedURI && findRow(rows, internalSelectedURI);\n if (found) {\n return setSelectedRows([\n {\n ...found,\n children: undefined,\n },\n ]);\n }\n }, [internalSelectedURI, rows]);\n\n // Request resources for an expanded resource group\n const requestNestedRows = useCallback(\n async (parentRow: ResourceRow) => {\n // clear error message (also when loading cached resources)\n setErrorMessage(undefined);\n\n // If we already have children, we don't need to re-fetch them.\n if (parentRow.children?.length) {\n return;\n }\n\n try {\n const nestedRows = await resourcePickerData.fetchAndAppendNestedRow(rows, parentRow, queryType);\n setRows(nestedRows);\n } catch (error) {\n setErrorMessage(messageFromError(error));\n throw error;\n }\n },\n [resourcePickerData, rows, queryType]\n );\n\n const handleSelectionChanged = useCallback((row: ResourceRow, isSelected: boolean) => {\n isSelected ? setInternalSelectedURI(row.uri) : setInternalSelectedURI(undefined);\n }, []);\n\n const handleApply = useCallback(() => {\n onApply(internalSelectedURI);\n }, [internalSelectedURI, onApply]);\n\n const handleSearch = useCallback(\n async (searchWord: string) => {\n // clear errors and warnings\n setErrorMessage(undefined);\n setShouldShowLimitFlag(false);\n\n if (!searchWord) {\n loadInitialData();\n return;\n }\n\n try {\n setIsLoading(true);\n const searchResults = await resourcePickerData.search(searchWord, queryType);\n setRows(searchResults);\n if (searchResults.length >= resourcePickerData.resultLimit) {\n setShouldShowLimitFlag(true);\n }\n } catch (err) {\n setErrorMessage(messageFromError(err));\n }\n setIsLoading(false);\n },\n [loadInitialData, resourcePickerData, queryType]\n );\n\n return (\n <div>\n <Search searchFn={handleSearch} />\n {shouldShowLimitFlag ? (\n <p className={styles.resultLimit}>Showing first {resourcePickerData.resultLimit} results</p>\n ) : (\n <Space v={2} />\n )}\n\n <table className={styles.table}>\n <thead>\n <tr className={cx(styles.row, styles.header)}>\n <td className={styles.cell}>Scope</td>\n <td className={styles.cell}>Type</td>\n <td className={styles.cell}>Location</td>\n </tr>\n </thead>\n </table>\n\n <div className={styles.tableScroller}>\n <table className={styles.table}>\n <tbody>\n {isLoading && (\n <tr className={cx(styles.row)}>\n <td className={styles.cell}>\n <LoadingPlaceholder text={'Loading...'} />\n </td>\n </tr>\n )}\n {!isLoading && rows.length === 0 && (\n <tr className={cx(styles.row)}>\n <td className={styles.cell} aria-live=\"polite\">\n No resources found\n </td>\n </tr>\n )}\n {!isLoading &&\n rows.map((row) => (\n <NestedRow\n key={row.uri}\n row={row}\n selectedRows={selectedRows}\n level={0}\n requestNestedRows={requestNestedRows}\n onRowSelectedChange={handleSelectionChanged}\n selectableEntryTypes={selectableEntryTypes}\n scrollIntoView={true}\n />\n ))}\n </tbody>\n </table>\n </div>\n\n <div className={styles.selectionFooter}>\n {selectedRows.length > 0 && (\n <>\n <h5>Selection</h5>\n\n <div className={styles.tableScroller}>\n <table className={styles.table}>\n <tbody>\n {selectedRows.map((row) => (\n <NestedRow\n key={row.uri}\n row={row}\n selectedRows={selectedRows}\n level={0}\n requestNestedRows={requestNestedRows}\n onRowSelectedChange={handleSelectionChanged}\n selectableEntryTypes={selectableEntryTypes}\n />\n ))}\n </tbody>\n </table>\n </div>\n <Space v={2} />\n </>\n )}\n\n <Collapse\n collapsible\n label=\"Advanced\"\n isOpen={isAdvancedOpen}\n onToggle={() => setIsAdvancedOpen(!isAdvancedOpen)}\n >\n <Label htmlFor={`input-${internalSelectedURI}`}>\n <h6>\n Resource URI{' '}\n <Tooltip\n content={\n <>\n Manually edit the{' '}\n <a\n href=\"https://docs.microsoft.com/en-us/azure/azure-monitor/logs/log-standard-columns#_resourceid\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n resource uri.{' '}\n </a>\n Supports the use of multiple template variables (ex: /subscriptions/$subId/resourceGroups/$rg)\n </>\n }\n placement=\"right\"\n interactive={true}\n >\n <Icon name=\"info-circle\" />\n </Tooltip>\n </h6>\n </Label>\n <Input\n id={`input-${internalSelectedURI}`}\n value={internalSelectedURI}\n onChange={(event) => setInternalSelectedURI(event.currentTarget.value)}\n placeholder=\"ex: /subscriptions/$subId\"\n />\n <Space v={2} />\n </Collapse>\n <Space v={2} />\n\n <Button disabled={!!errorMessage} onClick={handleApply}>\n Apply\n </Button>\n\n <Space layout=\"inline\" h={1} />\n\n <Button onClick={onCancel} variant=\"secondary\">\n Cancel\n </Button>\n </div>\n\n {errorMessage && (\n <>\n <Space v={2} />\n <Alert severity=\"error\" title=\"An error occurred while requesting resources from Azure Monitor\">\n {errorMessage}\n </Alert>\n </>\n )}\n </div>\n );\n};\n\nexport default ResourcePicker;\n","import { cx } from '@emotion/css';\nimport React, { useCallback, useEffect, useState } from 'react';\n\nimport { Button, Icon, Modal, useStyles2 } from '@grafana/ui';\n\nimport Datasource from '../../datasource';\nimport { ResourcePickerQueryType } from '../../resourcePicker/resourcePickerData';\nimport { AzureQueryEditorFieldProps, AzureMonitorQuery, AzureResourceSummaryItem } from '../../types';\nimport { Field } from '../Field';\nimport ResourcePicker from '../ResourcePicker';\nimport getStyles from '../ResourcePicker/styles';\nimport { ResourceRowType } from '../ResourcePicker/types';\nimport { parseResourceURI } from '../ResourcePicker/utils';\n\nfunction parseResourceDetails(resourceURI: string) {\n const parsed = parseResourceURI(resourceURI);\n\n if (!parsed) {\n return undefined;\n }\n\n return {\n subscriptionName: parsed.subscriptionID,\n resourceGroupName: parsed.resourceGroup,\n resourceName: parsed.resource,\n };\n}\n\ninterface ResourceFieldProps extends AzureQueryEditorFieldProps {\n setResource: (query: AzureMonitorQuery, resourceURI?: string) => AzureMonitorQuery;\n selectableEntryTypes: ResourceRowType[];\n queryType: ResourcePickerQueryType;\n resourceUri?: string;\n inlineField?: boolean;\n labelWidth?: number;\n}\n\nconst ResourceField: React.FC<ResourceFieldProps> = ({\n query,\n datasource,\n onQueryChange,\n setResource,\n selectableEntryTypes,\n queryType,\n resourceUri,\n inlineField,\n labelWidth,\n}) => {\n const styles = useStyles2(getStyles);\n const [pickerIsOpen, setPickerIsOpen] = useState(false);\n\n const handleOpenPicker = useCallback(() => {\n setPickerIsOpen(true);\n }, []);\n\n const closePicker = useCallback(() => {\n setPickerIsOpen(false);\n }, []);\n\n const handleApply = useCallback(\n (resourceURI: string | undefined) => {\n onQueryChange(setResource(query, resourceURI));\n closePicker();\n },\n [closePicker, onQueryChange, query, setResource]\n );\n\n return (\n <>\n <Modal\n className={styles.modal}\n title=\"Select a resource\"\n isOpen={pickerIsOpen}\n onDismiss={closePicker}\n // The growing number of rows added to the modal causes a focus\n // error in the modal, making it impossible to click on new elements\n trapFocus={false}\n >\n <ResourcePicker\n resourcePickerData={datasource.resourcePickerData}\n resourceURI={resourceUri}\n onApply={handleApply}\n onCancel={closePicker}\n selectableEntryTypes={selectableEntryTypes}\n queryType={queryType}\n />\n </Modal>\n <Field label=\"Resource\" inlineField={inlineField} labelWidth={labelWidth}>\n <Button className={styles.resourceFieldButton} variant=\"secondary\" onClick={handleOpenPicker} type=\"button\">\n <ResourceLabel resource={resourceUri} datasource={datasource} />\n </Button>\n </Field>\n </>\n );\n};\n\ninterface ResourceLabelProps {\n resource: string | undefined;\n datasource: Datasource;\n}\n\nconst ResourceLabel = ({ resource, datasource }: ResourceLabelProps) => {\n const [resourceComponents, setResourceComponents] = useState(parseResourceDetails(resource ?? ''));\n\n useEffect(() => {\n if (resource && parseResourceDetails(resource)) {\n datasource.resourcePickerData.getResourceURIDisplayProperties(resource).then(setResourceComponents);\n } else {\n setResourceComponents(undefined);\n }\n }, [datasource.resourcePickerData, resource]);\n\n if (!resource) {\n return <>Select a resource</>;\n }\n\n if (resourceComponents) {\n return <FormattedResource resource={resourceComponents} />;\n }\n\n if (resource.startsWith('$')) {\n return (\n <span>\n <Icon name=\"x\" /> {resource}\n </span>\n );\n }\n\n return <>{resource}</>;\n};\n\ninterface FormattedResourceProps {\n resource: AzureResourceSummaryItem;\n}\n\nconst FormattedResource = ({ resource }: FormattedResourceProps) => {\n const styles = useStyles2(getStyles);\n\n if (resource.resourceName) {\n return (\n <span className={cx(styles.truncated, styles.resourceField)}>\n <Icon name=\"cube\" /> {resource.resourceName}\n </span>\n );\n }\n if (resource.resourceGroupName) {\n return (\n <span>\n <Icon name=\"folder\" /> {resource.resourceGroupName}\n </span>\n );\n }\n return (\n <span>\n <Icon name=\"layer-group\" /> {resource.subscriptionName}\n </span>\n );\n};\n\nexport default ResourceField;\n","import { AzureMonitorQuery } from '../../types';\n\nexport function setKustoQuery(query: AzureMonitorQuery, kustoQuery: string): AzureMonitorQuery {\n return {\n ...query,\n azureLogAnalytics: {\n ...query.azureLogAnalytics,\n query: kustoQuery,\n },\n };\n}\n\nexport function setFormatAs(query: AzureMonitorQuery, formatAs: string): AzureMonitorQuery {\n return {\n ...query,\n azureLogAnalytics: {\n ...query.azureLogAnalytics,\n resultFormat: formatAs,\n },\n };\n}\n\nexport function setResource(query: AzureMonitorQuery, resourceURI: string | undefined): AzureMonitorQuery {\n return {\n ...query,\n azureLogAnalytics: {\n ...query.azureLogAnalytics,\n resource: resourceURI,\n },\n };\n}\n","import React, { useCallback, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Select } from '@grafana/ui';\n\nimport { AzureQueryEditorFieldProps } from '../../types';\nimport { Field } from '../Field';\n\nimport { setFormatAs } from './setQueryValue';\n\nconst FORMAT_OPTIONS: Array<SelectableValue<string>> = [\n { label: 'Time series', value: 'time_series' },\n { label: 'Table', value: 'table' },\n];\n\nconst FormatAsField: React.FC<AzureQueryEditorFieldProps> = ({ query, variableOptionGroup, onQueryChange }) => {\n const options = useMemo(() => [...FORMAT_OPTIONS, variableOptionGroup], [variableOptionGroup]);\n\n const handleChange = useCallback(\n (change: SelectableValue<string>) => {\n const { value } = change;\n if (!value) {\n return;\n }\n\n const newQuery = setFormatAs(query, value);\n onQueryChange(newQuery);\n },\n [onQueryChange, query]\n );\n\n return (\n <Field label=\"Format as\">\n <Select\n inputId=\"azure-monitor-logs-workspaces-field\"\n value={query.azureLogAnalytics?.resultFormat}\n onChange={handleChange}\n options={options}\n width={38}\n />\n </Field>\n );\n};\n\nexport default FormatAsField;\n","export class Deferred<T = any> {\n resolve?: (reason: T | PromiseLike<T>) => void;\n reject?: (reason?: any) => void;\n promise: Promise<T>;\n\n constructor() {\n this.resolve = undefined;\n this.reject = undefined;\n\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n Object.freeze(this);\n }\n}\n","import React, { useCallback, useEffect, useRef } from 'react';\n\nimport { CodeEditor, Monaco, MonacoEditor } from '@grafana/ui';\nimport { Deferred } from 'app/core/utils/deferred';\n\nimport { AzureQueryEditorFieldProps } from '../../types';\n\nimport { setKustoQuery } from './setQueryValue';\n\ninterface MonacoPromise {\n editor: MonacoEditor;\n monaco: Monaco;\n}\n\ninterface MonacoLanguages {\n kusto: {\n getKustoWorker: () => Promise<\n (url: any) => Promise<{\n setSchema: (schema: any, clusterUrl: string, name: string) => void;\n }>\n >;\n };\n}\n\nconst QueryField: React.FC<AzureQueryEditorFieldProps> = ({ query, datasource, onQueryChange }) => {\n const monacoPromiseRef = useRef<Deferred<MonacoPromise>>();\n function getPromise() {\n if (!monacoPromiseRef.current) {\n monacoPromiseRef.current = new Deferred<MonacoPromise>();\n }\n\n return monacoPromiseRef.current.promise;\n }\n\n useEffect(() => {\n if (!query.azureLogAnalytics?.resource) {\n return;\n }\n\n const promises = [\n datasource.azureLogAnalyticsDatasource.getKustoSchema(query.azureLogAnalytics.resource),\n getPromise(),\n ] as const;\n\n // the kusto schema call might fail, but its okay for that to happen silently\n Promise.all(promises).then(([schema, { monaco, editor }]) => {\n const languages = monaco.languages as unknown as MonacoLanguages;\n\n languages.kusto\n .getKustoWorker()\n .then((kusto) => {\n const model = editor.getModel();\n return model && kusto(model.uri);\n })\n .then((worker) => {\n worker?.setSchema(schema, 'https://help.kusto.windows.net', 'Samples');\n });\n });\n }, [datasource.azureLogAnalyticsDatasource, query.azureLogAnalytics?.resource]);\n\n const handleEditorMount = useCallback((editor: MonacoEditor, monaco: Monaco) => {\n monacoPromiseRef.current?.resolve?.({ editor, monaco });\n }, []);\n\n const onChange = useCallback(\n (newQuery: string) => {\n onQueryChange(setKustoQuery(query, newQuery));\n },\n [onQueryChange, query]\n );\n\n return (\n <CodeEditor\n value={query.azureLogAnalytics?.query ?? ''}\n language=\"kusto\"\n height={200}\n width=\"100%\"\n showMiniMap={false}\n onBlur={onChange}\n onSave={onChange}\n onEditorDidMount={handleEditorMount}\n />\n );\n};\n\nexport default QueryField;\n","import { useEffect, useState } from 'react';\n\nimport Datasource from '../../datasource';\nimport { AzureMonitorQuery } from '../../types';\nimport { isGUIDish } from '../ResourcePicker/utils';\n\nasync function migrateWorkspaceQueryToResourceQuery(\n datasource: Datasource,\n query: AzureMonitorQuery,\n onChange: (newQuery: AzureMonitorQuery) => void\n) {\n if (query.azureLogAnalytics?.workspace !== undefined && !query.azureLogAnalytics.resource) {\n const isWorkspaceGUID = isGUIDish(query.azureLogAnalytics.workspace);\n let resource: string;\n\n if (isWorkspaceGUID) {\n resource = await datasource.resourcePickerData.getResourceURIFromWorkspace(query.azureLogAnalytics.workspace);\n } else {\n // The value of workspace is probably a template variable so we just migrate it over as-is\n resource = query.azureLogAnalytics.workspace;\n }\n\n const newQuery = {\n ...query,\n azureLogAnalytics: {\n ...query.azureLogAnalytics,\n resource: resource,\n workspace: undefined,\n },\n };\n\n delete newQuery.azureLogAnalytics.workspace;\n\n onChange(newQuery);\n }\n}\n\ninterface ErrorMessage {\n title: string;\n message: string;\n}\n\nexport default function useMigrations(\n datasource: Datasource,\n query: AzureMonitorQuery,\n onChange: (newQuery: AzureMonitorQuery) => void\n) {\n const [migrationError, setMigrationError] = useState<ErrorMessage>();\n\n useEffect(() => {\n migrateWorkspaceQueryToResourceQuery(datasource, query, onChange).catch((err) =>\n setMigrationError({\n title: 'Unable to migrate workspace as a resource',\n message: err.message,\n })\n );\n }, [datasource, query, onChange]);\n\n return migrationError;\n}\n","import React from 'react';\n\nimport { EditorRows, EditorRow, EditorFieldGroup } from '@grafana/experimental';\nimport { Alert } from '@grafana/ui';\n\nimport Datasource from '../../datasource';\nimport { AzureMonitorErrorish, AzureMonitorOption, AzureMonitorQuery } from '../../types';\nimport ResourceField from '../ResourceField';\nimport { ResourceRowType } from '../ResourcePicker/types';\n\nimport FormatAsField from './FormatAsField';\nimport QueryField from './QueryField';\nimport { setResource } from './setQueryValue';\nimport useMigrations from './useMigrations';\n\ninterface LogsQueryEditorProps {\n query: AzureMonitorQuery;\n datasource: Datasource;\n subscriptionId?: string;\n onChange: (newQuery: AzureMonitorQuery) => void;\n variableOptionGroup: { label: string; options: AzureMonitorOption[] };\n setError: (source: string, error: AzureMonitorErrorish | undefined) => void;\n hideFormatAs?: boolean;\n}\n\nconst LogsQueryEditor: React.FC<LogsQueryEditorProps> = ({\n query,\n datasource,\n subscriptionId,\n variableOptionGroup,\n onChange,\n setError,\n hideFormatAs,\n}) => {\n const migrationError = useMigrations(datasource, query, onChange);\n\n return (\n <span data-testid=\"azure-monitor-logs-query-editor-with-experimental-ui\">\n <EditorRows>\n <EditorRow>\n <EditorFieldGroup>\n <ResourceField\n query={query}\n datasource={datasource}\n inlineField={true}\n labelWidth={10}\n subscriptionId={subscriptionId}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n selectableEntryTypes={[\n ResourceRowType.Subscription,\n ResourceRowType.ResourceGroup,\n ResourceRowType.Resource,\n ResourceRowType.Variable,\n ]}\n setResource={setResource}\n resourceUri={query.azureLogAnalytics?.resource}\n queryType=\"logs\"\n />\n </EditorFieldGroup>\n </EditorRow>\n <QueryField\n query={query}\n datasource={datasource}\n subscriptionId={subscriptionId}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n />\n <EditorRow>\n <EditorFieldGroup>\n {!hideFormatAs && (\n <FormatAsField\n query={query}\n datasource={datasource}\n subscriptionId={subscriptionId}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n />\n )}\n\n {migrationError && <Alert title={migrationError.title}>{migrationError.message}</Alert>}\n </EditorFieldGroup>\n </EditorRow>\n </EditorRows>\n </span>\n );\n};\n\nexport default LogsQueryEditor;\n","import { AzureMetricDimension, AzureMonitorQuery } from '../../types';\n\nexport function setResource(query: AzureMonitorQuery, resourceURI: string | undefined): AzureMonitorQuery {\n return {\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n resourceUri: resourceURI,\n metricNamespace: undefined,\n metricName: undefined,\n aggregation: undefined,\n metricDefinition: undefined,\n timeGrain: '',\n dimensionFilters: [],\n },\n };\n}\n\nexport function setMetricNamespace(query: AzureMonitorQuery, metricNamespace: string | undefined): AzureMonitorQuery {\n if (query.azureMonitor?.metricNamespace === metricNamespace) {\n return query;\n }\n\n let resourceUri = query.azureMonitor?.resourceUri;\n\n // Storage Account URIs need to be handled differently due to the additional storage services (blob/queue/table/file).\n // When one of these namespaces is selected it does not form a part of the URI for the storage account and so must be appended.\n // The 'default' path must also be appended. Without these two paths any API call will fail.\n if (resourceUri && metricNamespace?.includes('Microsoft.Storage/storageAccounts')) {\n const splitUri = resourceUri.split('/');\n const accountNameIndex = splitUri.findIndex((item) => item === 'storageAccounts') + 1;\n const baseUri = splitUri.slice(0, accountNameIndex + 1).join('/');\n if (metricNamespace === 'Microsoft.Storage/storageAccounts') {\n resourceUri = baseUri;\n } else {\n const subNamespace = metricNamespace.split('/')[2];\n resourceUri = `${baseUri}/${subNamespace}/default`;\n }\n }\n\n return {\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n metricNamespace: metricNamespace,\n metricName: undefined,\n aggregation: undefined,\n timeGrain: '',\n dimensionFilters: [],\n resourceUri,\n },\n };\n}\n\nexport function setMetricName(query: AzureMonitorQuery, metricName: string | undefined): AzureMonitorQuery {\n if (query.azureMonitor?.metricName === metricName) {\n return query;\n }\n\n return {\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n metricName: metricName,\n aggregation: undefined,\n timeGrain: '',\n dimensionFilters: [],\n },\n };\n}\n\nexport function setAggregation(query: AzureMonitorQuery, aggregation: string): AzureMonitorQuery {\n if (query.azureMonitor?.aggregation === aggregation) {\n return query;\n }\n\n return {\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n aggregation: aggregation,\n },\n };\n}\n\nexport function setTimeGrain(query: AzureMonitorQuery, timeGrain: string): AzureMonitorQuery {\n if (query.azureMonitor?.timeGrain === timeGrain) {\n return query;\n }\n\n return {\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n timeGrain: timeGrain,\n },\n };\n}\n\nexport function setDimensionFilters(query: AzureMonitorQuery, dimensions: AzureMetricDimension[]): AzureMonitorQuery {\n if (query.azureMonitor?.dimensionFilters === dimensions) {\n return query;\n }\n\n return {\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n dimensionFilters: dimensions,\n },\n };\n}\n\nexport function appendDimensionFilter(\n query: AzureMonitorQuery,\n dimension = '',\n operator = 'eq',\n filters: string[] = []\n): AzureMonitorQuery {\n const existingFilters = query.azureMonitor?.dimensionFilters ?? [];\n\n return setDimensionFilters(query, [\n ...existingFilters,\n {\n dimension,\n operator,\n filters,\n },\n ]);\n}\n\nexport function removeDimensionFilter(query: AzureMonitorQuery, indexToRemove: number): AzureMonitorQuery {\n const existingFilters = query.azureMonitor?.dimensionFilters ?? [];\n const newFilters = [...existingFilters];\n newFilters.splice(indexToRemove, 1);\n return setDimensionFilters(query, newFilters);\n}\n\nexport function setDimensionFilterValue<Key extends keyof AzureMetricDimension>(\n query: AzureMonitorQuery,\n index: number,\n fieldName: Key,\n value: AzureMetricDimension[Key]\n): AzureMonitorQuery {\n const existingFilters = query.azureMonitor?.dimensionFilters ?? [];\n const newFilters = [...existingFilters];\n const newFilter = newFilters[index];\n newFilter[fieldName] = value;\n if (fieldName === 'dimension' || fieldName === 'operator') {\n newFilter.filters = [];\n }\n return setDimensionFilters(query, newFilters);\n}\n\nexport function setTop(query: AzureMonitorQuery, top: string): AzureMonitorQuery {\n if (query.azureMonitor?.top === top) {\n return query;\n }\n\n return {\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n top: top,\n },\n };\n}\n\nexport function setLegendAlias(query: AzureMonitorQuery, alias: string): AzureMonitorQuery {\n if (query.azureMonitor?.alias === alias) {\n return query;\n }\n\n return {\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n alias: alias,\n },\n };\n}\n","import React, { useCallback, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Select } from '@grafana/ui';\n\nimport { AzureQueryEditorFieldProps, AzureMonitorOption } from '../../types';\nimport { Field } from '../Field';\n\nimport { setAggregation } from './setQueryValue';\n\ninterface AggregationFieldProps extends AzureQueryEditorFieldProps {\n aggregationOptions: AzureMonitorOption[];\n isLoading: boolean;\n}\n\nconst AggregationField: React.FC<AggregationFieldProps> = ({\n query,\n variableOptionGroup,\n onQueryChange,\n aggregationOptions,\n isLoading,\n}) => {\n const handleChange = useCallback(\n (change: SelectableValue<string>) => {\n if (!change.value) {\n return;\n }\n\n const newQuery = setAggregation(query, change.value);\n onQueryChange(newQuery);\n },\n [onQueryChange, query]\n );\n\n const options = useMemo(\n () => [...aggregationOptions, variableOptionGroup],\n [aggregationOptions, variableOptionGroup]\n );\n\n return (\n <Field label=\"Aggregation\">\n <Select\n inputId=\"azure-monitor-metrics-aggregation-field\"\n value={query.azureMonitor?.aggregation}\n onChange={handleChange}\n options={options}\n isLoading={isLoading}\n />\n </Field>\n );\n};\n\nexport default AggregationField;\n","import React, { useEffect, useMemo, useState } from 'react';\n\nimport { SelectableValue, DataFrame, PanelData, Labels } from '@grafana/data';\nimport { AccessoryButton, EditorList } from '@grafana/experimental';\nimport { Select, HorizontalGroup, MultiSelect } from '@grafana/ui';\n\nimport { AzureMetricDimension, AzureMonitorOption, AzureMonitorQuery, AzureQueryEditorFieldProps } from '../../types';\nimport { Field } from '../Field';\n\nimport { setDimensionFilters } from './setQueryValue';\n\ninterface DimensionFieldsProps extends AzureQueryEditorFieldProps {\n dimensionOptions: AzureMonitorOption[];\n}\n\ninterface DimensionLabels {\n [key: string]: Set<string>;\n}\n\nconst useDimensionLabels = (data: PanelData | undefined, query: AzureMonitorQuery) => {\n const [dimensionLabels, setDimensionLabels] = useState<DimensionLabels>({});\n useEffect(() => {\n let labelsObj: DimensionLabels = {};\n if (data?.series?.length) {\n // Identify which series' in the dataframe are relevant to the current query\n const series: DataFrame[] = data.series.flat().filter((series) => series.refId === query.refId);\n const fields = series.flatMap((series) => series.fields);\n // Retrieve labels for series fields\n const labels = fields\n .map((fields) => fields.labels)\n .flat()\n .filter((item): item is Labels => item !== null && item !== undefined);\n for (const label of labels) {\n // Labels only exist for series that have a dimension selected\n for (const [dimension, value] of Object.entries(label)) {\n if (labelsObj[dimension]) {\n labelsObj[dimension].add(value);\n } else {\n labelsObj[dimension] = new Set([value]);\n }\n }\n }\n }\n setDimensionLabels((prevLabels) => {\n const newLabels: DimensionLabels = {};\n const currentLabels = Object.keys(labelsObj);\n if (currentLabels.length === 0) {\n return prevLabels;\n }\n for (const label of currentLabels) {\n if (prevLabels[label] && labelsObj[label].size < prevLabels[label].size) {\n newLabels[label] = prevLabels[label];\n } else {\n newLabels[label] = labelsObj[label];\n }\n }\n return newLabels;\n });\n }, [data?.series, query.refId]);\n return dimensionLabels;\n};\n\nconst DimensionFields: React.FC<DimensionFieldsProps> = ({ data, query, dimensionOptions, onQueryChange }) => {\n const dimensionFilters = useMemo(\n () => query.azureMonitor?.dimensionFilters ?? [],\n [query.azureMonitor?.dimensionFilters]\n );\n\n const dimensionLabels = useDimensionLabels(data, query);\n\n const dimensionOperators: Array<SelectableValue<string>> = [\n { label: '==', value: 'eq' },\n { label: '!=', value: 'ne' },\n { label: 'starts with', value: 'sw' },\n ];\n\n const validDimensionOptions = useMemo(() => {\n // We filter out any dimensions that have already been used in a filter as the API doesn't support having multiple filters with the same dimension name.\n // The Azure portal also doesn't support this feature so it makes sense for consistency.\n let t = dimensionOptions;\n if (dimensionFilters.length) {\n t = dimensionOptions.filter(\n (val) => !dimensionFilters.some((dimensionFilter) => dimensionFilter.dimension === val.value)\n );\n }\n return t;\n }, [dimensionFilters, dimensionOptions]);\n\n const onFieldChange = <Key extends keyof AzureMetricDimension>(\n fieldName: Key,\n item: Partial<AzureMetricDimension>,\n value: AzureMetricDimension[Key],\n onChange: (item: Partial<AzureMetricDimension>) => void\n ) => {\n item[fieldName] = value;\n onChange(item);\n };\n\n const getValidDimensionOptions = (selectedDimension: string) => {\n return validDimensionOptions.concat(dimensionOptions.filter((item) => item.value === selectedDimension));\n };\n\n const getValidFilterOptions = (selectedFilter: string | undefined, dimension: string) => {\n const dimensionFilters = Array.from(dimensionLabels[dimension.toLowerCase()] ?? []);\n if (dimensionFilters.find((filter) => filter === selectedFilter)) {\n return dimensionFilters.map((filter) => ({ value: filter, label: filter }));\n }\n return [...dimensionFilters, ...(selectedFilter && selectedFilter !== '*' ? [selectedFilter] : [])].map((item) => ({\n value: item,\n label: item,\n }));\n };\n\n const getValidMultiSelectOptions = (selectedFilters: string[] | undefined, dimension: string) => {\n const labelOptions = getValidFilterOptions(undefined, dimension);\n if (selectedFilters) {\n for (const filter of selectedFilters) {\n if (!labelOptions.find((label) => label.value === filter)) {\n labelOptions.push({ value: filter, label: filter });\n }\n }\n }\n return labelOptions;\n };\n const getValidOperators = (selectedOperator: string) => {\n if (dimensionOperators.find((operator: SelectableValue) => operator.value === selectedOperator)) {\n return dimensionOperators;\n }\n return [...dimensionOperators, ...(selectedOperator ? [{ label: selectedOperator, value: selectedOperator }] : [])];\n };\n\n const changedFunc = (changed: Array<Partial<AzureMetricDimension>>) => {\n const properData: AzureMetricDimension[] = changed.map((x) => {\n return {\n dimension: x.dimension ?? '',\n operator: x.operator ?? 'eq',\n filters: x.filters ?? [],\n };\n });\n onQueryChange(setDimensionFilters(query, properData));\n };\n\n const renderFilters = (\n item: Partial<AzureMetricDimension>,\n onChange: (item: Partial<AzureMetricDimension>) => void,\n onDelete: () => void\n ) => {\n return (\n <HorizontalGroup spacing=\"none\">\n <Select\n menuShouldPortal\n placeholder=\"Field\"\n value={item.dimension}\n options={getValidDimensionOptions(item.dimension || '')}\n onChange={(e) => onFieldChange('dimension', item, e.value ?? '', onChange)}\n />\n <Select\n menuShouldPortal\n placeholder=\"Operation\"\n value={item.operator}\n options={getValidOperators(item.operator || 'eq')}\n onChange={(e) => onFieldChange('operator', item, e.value ?? '', onChange)}\n allowCustomValue\n />\n {item.operator === 'eq' || item.operator === 'ne' ? (\n <MultiSelect\n menuShouldPortal\n placeholder=\"Select value(s)\"\n value={item.filters}\n options={getValidMultiSelectOptions(item.filters, item.dimension ?? '')}\n onChange={(e) =>\n onFieldChange(\n 'filters',\n item,\n e.map((x) => x.value ?? ''),\n onChange\n )\n }\n aria-label={'dimension-labels-select'}\n allowCustomValue\n />\n ) : (\n // The API does not currently allow for multiple \"starts with\" clauses to be used.\n <Select\n menuShouldPortal\n placeholder=\"Select value\"\n value={item.filters ? item.filters[0] : ''}\n allowCustomValue\n options={getValidFilterOptions(item.filters ? item.filters[0] : '', item.dimension ?? '')}\n onChange={(e) => onFieldChange('filters', item, [e?.value ?? ''], onChange)}\n isClearable\n />\n )}\n <AccessoryButton aria-label=\"Remove\" icon=\"times\" variant=\"secondary\" onClick={onDelete} type=\"button\" />\n </HorizontalGroup>\n );\n };\n\n return (\n <Field label=\"Dimensions\">\n <EditorList items={dimensionFilters} onChange={changedFunc} renderItem={renderFilters} />\n </Field>\n );\n};\n\nexport default DimensionFields;\n","import React, { useCallback, useState } from 'react';\n\nimport { Input } from '@grafana/ui';\n\nimport { AzureQueryEditorFieldProps } from '../../types';\nimport { Field } from '../Field';\n\nimport { setLegendAlias } from './setQueryValue';\n\nconst LegendFormatField: React.FC<AzureQueryEditorFieldProps> = ({ onQueryChange, query }) => {\n const [value, setValue] = useState<string>(query.azureMonitor?.alias ?? '');\n\n // As calling onQueryChange initiates a the datasource refresh, we only want to call it once\n // the field loses focus\n const handleChange = useCallback((ev: React.FormEvent) => {\n if (ev.target instanceof HTMLInputElement) {\n setValue(ev.target.value);\n }\n }, []);\n\n const handleBlur = useCallback(() => {\n const newQuery = setLegendAlias(query, value);\n onQueryChange(newQuery);\n }, [onQueryChange, query, value]);\n\n return (\n <Field label=\"Legend format\">\n <Input\n id=\"azure-monitor-metrics-legend-field\"\n placeholder=\"Alias patterns\"\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n width={38}\n />\n </Field>\n );\n};\n\nexport default LegendFormatField;\n","import React, { useCallback, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Select } from '@grafana/ui';\n\nimport { AzureQueryEditorFieldProps, AzureMonitorOption } from '../../types';\nimport { Field } from '../Field';\n\nimport { setMetricName } from './setQueryValue';\n\ninterface MetricNameProps extends AzureQueryEditorFieldProps {\n metricNames: AzureMonitorOption[];\n}\n\nconst MetricNameField: React.FC<MetricNameProps> = ({ metricNames, query, variableOptionGroup, onQueryChange }) => {\n const handleChange = useCallback(\n (change: SelectableValue<string>) => {\n if (!change.value) {\n return;\n }\n\n const newQuery = setMetricName(query, change.value);\n onQueryChange(newQuery);\n },\n [onQueryChange, query]\n );\n\n const options = useMemo(() => [...metricNames, variableOptionGroup], [metricNames, variableOptionGroup]);\n\n return (\n <Field label=\"Metric\">\n <Select\n inputId=\"azure-monitor-metrics-metric-field\"\n value={query.azureMonitor?.metricName ?? null}\n onChange={handleChange}\n options={options}\n allowCustomValue\n />\n </Field>\n );\n};\n\nexport default MetricNameField;\n","import React, { useCallback, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Select } from '@grafana/ui';\n\nimport { AzureQueryEditorFieldProps, AzureMonitorOption } from '../../types';\nimport { Field } from '../Field';\n\nimport { setMetricNamespace } from './setQueryValue';\n\ninterface MetricNamespaceFieldProps extends AzureQueryEditorFieldProps {\n metricNamespaces: AzureMonitorOption[];\n}\n\nconst MetricNamespaceField: React.FC<MetricNamespaceFieldProps> = ({\n metricNamespaces,\n query,\n variableOptionGroup,\n onQueryChange,\n}) => {\n const handleChange = useCallback(\n (change: SelectableValue<string>) => {\n if (!change.value) {\n return;\n }\n\n const newQuery = setMetricNamespace(query, change.value);\n onQueryChange(newQuery);\n },\n [onQueryChange, query]\n );\n\n const options = useMemo(() => [...metricNamespaces, variableOptionGroup], [metricNamespaces, variableOptionGroup]);\n const optionValues = metricNamespaces\n .map((m) => m.value.toLowerCase())\n .concat(variableOptionGroup.options.map((p) => p.value));\n const value = query.azureMonitor?.metricNamespace;\n if (value && !optionValues.includes(value.toLowerCase())) {\n options.push({ label: value, value });\n }\n\n return (\n <Field label=\"Metric namespace\">\n <Select\n inputId=\"azure-monitor-metrics-metric-namespace-field\"\n value={query.azureMonitor?.metricNamespace}\n onChange={handleChange}\n options={options}\n allowCustomValue\n />\n </Field>\n );\n};\n\nexport default MetricNamespaceField;\n","import React, { useCallback, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Select } from '@grafana/ui';\n\nimport TimegrainConverter from '../../time_grain_converter';\nimport { AzureQueryEditorFieldProps, AzureMonitorOption } from '../../types';\nimport { Field } from '../Field';\n\nimport { setTimeGrain } from './setQueryValue';\n\ninterface TimeGrainFieldProps extends AzureQueryEditorFieldProps {\n timeGrainOptions: AzureMonitorOption[];\n}\n\nconst TimeGrainField: React.FC<TimeGrainFieldProps> = ({\n query,\n timeGrainOptions,\n variableOptionGroup,\n onQueryChange,\n}) => {\n const handleChange = useCallback(\n (change: SelectableValue<string>) => {\n if (!change.value) {\n return;\n }\n\n const newQuery = setTimeGrain(query, change.value);\n onQueryChange(newQuery);\n },\n [onQueryChange, query]\n );\n\n const timeGrains = useMemo(() => {\n const autoInterval = TimegrainConverter.findClosestTimeGrain(\n '1m',\n timeGrainOptions.map((o) => TimegrainConverter.createKbnUnitFromISO8601Duration(o.value)) || [\n '1m',\n '5m',\n '15m',\n '30m',\n '1h',\n '6h',\n '12h',\n '1d',\n ]\n );\n\n const baseTimeGrains = timeGrainOptions.map((v) => (v.value === 'auto' ? { ...v, description: autoInterval } : v));\n\n return [...baseTimeGrains, variableOptionGroup];\n }, [timeGrainOptions, variableOptionGroup]);\n\n return (\n <Field label=\"Time grain\">\n <Select\n inputId=\"azure-monitor-metrics-time-grain-field\"\n value={query.azureMonitor?.timeGrain}\n onChange={handleChange}\n options={timeGrains}\n />\n </Field>\n );\n};\n\nexport default TimeGrainField;\n","import React, { useCallback, useState } from 'react';\n\nimport { Input } from '@grafana/ui';\n\nimport { AzureQueryEditorFieldProps } from '../../types';\nimport { Field } from '../Field';\n\nimport { setTop } from './setQueryValue';\n\nconst TopField: React.FC<AzureQueryEditorFieldProps> = ({ onQueryChange, query }) => {\n const [value, setValue] = useState<string>(query.azureMonitor?.top ?? '');\n\n // As calling onQueryChange initiates a the datasource refresh, we only want to call it once\n // the field loses focus\n const handleChange = useCallback((ev: React.FormEvent) => {\n if (ev.target instanceof HTMLInputElement) {\n setValue(ev.target.value);\n }\n }, []);\n\n const handleBlur = useCallback(() => {\n const newQuery = setTop(query, value);\n onQueryChange(newQuery);\n }, [onQueryChange, query, value]);\n\n return (\n <Field label=\"Top\">\n <Input\n id=\"azure-monitor-metrics-top-field\"\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n width={16}\n />\n </Field>\n );\n};\n\nexport default TopField;\n","import { useEffect, useMemo, useState } from 'react';\n\nexport function useAsyncState<T>(asyncFn: () => Promise<T>, setError: Function, dependencies: unknown[]) {\n // Use the lazy initial state functionality of useState to assign a random ID to the API call\n // to track where errors come from. See useLastError.\n const [errorSource] = useState(() => Math.random());\n const [value, setValue] = useState<T>();\n\n const finalValue = useMemo(() => value ?? [], [value]);\n\n useEffect(() => {\n asyncFn()\n .then((results) => {\n setValue(results);\n setError(errorSource, undefined);\n })\n .catch((err) => {\n setError(errorSource, err);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n return finalValue;\n}\n","import { useEffect, useState } from 'react';\n\nimport { rangeUtil } from '@grafana/data';\n\nimport Datasource from '../../datasource';\nimport TimegrainConverter from '../../time_grain_converter';\nimport { AzureMonitorErrorish, AzureMonitorOption, AzureMonitorQuery } from '../../types';\nimport { toOption } from '../../utils/common';\nimport { useAsyncState } from '../../utils/useAsyncState';\n\nimport { setMetricNamespace } from './setQueryValue';\n\ntype SetErrorFn = (source: string, error: AzureMonitorErrorish | undefined) => void;\n\nexport type DataHook = (\n query: AzureMonitorQuery,\n datasource: Datasource,\n onChange: OnChangeFn,\n setError: SetErrorFn\n) => AzureMonitorOption[];\n\nexport type MetricsMetadataHook = (\n query: AzureMonitorQuery,\n datasource: Datasource,\n onChange: OnChangeFn\n) => MetricMetadata;\n\nexport interface MetricMetadata {\n aggOptions: AzureMonitorOption[];\n timeGrains: AzureMonitorOption[];\n dimensions: AzureMonitorOption[];\n isLoading: boolean;\n\n // These two properties are only used within the hook, and not elsewhere\n supportedAggTypes: string[];\n primaryAggType: string | undefined;\n}\n\ntype OnChangeFn = (newQuery: AzureMonitorQuery) => void;\n\nexport const useMetricNamespaces: DataHook = (query, datasource, onChange, setError) => {\n const { metricNamespace, resourceUri } = query.azureMonitor ?? {};\n\n const metricNamespaces = useAsyncState(\n async () => {\n if (!resourceUri) {\n return;\n }\n\n const results = await datasource.azureMonitorDatasource.getMetricNamespaces({ resourceUri });\n const options = formatOptions(results, metricNamespace);\n\n // Do some cleanup of the query state if need be\n if (!metricNamespace && options.length) {\n onChange(setMetricNamespace(query, options[0].value));\n }\n\n return options;\n },\n setError,\n [resourceUri]\n );\n\n return metricNamespaces;\n};\n\nexport const useMetricNames: DataHook = (query, datasource, onChange, setError) => {\n const { metricNamespace, metricName, resourceUri } = query.azureMonitor ?? {};\n\n return useAsyncState(\n async () => {\n if (!(metricNamespace && resourceUri)) {\n return;\n }\n\n const results = await datasource.azureMonitorDatasource.getMetricNames({ resourceUri, metricNamespace });\n const options = formatOptions(results, metricName);\n\n return options;\n },\n setError,\n [resourceUri, metricNamespace]\n );\n};\n\nconst defaultMetricMetadata: MetricMetadata = {\n aggOptions: [],\n timeGrains: [],\n dimensions: [],\n isLoading: false,\n supportedAggTypes: [],\n primaryAggType: undefined,\n};\n\nexport const useMetricMetadata = (query: AzureMonitorQuery, datasource: Datasource, onChange: OnChangeFn) => {\n const [metricMetadata, setMetricMetadata] = useState<MetricMetadata>(defaultMetricMetadata);\n\n const { resourceUri, metricNamespace, metricName, aggregation, timeGrain } = query.azureMonitor ?? {};\n\n // Fetch new metric metadata when the fields change\n useEffect(() => {\n if (!(resourceUri && metricNamespace && metricName)) {\n setMetricMetadata(defaultMetricMetadata);\n return;\n }\n\n datasource.azureMonitorDatasource\n .getMetricMetadata({ resourceUri, metricNamespace, metricName })\n .then((metadata) => {\n // TODO: Move the aggregationTypes and timeGrain defaults into `getMetricMetadata`\n const aggregations = (metadata.supportedAggTypes || [metadata.primaryAggType]).map((v) => ({\n label: v,\n value: v,\n }));\n\n setMetricMetadata({\n aggOptions: aggregations,\n timeGrains: metadata.supportedTimeGrains,\n dimensions: metadata.dimensions,\n isLoading: false,\n supportedAggTypes: metadata.supportedAggTypes ?? [],\n primaryAggType: metadata.primaryAggType,\n });\n });\n }, [datasource, resourceUri, metricNamespace, metricName]);\n\n // Update the query state in response to the meta data changing\n useEffect(() => {\n const newAggregation = aggregation || metricMetadata.primaryAggType;\n const newTimeGrain = timeGrain || 'auto';\n\n if (newAggregation !== aggregation || newTimeGrain !== timeGrain) {\n onChange({\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n aggregation: newAggregation,\n timeGrain: newTimeGrain,\n allowedTimeGrainsMs: metricMetadata.timeGrains\n .filter((timeGrain) => timeGrain.value !== 'auto')\n .map((timeGrain) =>\n rangeUtil.intervalToMs(TimegrainConverter.createKbnUnitFromISO8601Duration(timeGrain.value))\n ),\n },\n });\n }\n }, [onChange, metricMetadata, aggregation, timeGrain, query]);\n\n return metricMetadata;\n};\n\nfunction formatOptions(\n rawResults: Array<{\n text: string;\n value: string;\n }>,\n selectedValue?: string\n) {\n const options = rawResults.map(toOption);\n\n // account for custom values that might have been set in json file like ones crafted with a template variable (ex: \"cloud-datasource-resource-$Environment\")\n if (selectedValue && !options.find((option) => option.value === selectedValue.toLowerCase())) {\n options.push({ label: selectedValue, value: selectedValue });\n }\n\n return options;\n}\n","import React from 'react';\n\nimport { PanelData } from '@grafana/data/src/types';\nimport { EditorRows, EditorRow, EditorFieldGroup } from '@grafana/experimental';\n\nimport type Datasource from '../../datasource';\nimport type { AzureMonitorQuery, AzureMonitorOption, AzureMonitorErrorish } from '../../types';\nimport ResourceField from '../ResourceField';\nimport { ResourceRowType } from '../ResourcePicker/types';\n\nimport AggregationField from './AggregationField';\nimport DimensionFields from './DimensionFields';\nimport LegendFormatField from './LegendFormatField';\nimport MetricNameField from './MetricNameField';\nimport MetricNamespaceField from './MetricNamespaceField';\nimport TimeGrainField from './TimeGrainField';\nimport TopField from './TopField';\nimport { useMetricNames, useMetricNamespaces, useMetricMetadata } from './dataHooks';\nimport { setResource } from './setQueryValue';\n\ninterface MetricsQueryEditorProps {\n data: PanelData | undefined;\n query: AzureMonitorQuery;\n datasource: Datasource;\n onChange: (newQuery: AzureMonitorQuery) => void;\n variableOptionGroup: { label: string; options: AzureMonitorOption[] };\n setError: (source: string, error: AzureMonitorErrorish | undefined) => void;\n}\n\nconst MetricsQueryEditor: React.FC<MetricsQueryEditorProps> = ({\n data,\n query,\n datasource,\n variableOptionGroup,\n onChange,\n setError,\n}) => {\n const metricsMetadata = useMetricMetadata(query, datasource, onChange);\n const metricNamespaces = useMetricNamespaces(query, datasource, onChange, setError);\n const metricNames = useMetricNames(query, datasource, onChange, setError);\n return (\n <span data-testid=\"azure-monitor-metrics-query-editor-with-experimental-ui\">\n <EditorRows>\n <EditorRow>\n <EditorFieldGroup>\n <ResourceField\n query={query}\n datasource={datasource}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n selectableEntryTypes={[ResourceRowType.Resource]}\n setResource={setResource}\n resourceUri={query.azureMonitor?.resourceUri}\n queryType={'metrics'}\n />\n <MetricNamespaceField\n metricNamespaces={metricNamespaces}\n query={query}\n datasource={datasource}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n />\n <MetricNameField\n metricNames={metricNames}\n query={query}\n datasource={datasource}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n />\n <AggregationField\n query={query}\n datasource={datasource}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n aggregationOptions={metricsMetadata?.aggOptions ?? []}\n isLoading={metricsMetadata.isLoading}\n />\n <TimeGrainField\n query={query}\n datasource={datasource}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n timeGrainOptions={metricsMetadata?.timeGrains ?? []}\n />\n </EditorFieldGroup>\n </EditorRow>\n <EditorRow>\n <EditorFieldGroup>\n <DimensionFields\n data={data}\n query={query}\n datasource={datasource}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n dimensionOptions={metricsMetadata?.dimensions ?? []}\n />\n </EditorFieldGroup>\n </EditorRow>\n <EditorRow>\n <EditorFieldGroup>\n <TopField\n query={query}\n datasource={datasource}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n />\n <LegendFormatField\n query={query}\n datasource={datasource}\n variableOptionGroup={variableOptionGroup}\n onQueryChange={onChange}\n setError={setError}\n />\n </EditorFieldGroup>\n </EditorRow>\n </EditorRows>\n </span>\n );\n};\n\nexport default MetricsQueryEditor;\n","import React, { useCallback } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { EditorHeader, InlineSelect } from '@grafana/experimental';\n\nimport { AzureMonitorQuery, AzureQueryType } from '../types';\n\ninterface QueryTypeFieldProps {\n query: AzureMonitorQuery;\n onQueryChange: (newQuery: AzureMonitorQuery) => void;\n}\n\nexport const QueryHeader: React.FC<QueryTypeFieldProps> = ({ query, onQueryChange }) => {\n const queryTypes: Array<{ value: AzureQueryType; label: string }> = [\n { value: AzureQueryType.AzureMonitor, label: 'Metrics' },\n { value: AzureQueryType.LogAnalytics, label: 'Logs' },\n { value: AzureQueryType.AzureResourceGraph, label: 'Azure Resource Graph' },\n ];\n\n const handleChange = useCallback(\n (change: SelectableValue<AzureQueryType>) => {\n change.value &&\n onQueryChange({\n ...query,\n queryType: change.value,\n });\n },\n [onQueryChange, query]\n );\n\n return (\n <span data-testid=\"azure-monitor-experimental-header\">\n <EditorHeader>\n <InlineSelect\n label=\"Service\"\n value={query.queryType}\n placeholder=\"Service...\"\n allowCustomValue\n options={queryTypes}\n onChange={handleChange}\n />\n </EditorHeader>\n </span>\n );\n};\n","import { TemplateSrv } from '@grafana/runtime';\n\nimport { GetMetricNamespacesQuery, GetMetricNamesQuery } from '../types';\n\nexport default class UrlBuilder {\n static buildResourceUri(\n subscriptionId: string,\n resourceGroup: string,\n metricDefinition: string,\n resourceName: string,\n templateSrv: TemplateSrv\n ) {\n const metricDefinitionProcessed = templateSrv.replace(metricDefinition);\n const metricDefinitionArray = metricDefinition.split('/');\n const resourceNameProcessed = templateSrv.replace(resourceName);\n const resourceNameArray = resourceName.split('/');\n const provider = metricDefinitionArray.shift();\n const urlArray = ['/subscriptions', subscriptionId, 'resourceGroups', resourceGroup, 'providers', provider];\n\n if (\n metricDefinitionProcessed.startsWith('Microsoft.Storage/storageAccounts/') &&\n !resourceNameProcessed.endsWith('default')\n ) {\n resourceNameArray.push('default');\n }\n\n if (resourceNameArray.length > metricDefinitionArray.length) {\n const parentResource = resourceNameArray.shift();\n urlArray.push(parentResource);\n }\n\n for (const i in metricDefinitionArray) {\n urlArray.push(metricDefinitionArray[i]);\n urlArray.push(resourceNameArray[i]);\n }\n return urlArray.join('/');\n }\n\n static buildAzureMonitorGetMetricNamespacesUrl(\n baseUrl: string,\n apiVersion: string,\n query: GetMetricNamespacesQuery,\n templateSrv: TemplateSrv\n ) {\n let resourceUri: string;\n\n if ('resourceUri' in query) {\n resourceUri = query.resourceUri;\n } else {\n const { subscription, resourceGroup, metricDefinition, resourceName } = query;\n resourceUri = UrlBuilder.buildResourceUri(\n subscription,\n resourceGroup,\n metricDefinition,\n resourceName,\n templateSrv\n );\n }\n\n return `${baseUrl}${resourceUri}/providers/microsoft.insights/metricNamespaces?api-version=${apiVersion}`;\n }\n\n static buildAzureMonitorGetMetricNamesUrl(\n baseUrl: string,\n apiVersion: string,\n query: GetMetricNamesQuery,\n templateSrv: TemplateSrv\n ) {\n let resourceUri: string;\n const { metricNamespace } = query;\n\n if ('resourceUri' in query) {\n resourceUri = query.resourceUri;\n } else {\n const { subscription, resourceGroup, metricDefinition, resourceName } = query;\n resourceUri = UrlBuilder.buildResourceUri(\n subscription,\n resourceGroup,\n metricDefinition,\n resourceName,\n templateSrv\n );\n }\n\n return (\n `${baseUrl}${resourceUri}/providers/microsoft.insights/metricdefinitions?api-version=${apiVersion}` +\n `&metricnamespace=${encodeURIComponent(metricNamespace)}`\n );\n }\n}\n","import React from 'react';\n\nimport { TemplateSrv } from '@grafana/runtime';\n\nimport UrlBuilder from '../azure_monitor/url_builder';\nimport { setKustoQuery } from '../components/LogsQueryEditor/setQueryValue';\nimport {\n appendDimensionFilter,\n setTimeGrain as setMetricsTimeGrain,\n} from '../components/MetricsQueryEditor/setQueryValue';\nimport TimegrainConverter from '../time_grain_converter';\nimport { AzureMetricDimension, AzureMonitorErrorish, AzureMonitorQuery, AzureQueryType } from '../types';\n\nconst OLD_DEFAULT_DROPDOWN_VALUE = 'select';\n\nexport default function migrateQuery(\n query: AzureMonitorQuery,\n templateSrv: TemplateSrv,\n setError: (errorSource: string, error: AzureMonitorErrorish) => void\n): AzureMonitorQuery {\n let workingQuery = query;\n\n // The old angular controller also had a `migrateApplicationInsightsKeys` migraiton that\n // migrated old properties to other properties that still do not appear to be used anymore, so\n // we decided to not include that migration anymore\n // See https://github.com/grafana/grafana/blob/a6a09add/public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.ts#L269-L288\n\n workingQuery = migrateTimeGrains(workingQuery);\n workingQuery = migrateLogAnalyticsToFromTimes(workingQuery);\n workingQuery = migrateToDefaultNamespace(workingQuery);\n workingQuery = migrateDimensionToDimensionFilter(workingQuery);\n workingQuery = migrateResourceUri(workingQuery, templateSrv, setError);\n workingQuery = migrateDimensionFilterToArray(workingQuery);\n\n return workingQuery;\n}\n\nfunction migrateTimeGrains(query: AzureMonitorQuery): AzureMonitorQuery {\n let workingQuery = query;\n\n if (workingQuery.azureMonitor?.timeGrainUnit && workingQuery.azureMonitor.timeGrain !== 'auto') {\n const newTimeGrain = TimegrainConverter.createISO8601Duration(\n workingQuery.azureMonitor.timeGrain ?? 'auto',\n workingQuery.azureMonitor.timeGrainUnit\n );\n workingQuery = setMetricsTimeGrain(workingQuery, newTimeGrain);\n\n delete workingQuery.azureMonitor?.timeGrainUnit;\n }\n\n return workingQuery;\n}\n\nfunction migrateLogAnalyticsToFromTimes(query: AzureMonitorQuery): AzureMonitorQuery {\n let workingQuery = query;\n\n if (workingQuery.azureLogAnalytics?.query?.match(/\\$__from\\s/gi)) {\n workingQuery = setKustoQuery(\n workingQuery,\n workingQuery.azureLogAnalytics.query.replace(/\\$__from\\s/gi, '$__timeFrom() ')\n );\n }\n\n if (workingQuery.azureLogAnalytics?.query?.match(/\\$__to\\s/gi)) {\n workingQuery = setKustoQuery(\n workingQuery,\n workingQuery.azureLogAnalytics.query.replace(/\\$__to\\s/gi, '$__timeTo() ')\n );\n }\n\n return workingQuery;\n}\n\nfunction migrateToDefaultNamespace(query: AzureMonitorQuery): AzureMonitorQuery {\n const haveMetricNamespace =\n query.azureMonitor?.metricNamespace && query.azureMonitor.metricNamespace !== OLD_DEFAULT_DROPDOWN_VALUE;\n\n if (!haveMetricNamespace && query.azureMonitor?.metricDefinition) {\n return {\n ...query,\n azureMonitor: {\n ...query.azureMonitor,\n metricNamespace: query.azureMonitor.metricDefinition,\n },\n };\n }\n\n return query;\n}\n\nfunction migrateDimensionToDimensionFilter(query: AzureMonitorQuery): AzureMonitorQuery {\n let workingQuery = query;\n\n const oldDimension = workingQuery.azureMonitor?.dimension;\n if (oldDimension && oldDimension !== 'None') {\n workingQuery = appendDimensionFilter(workingQuery, oldDimension, 'eq', [\n workingQuery.azureMonitor?.dimensionFilter || '',\n ]);\n }\n\n return workingQuery;\n}\n\n// Azure Monitor metric queries prior to Grafana version 9 did not include a `resourceUri`.\n// The resourceUri was previously constructed with the subscription id, resource group,\n// metric definition (a.k.a. resource type), and the resource name.\nfunction migrateResourceUri(\n query: AzureMonitorQuery,\n templateSrv: TemplateSrv,\n setError?: (errorSource: string, error: AzureMonitorErrorish) => void\n): AzureMonitorQuery {\n const azureMonitorQuery = query.azureMonitor;\n\n if (!azureMonitorQuery || azureMonitorQuery.resourceUri) {\n return query;\n }\n\n const { subscription } = query;\n const { resourceGroup, metricDefinition, resourceName } = azureMonitorQuery;\n if (!(subscription && resourceGroup && metricDefinition && resourceName)) {\n return query;\n }\n\n const metricDefinitionArray = metricDefinition.split('/');\n if (metricDefinitionArray.some((p) => templateSrv.replace(p).split('/').length > 2)) {\n // If a metric definition includes template variable with a subresource e.g.\n // Microsoft.Storage/storageAccounts/libraries, it's not possible to generate a valid\n // resource URI\n if (setError) {\n setError(\n 'Resource URI migration',\n React.createElement(\n 'div',\n null,\n `Failed to create resource URI. Validate the metric definition template variable against supported cases `,\n React.createElement(\n 'a',\n {\n href: 'https://grafana.com/docs/grafana/latest/datasources/azuremonitor/template-variables/',\n },\n 'here.'\n )\n )\n );\n }\n return query;\n }\n\n const resourceNameArray = resourceName.split('/');\n if (resourceNameArray.some((p) => templateSrv.replace(p).split('/').length > 1)) {\n // If a resource name includes template variable with a subresource e.g.\n // abc123/def456, it's not possible to generate a valid resource URI\n if (setError) {\n setError(\n 'Resource URI migration',\n React.createElement(\n 'div',\n null,\n `Failed to create resource URI. Validate the resource name template variable against supported cases `,\n React.createElement(\n 'a',\n {\n href: 'https://grafana.com/docs/grafana/latest/datasources/azuremonitor/template-variables/',\n },\n 'here.'\n )\n )\n );\n }\n return query;\n }\n\n const resourceUri = UrlBuilder.buildResourceUri(\n subscription,\n resourceGroup,\n metricDefinition,\n resourceName,\n templateSrv\n );\n\n return {\n ...query,\n azureMonitor: {\n ...azureMonitorQuery,\n resourceUri,\n },\n };\n}\n\nfunction migrateDimensionFilterToArray(query: AzureMonitorQuery): AzureMonitorQuery {\n const azureMonitorQuery = query.azureMonitor;\n\n if (!azureMonitorQuery) {\n return query;\n }\n\n const newFilters: AzureMetricDimension[] = [];\n const dimensionFilters = azureMonitorQuery.dimensionFilters;\n if (dimensionFilters && dimensionFilters.length > 0) {\n dimensionFilters.forEach((filter) => {\n const staticProps = { dimension: filter.dimension, operator: filter.operator };\n if (!filter.filters && filter.filter) {\n newFilters.push({ ...staticProps, filters: [filter.filter] });\n } else {\n let hasFilter = false;\n if (filter.filters && filter.filter) {\n for (const oldFilter of filter.filters) {\n if (filter.filter === oldFilter) {\n hasFilter = true;\n break;\n }\n }\n if (!hasFilter && filter.filter !== '*') {\n filter.filters.push(filter.filter);\n }\n newFilters.push({ ...staticProps, filters: filter.filters });\n }\n }\n });\n if (newFilters.length > 0) {\n return { ...query, azureMonitor: { ...azureMonitorQuery, dimensionFilters: newFilters } };\n }\n }\n return query;\n}\n\n// datasource.ts also contains some migrations, which have been moved to here. Unsure whether\n// they should also do all the other migrations...\nexport function datasourceMigrations(query: AzureMonitorQuery, templateSrv: TemplateSrv): AzureMonitorQuery {\n let workingQuery = query;\n\n if (!workingQuery.queryType) {\n workingQuery = {\n ...workingQuery,\n queryType: AzureQueryType.AzureMonitor,\n };\n }\n\n if (workingQuery.queryType === AzureQueryType.AzureMonitor && workingQuery.azureMonitor) {\n workingQuery = migrateDimensionToDimensionFilter(workingQuery);\n workingQuery = migrateResourceUri(workingQuery, templateSrv);\n workingQuery = migrateDimensionFilterToArray(workingQuery);\n }\n\n return workingQuery;\n}\n","import deepEqual from 'fast-deep-equal';\nimport { defaults } from 'lodash';\nimport { useEffect, useMemo } from 'react';\n\nimport { getTemplateSrv } from '@grafana/runtime';\n\nimport { AzureMonitorErrorish, AzureMonitorQuery, AzureQueryType } from '../../types';\nimport migrateQuery from '../../utils/migrateQuery';\n\nconst DEFAULT_QUERY = {\n queryType: AzureQueryType.AzureMonitor,\n};\n\nconst prepareQuery = (\n query: AzureMonitorQuery,\n setError: (errorSource: string, error: AzureMonitorErrorish) => void\n) => {\n // Note: _.defaults does not apply default values deeply.\n const withDefaults = defaults({}, query, DEFAULT_QUERY);\n const migratedQuery = migrateQuery(withDefaults, getTemplateSrv(), setError);\n\n // If we didn't make any changes to the object, then return the original object to keep the\n // identity the same, and not trigger any other useEffects or anything.\n return deepEqual(migratedQuery, query) ? query : migratedQuery;\n};\n\n/**\n * Returns queries with some defaults + migrations, and calls onChange function to notify if it changes\n */\nconst usePreparedQuery = (\n query: AzureMonitorQuery,\n onChangeQuery: (newQuery: AzureMonitorQuery) => void,\n setError: (errorSource: string, error: AzureMonitorErrorish) => void\n) => {\n const preparedQuery = useMemo(() => prepareQuery(query, setError), [query, setError]);\n\n useEffect(() => {\n if (preparedQuery !== query) {\n onChangeQuery(preparedQuery);\n }\n }, [preparedQuery, query, onChangeQuery]);\n\n return preparedQuery;\n};\n\nexport default usePreparedQuery;\n","import { debounce } from 'lodash';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { QueryEditorProps } from '@grafana/data';\nimport { Alert, CodeEditor } from '@grafana/ui';\n\nimport AzureMonitorDatasource from '../../datasource';\nimport {\n AzureDataSourceJsonData,\n AzureMonitorErrorish,\n AzureMonitorOption,\n AzureMonitorQuery,\n AzureQueryType,\n} from '../../types';\nimport useLastError from '../../utils/useLastError';\nimport ArgQueryEditor from '../ArgQueryEditor';\nimport LogsQueryEditor from '../LogsQueryEditor';\nimport NewMetricsQueryEditor from '../MetricsQueryEditor/MetricsQueryEditor';\nimport { QueryHeader } from '../QueryHeader';\nimport { Space } from '../Space';\n\nimport usePreparedQuery from './usePreparedQuery';\n\nexport type AzureMonitorQueryEditorProps = QueryEditorProps<\n AzureMonitorDatasource,\n AzureMonitorQuery,\n AzureDataSourceJsonData\n>;\n\nconst QueryEditor: React.FC<AzureMonitorQueryEditorProps> = ({\n query: baseQuery,\n datasource,\n onChange,\n onRunQuery: baseOnRunQuery,\n data,\n}) => {\n const [errorMessage, setError] = useLastError();\n const onRunQuery = useMemo(() => debounce(baseOnRunQuery, 500), [baseOnRunQuery]);\n\n const onQueryChange = useCallback(\n (newQuery: AzureMonitorQuery) => {\n onChange(newQuery);\n onRunQuery();\n },\n [onChange, onRunQuery]\n );\n\n const query = usePreparedQuery(baseQuery, onQueryChange, setError);\n\n const subscriptionId = query.subscription || datasource.azureMonitorDatasource.defaultSubscriptionId;\n const variableOptionGroup = {\n label: 'Template Variables',\n options: datasource.getVariables().map((v) => ({ label: v, value: v })),\n };\n\n return (\n <div data-testid=\"azure-monitor-query-editor\">\n <QueryHeader query={query} onQueryChange={onQueryChange} />\n\n <EditorForQueryType\n data={data}\n subscriptionId={subscriptionId}\n query={query}\n datasource={datasource}\n onChange={onQueryChange}\n variableOptionGroup={variableOptionGroup}\n setError={setError}\n />\n\n {errorMessage && (\n <>\n <Space v={2} />\n <Alert severity=\"error\" title=\"An error occurred while requesting metadata from Azure Monitor\">\n {errorMessage}\n </Alert>\n </>\n )}\n </div>\n );\n};\n\ninterface EditorForQueryTypeProps extends Omit<AzureMonitorQueryEditorProps, 'onRunQuery'> {\n subscriptionId?: string;\n variableOptionGroup: { label: string; options: AzureMonitorOption[] };\n setError: (source: string, error: AzureMonitorErrorish | undefined) => void;\n}\n\nconst EditorForQueryType: React.FC<EditorForQueryTypeProps> = ({\n data,\n subscriptionId,\n query,\n datasource,\n variableOptionGroup,\n onChange,\n setError,\n}) => {\n switch (query.queryType) {\n case AzureQueryType.AzureMonitor:\n return (\n <NewMetricsQueryEditor\n data={data}\n query={query}\n datasource={datasource}\n onChange={onChange}\n variableOptionGroup={variableOptionGroup}\n setError={setError}\n />\n );\n\n case AzureQueryType.LogAnalytics:\n return (\n <LogsQueryEditor\n subscriptionId={subscriptionId}\n query={query}\n datasource={datasource}\n onChange={onChange}\n variableOptionGroup={variableOptionGroup}\n setError={setError}\n />\n );\n\n case AzureQueryType.AzureResourceGraph:\n return (\n <ArgQueryEditor\n subscriptionId={subscriptionId}\n query={query}\n datasource={datasource}\n onChange={onChange}\n variableOptionGroup={variableOptionGroup}\n setError={setError}\n />\n );\n\n default:\n const type = query.queryType as unknown;\n return (\n <Alert title=\"Unknown query type\">\n {(type === 'Application Insights' || type === 'Insights Analytics') && (\n <>\n {type} was deprecated in Grafana 9. See the{' '}\n <a\n href=\"https://grafana.com/docs/grafana/latest/datasources/azuremonitor/deprecated-application-insights/\"\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n deprecation notice\n </a>{' '}\n to get more information about how to migrate your queries. This is the current query definition:\n <CodeEditor height=\"200px\" readOnly language=\"json\" value={JSON.stringify(query, null, 4)} />\n </>\n )}\n </Alert>\n );\n }\n};\n\nexport default QueryEditor;\n","import { dateTime } from '@grafana/data';\n\nexport default class LogAnalyticsQuerystringBuilder {\n constructor(public rawQueryString: string, public options: any, public defaultTimeField: any) {}\n\n generate() {\n let queryString = this.rawQueryString;\n const macroRegexp = /\\$__([_a-zA-Z0-9]+)\\(([^()]*)\\)/gi;\n queryString = queryString.replace(macroRegexp, (match, p1, p2) => {\n if (p1 === 'contains') {\n return this.getMultiContains(p2);\n }\n\n return match;\n });\n\n queryString = queryString.replace(/\\$__escapeMulti\\(('[^]*')\\)/gi, (match, p1) => this.escape(p1));\n\n if (this.options) {\n queryString = queryString.replace(macroRegexp, (match, p1, p2) => {\n if (p1 === 'timeFilter') {\n return this.getTimeFilter(p2, this.options);\n }\n if (p1 === 'timeFrom') {\n return this.getFrom(this.options);\n }\n if (p1 === 'timeTo') {\n return this.getUntil(this.options);\n }\n\n return match;\n });\n queryString = queryString.replace(/\\$__interval/gi, this.options.interval);\n }\n const rawQuery = queryString;\n queryString = encodeURIComponent(queryString);\n const uriString = `query=${queryString}`;\n\n return { uriString, rawQuery };\n }\n\n getFrom(options: any) {\n const from = options.range.from;\n return `datetime(${dateTime(from).startOf('minute').toISOString()})`;\n }\n\n getUntil(options: any) {\n if (options.rangeRaw?.to === 'now') {\n const now = Date.now();\n return `datetime(${dateTime(now).startOf('minute').toISOString()})`;\n } else {\n const until = options.range.to;\n return `datetime(${dateTime(until).startOf('minute').toISOString()})`;\n }\n }\n\n getTimeFilter(timeFieldArg: any, options: any) {\n const timeField = timeFieldArg || this.defaultTimeField;\n if (options.rangeRaw?.to === 'now') {\n return `${timeField} >= ${this.getFrom(options)}`;\n } else {\n return `${timeField} >= ${this.getFrom(options)} and ${timeField} <= ${this.getUntil(options)}`;\n }\n }\n\n getMultiContains(inputs: string) {\n const firstCommaIndex = inputs.indexOf(',');\n const field = inputs.substring(0, firstCommaIndex);\n const templateVar = inputs.substring(inputs.indexOf(',') + 1);\n\n if (templateVar && templateVar.toLowerCase().trim() === 'all') {\n return '1 == 1';\n }\n\n return `${field.trim()} in (${templateVar.trim()})`;\n }\n\n escape(inputs: string) {\n return inputs\n .substring(1, inputs.length - 1)\n .split(`','`)\n .map((v) => `@'${v}'`)\n .join(', ');\n }\n}\n","import { concat, find, flattenDeep, forEach, get, map } from 'lodash';\n\nimport { AnnotationEvent, dateTime, TimeSeries, VariableModel } from '@grafana/data';\n\nimport { AzureLogsTableData, AzureLogsVariable } from '../types';\nimport { AzureLogAnalyticsMetadata } from '../types/logAnalyticsMetadata';\n\nexport default class ResponseParser {\n declare columns: string[];\n constructor(private results: any) {}\n\n parseQueryResult(): any {\n let data: any[] = [];\n let columns: any[] = [];\n for (let i = 0; i < this.results.length; i++) {\n if (this.results[i].result.tables.length === 0) {\n continue;\n }\n columns = this.results[i].result.tables[0].columns;\n const rows = this.results[i].result.tables[0].rows;\n\n if (this.results[i].query.resultFormat === 'time_series') {\n data = concat(data, this.parseTimeSeriesResult(this.results[i].query, columns, rows));\n } else {\n data = concat(data, this.parseTableResult(this.results[i].query, columns, rows));\n }\n }\n\n return data;\n }\n\n parseTimeSeriesResult(query: { refId: string; query: any }, columns: any[], rows: any): TimeSeries[] {\n const data: TimeSeries[] = [];\n let timeIndex = -1;\n let metricIndex = -1;\n let valueIndex = -1;\n\n for (let i = 0; i < columns.length; i++) {\n if (timeIndex === -1 && columns[i].type === 'datetime') {\n timeIndex = i;\n }\n\n if (metricIndex === -1 && columns[i].type === 'string') {\n metricIndex = i;\n }\n\n if (valueIndex === -1 && ['int', 'long', 'real', 'double'].indexOf(columns[i].type) > -1) {\n valueIndex = i;\n }\n }\n\n if (timeIndex === -1) {\n throw new Error('No datetime column found in the result. The Time Series format requires a time column.');\n }\n\n forEach(rows, (row) => {\n const epoch = ResponseParser.dateTimeToEpoch(row[timeIndex]);\n const metricName = metricIndex > -1 ? row[metricIndex] : columns[valueIndex].name;\n const bucket = ResponseParser.findOrCreateBucket(data, metricName);\n bucket.datapoints.push([row[valueIndex], epoch]);\n bucket.refId = query.refId;\n bucket.meta = {\n executedQueryString: query.query,\n };\n });\n\n return data;\n }\n\n parseTableResult(query: { refId: string; query: string }, columns: any[], rows: any[]): AzureLogsTableData {\n const tableResult: AzureLogsTableData = {\n type: 'table',\n columns: map(columns, (col) => {\n return { text: col.name, type: col.type };\n }),\n rows: rows,\n refId: query.refId,\n meta: {\n executedQueryString: query.query,\n },\n };\n\n return tableResult;\n }\n\n parseToVariables(): AzureLogsVariable[] {\n const queryResult = this.parseQueryResult();\n\n const variables: AzureLogsVariable[] = [];\n forEach(queryResult, (result) => {\n forEach(flattenDeep(result.rows), (row) => {\n variables.push({\n text: row,\n value: row,\n } as AzureLogsVariable);\n });\n });\n\n return variables;\n }\n\n transformToAnnotations(options: any) {\n const queryResult = this.parseQueryResult();\n\n const list: AnnotationEvent[] = [];\n\n forEach(queryResult, (result) => {\n let timeIndex = -1;\n let textIndex = -1;\n let tagsIndex = -1;\n\n for (let i = 0; i < result.columns.length; i++) {\n if (timeIndex === -1 && result.columns[i].type === 'datetime') {\n timeIndex = i;\n }\n\n if (textIndex === -1 && result.columns[i].text.toLowerCase() === 'text') {\n textIndex = i;\n }\n\n if (tagsIndex === -1 && result.columns[i].text.toLowerCase() === 'tags') {\n tagsIndex = i;\n }\n }\n\n forEach(result.rows, (row) => {\n list.push({\n annotation: options.annotation,\n time: Math.floor(ResponseParser.dateTimeToEpoch(row[timeIndex])),\n text: row[textIndex] ? row[textIndex].toString() : '',\n tags: row[tagsIndex] ? row[tagsIndex].trim().split(/\\s*,\\s*/) : [],\n });\n });\n });\n\n return list;\n }\n\n static findOrCreateBucket(data: TimeSeries[], target: any): TimeSeries {\n let dataTarget: any = find(data, ['target', target]);\n if (!dataTarget) {\n dataTarget = { target: target, datapoints: [], refId: '', query: '' };\n data.push(dataTarget);\n }\n\n return dataTarget;\n }\n\n static dateTimeToEpoch(dateTimeValue: any) {\n return dateTime(dateTimeValue).valueOf();\n }\n\n static parseSubscriptions(result: any): Array<{ text: string; value: string }> {\n const list: Array<{ text: string; value: string }> = [];\n\n if (!result) {\n return list;\n }\n\n const valueFieldName = 'subscriptionId';\n const textFieldName = 'displayName';\n for (let i = 0; i < result.value.length; i++) {\n if (!find(list, ['value', get(result.value[i], valueFieldName)])) {\n list.push({\n text: `${get(result.value[i], textFieldName)}`,\n value: get(result.value[i], valueFieldName),\n });\n }\n }\n\n return list;\n }\n}\n\n// matches (name):(type) = (defaultValue)\n// e.g. fromRangeStart:datetime = datetime(null)\n// - name: fromRangeStart\n// - type: datetime\n// - defaultValue: datetime(null)\nconst METADATA_FUNCTION_PARAMS = /([\\w\\W]+):([\\w]+)(?:\\s?=\\s?([\\w\\W]+))?/;\n\nfunction transformMetadataFunction(sourceSchema: AzureLogAnalyticsMetadata) {\n if (!sourceSchema.functions) {\n return [];\n }\n\n return sourceSchema.functions.map((fn) => {\n const params =\n fn.parameters &&\n fn.parameters\n .split(', ')\n .map((arg) => {\n const match = arg.match(METADATA_FUNCTION_PARAMS);\n if (!match) {\n return;\n }\n\n const [, name, type, defaultValue] = match;\n\n return {\n name,\n type,\n defaultValue,\n cslDefaultValue: defaultValue,\n };\n })\n .filter(<T>(v: T): v is Exclude<T, undefined> => !!v);\n\n return {\n name: fn.name,\n body: fn.body,\n inputParameters: params || [],\n };\n });\n}\n\nexport function transformMetadataToKustoSchema(\n sourceSchema: AzureLogAnalyticsMetadata,\n nameOrIdOrSomething: string,\n templateVariables: VariableModel[]\n) {\n const database = {\n name: nameOrIdOrSomething,\n tables: sourceSchema.tables,\n functions: transformMetadataFunction(sourceSchema),\n majorVersion: 0,\n minorVersion: 0,\n };\n\n // Adding macros as known functions\n database.functions.push(\n {\n name: '$__timeFilter',\n body: '{ true }',\n inputParameters: [\n {\n name: 'timeColumn',\n type: 'System.String',\n defaultValue: '\"\"',\n cslDefaultValue: '\"\"',\n },\n ],\n },\n {\n name: '$__timeFrom',\n body: '{ datetime(2018-06-05T18:09:58.907Z) }',\n inputParameters: [],\n },\n {\n name: '$__timeTo',\n body: '{ datetime(2018-06-05T20:09:58.907Z) }',\n inputParameters: [],\n },\n {\n name: '$__escapeMulti',\n body: `{ @'\\\\grafana-vm\\Network(eth0)\\Total', @'\\\\hello!'}`,\n inputParameters: [\n {\n name: '$myVar',\n type: 'System.String',\n defaultValue: '$myVar',\n cslDefaultValue: '$myVar',\n },\n ],\n },\n {\n name: '$__contains',\n body: `{ colName in ('value1','value2') }`,\n inputParameters: [\n {\n name: 'colName',\n type: 'System.String',\n defaultValue: 'colName',\n cslDefaultValue: 'colName',\n },\n {\n name: '$myVar',\n type: 'System.String',\n defaultValue: '$myVar',\n cslDefaultValue: '$myVar',\n },\n ],\n }\n );\n\n // Adding macros as global parameters\n const globalParameters = templateVariables.map((v) => {\n return {\n name: `$${v.name}`,\n type: 'dynamic',\n };\n });\n\n return {\n clusterType: 'Engine',\n cluster: {\n connectionString: nameOrIdOrSomething,\n databases: [database],\n },\n database: database,\n globalParameters,\n };\n}\n","import { map } from 'lodash';\nimport { from, Observable } from 'rxjs';\nimport { mergeMap } from 'rxjs/operators';\n\nimport {\n DataQueryRequest,\n DataQueryResponse,\n DataSourceInstanceSettings,\n DataSourceRef,\n ScopedVars,\n} from '@grafana/data';\nimport { DataSourceWithBackend, getTemplateSrv } from '@grafana/runtime';\n\nimport { isGUIDish } from '../components/ResourcePicker/utils';\nimport { getAuthType, getAzureCloud, getAzurePortalUrl } from '../credentials';\nimport LogAnalyticsQuerystringBuilder from '../log_analytics/querystring_builder';\nimport {\n AzureDataSourceJsonData,\n AzureLogsVariable,\n AzureMonitorQuery,\n AzureQueryType,\n DatasourceValidationResult,\n} from '../types';\nimport { interpolateVariable, routeNames } from '../utils/common';\n\nimport ResponseParser, { transformMetadataToKustoSchema } from './response_parser';\n\ninterface AdhocQuery {\n datasource: DataSourceRef;\n path: string;\n resultFormat: string;\n}\n\nexport default class AzureLogAnalyticsDatasource extends DataSourceWithBackend<\n AzureMonitorQuery,\n AzureDataSourceJsonData\n> {\n resourcePath: string;\n azurePortalUrl: string;\n declare applicationId: string;\n\n defaultSubscriptionId?: string;\n\n azureMonitorPath: string;\n firstWorkspace?: string;\n cache: Map<string, any>;\n\n constructor(private instanceSettings: DataSourceInstanceSettings<AzureDataSourceJsonData>) {\n super(instanceSettings);\n this.cache = new Map();\n\n this.resourcePath = `${routeNames.logAnalytics}`;\n this.azureMonitorPath = `${routeNames.azureMonitor}/subscriptions`;\n const cloud = getAzureCloud(instanceSettings);\n this.azurePortalUrl = getAzurePortalUrl(cloud);\n\n this.defaultSubscriptionId = this.instanceSettings.jsonData.subscriptionId || '';\n }\n\n isConfigured(): boolean {\n // If validation didn't return any error then the data source is properly configured\n return !this.validateDatasource();\n }\n\n filterQuery(item: AzureMonitorQuery): boolean {\n return (\n item.hide !== true &&\n !!item.azureLogAnalytics?.query &&\n (!!item.azureLogAnalytics.resource || !!item.azureLogAnalytics.workspace)\n );\n }\n\n async getSubscriptions(): Promise<Array<{ text: string; value: string }>> {\n if (!this.isConfigured()) {\n return [];\n }\n\n const path = `${this.azureMonitorPath}?api-version=2019-03-01`;\n return await this.getResource(path).then((result: any) => {\n return ResponseParser.parseSubscriptions(result);\n });\n }\n\n async getWorkspaces(subscription: string): Promise<AzureLogsVariable[]> {\n const response = await this.getWorkspaceList(subscription);\n\n return (\n map(response.value, (val: any) => {\n return {\n text: val.name,\n value: val.id,\n };\n }) || []\n );\n }\n\n private getWorkspaceList(subscription: string): Promise<any> {\n const subscriptionId = getTemplateSrv().replace(subscription || this.defaultSubscriptionId);\n\n const workspaceListUrl =\n this.azureMonitorPath +\n `/${subscriptionId}/providers/Microsoft.OperationalInsights/workspaces?api-version=2017-04-26-preview`;\n return this.getResource(workspaceListUrl);\n }\n\n async getMetadata(resourceUri: string) {\n const path = `${this.resourcePath}/v1${resourceUri}/metadata`;\n\n const resp = await this.getResource(path);\n return resp;\n }\n\n async getKustoSchema(resourceUri: string) {\n const templateSrv = getTemplateSrv();\n const interpolatedUri = templateSrv.replace(resourceUri, {}, interpolateVariable);\n const metadata = await this.getMetadata(interpolatedUri);\n return transformMetadataToKustoSchema(metadata, interpolatedUri, templateSrv.getVariables());\n }\n\n applyTemplateVariables(target: AzureMonitorQuery, scopedVars: ScopedVars): AzureMonitorQuery {\n const item = target.azureLogAnalytics;\n if (!item) {\n return target;\n }\n\n const templateSrv = getTemplateSrv();\n const resource = templateSrv.replace(item.resource, scopedVars);\n let workspace = templateSrv.replace(item.workspace, scopedVars);\n\n if (!workspace && !resource && this.firstWorkspace) {\n workspace = this.firstWorkspace;\n }\n\n const query = templateSrv.replace(item.query, scopedVars, interpolateVariable);\n\n return {\n refId: target.refId,\n queryType: AzureQueryType.LogAnalytics,\n\n azureLogAnalytics: {\n resultFormat: item.resultFormat,\n query,\n resource,\n\n // Workspace was removed in Grafana 8, but remains for backwards compat\n workspace,\n },\n };\n }\n\n /**\n * Augment the results with links back to the azure console\n */\n query(request: DataQueryRequest<AzureMonitorQuery>): Observable<DataQueryResponse> {\n return super.query(request).pipe(\n mergeMap((res: DataQueryResponse) => {\n return from(this.processResponse(res));\n })\n );\n }\n\n async processResponse(res: DataQueryResponse): Promise<DataQueryResponse> {\n if (res.data) {\n for (const df of res.data) {\n const encodedQuery = df.meta?.custom?.encodedQuery;\n if (encodedQuery && encodedQuery.length > 0) {\n const url = await this.buildDeepLink(df.meta.custom);\n if (url?.length) {\n for (const field of df.fields) {\n field.config.links = [\n {\n url: url,\n title: 'View in Azure Portal',\n targetBlank: true,\n },\n ];\n }\n }\n }\n }\n }\n return res;\n }\n\n private async buildDeepLink(customMeta: Record<string, any>) {\n const base64Enc = encodeURIComponent(customMeta.encodedQuery);\n const workspaceId = customMeta.workspace;\n const subscription = customMeta.subscription;\n\n const details = await this.getWorkspaceDetails(workspaceId);\n if (!details.workspace || !details.resourceGroup) {\n return '';\n }\n\n const url =\n `${this.azurePortalUrl}/#blade/Microsoft_OperationsManagementSuite_Workspace/` +\n `AnalyticsBlade/initiator/AnalyticsShareLinkToQuery/isQueryEditorVisible/true/scope/` +\n `%7B%22resources%22%3A%5B%7B%22resourceId%22%3A%22%2Fsubscriptions%2F${subscription}` +\n `%2Fresourcegroups%2F${details.resourceGroup}%2Fproviders%2Fmicrosoft.operationalinsights%2Fworkspaces%2F${details.workspace}` +\n `%22%7D%5D%7D/query/${base64Enc}/isQueryBase64Compressed/true/timespanInIsoFormat/P1D`;\n return url;\n }\n\n async getWorkspaceDetails(workspaceId: string) {\n if (!this.defaultSubscriptionId) {\n return {};\n }\n const response = await this.getWorkspaceList(this.defaultSubscriptionId);\n\n const details = response.value.find((o: any) => {\n return o.properties.customerId === workspaceId;\n });\n\n if (!details) {\n return {};\n }\n\n const regex = /.*resourcegroups\\/(.*)\\/providers.*/;\n const results = regex.exec(details.id);\n if (!results || results.length < 2) {\n return {};\n }\n\n return {\n workspace: details.name,\n resourceGroup: results[1],\n };\n }\n\n /*\n In 7.5.x it used to be possible to set a default workspace id in the config on the auth page.\n This has been deprecated, however is still used by a few legacy template queries.\n */\n getDeprecatedDefaultWorkSpace() {\n return this.instanceSettings.jsonData.logAnalyticsDefaultWorkspace;\n }\n\n private buildQuery(query: string, options: any, workspace: string): AdhocQuery[] {\n const querystringBuilder = new LogAnalyticsQuerystringBuilder(\n getTemplateSrv().replace(query, {}, interpolateVariable),\n options,\n 'TimeGenerated'\n );\n\n const querystring = querystringBuilder.generate().uriString;\n const path = isGUIDish(workspace)\n ? `${this.resourcePath}/v1/workspaces/${workspace}/query?${querystring}`\n : `${this.resourcePath}/v1${workspace}/query?${querystring}`;\n\n const queries = [\n {\n datasource: this.getRef(),\n path: path,\n resultFormat: 'table',\n },\n ];\n\n return queries;\n }\n\n async getDefaultOrFirstSubscription(): Promise<string | undefined> {\n if (this.defaultSubscriptionId) {\n return this.defaultSubscriptionId;\n }\n const subscriptions = await this.getSubscriptions();\n return subscriptions[0]?.value;\n }\n\n async getFirstWorkspace(): Promise<string | undefined> {\n if (this.firstWorkspace) {\n return this.firstWorkspace;\n }\n\n const subscriptionId = await this.getDefaultOrFirstSubscription();\n if (!subscriptionId) {\n return undefined;\n }\n\n const workspaces = await this.getWorkspaces(subscriptionId);\n const workspace = workspaces[0]?.value;\n\n if (workspace) {\n this.firstWorkspace = workspace;\n }\n\n return workspace;\n }\n\n annotationQuery(options: any) {\n if (!options.annotation.rawQuery) {\n return Promise.reject({\n message: 'Query missing in annotation definition',\n });\n }\n\n const queries = this.buildQuery(options.annotation.rawQuery, options, options.annotation.workspace);\n const promises = this.doQueries(queries);\n\n return Promise.all(promises).then((results) => {\n const annotations = new ResponseParser(results).transformToAnnotations(options);\n return annotations;\n });\n }\n\n doQueries(queries: AdhocQuery[]) {\n return map(queries, (query) => {\n return this.getResource(query.path)\n .then((result: any) => {\n return {\n result: result,\n query: query,\n };\n })\n .catch((err: any) => {\n throw {\n error: err,\n query: query,\n };\n });\n });\n }\n\n async testDatasource(): Promise<DatasourceValidationResult> {\n const validationError = this.validateDatasource();\n if (validationError) {\n return validationError;\n }\n\n let resourceOrWorkspace: string;\n try {\n const result = await this.getFirstWorkspace();\n if (!result) {\n return {\n status: 'error',\n message: 'Workspace not found.',\n };\n }\n resourceOrWorkspace = result;\n } catch (e) {\n let message = 'Azure Log Analytics requires access to Azure Monitor but had the following error: ';\n return {\n status: 'error',\n message: this.getErrorMessage(message, e),\n };\n }\n\n try {\n const path = isGUIDish(resourceOrWorkspace)\n ? `${this.resourcePath}/v1/workspaces/${resourceOrWorkspace}/metadata`\n : `${this.resourcePath}/v1${resourceOrWorkspace}/metadata`;\n\n return await this.getResource(path).then<DatasourceValidationResult>((response: any) => {\n return {\n status: 'success',\n message: 'Successfully queried the Azure Log Analytics service.',\n title: 'Success',\n };\n });\n } catch (e) {\n let message = 'Azure Log Analytics: ';\n return {\n status: 'error',\n message: this.getErrorMessage(message, e),\n };\n }\n }\n\n private getErrorMessage(message: string, error: any) {\n message += error.statusText ? error.statusText + ': ' : '';\n if (error.data && error.data.error && error.data.error.code) {\n message += error.data.error.code + '. ' + error.data.error.message;\n } else if (error.data && error.data.error) {\n message += error.data.error;\n } else if (error.data) {\n message += error.data;\n } else {\n message += 'Cannot connect to Azure Log Analytics REST API.';\n }\n return message;\n }\n\n private validateDatasource(): DatasourceValidationResult | undefined {\n const authType = getAuthType(this.instanceSettings);\n\n if (authType === 'clientsecret') {\n if (!this.isValidConfigField(this.instanceSettings.jsonData.tenantId)) {\n return {\n status: 'error',\n message: 'The Tenant Id field is required.',\n };\n }\n\n if (!this.isValidConfigField(this.instanceSettings.jsonData.clientId)) {\n return {\n status: 'error',\n message: 'The Client Id field is required.',\n };\n }\n }\n\n return undefined;\n }\n\n private isValidConfigField(field: string | undefined): boolean {\n return typeof field === 'string' && field.length > 0;\n }\n}\n","// Unfortunately this list is manually maintained as there's no (nice) automated way to get\n// data from Azure.\n\nexport const locationMetadata = [\n {\n location: 'eastus',\n displayName: 'East US',\n supportsLogs: true,\n },\n {\n location: 'eastus2',\n displayName: 'East US 2',\n supportsLogs: true,\n },\n {\n location: 'southcentralus',\n displayName: 'South Central US',\n supportsLogs: true,\n },\n {\n location: 'westus2',\n displayName: 'West US 2',\n supportsLogs: true,\n },\n {\n location: 'westus3',\n displayName: 'West US 3',\n supportsLogs: true,\n },\n {\n location: 'australiaeast',\n displayName: 'Australia East',\n supportsLogs: true,\n },\n {\n location: 'southeastasia',\n displayName: 'Southeast Asia',\n supportsLogs: true,\n },\n {\n location: 'northeurope',\n displayName: 'North Europe',\n supportsLogs: true,\n },\n {\n location: 'uksouth',\n displayName: 'UK South',\n supportsLogs: true,\n },\n {\n location: 'westeurope',\n displayName: 'West Europe',\n supportsLogs: true,\n },\n {\n location: 'centralus',\n displayName: 'Central US',\n supportsLogs: true,\n },\n {\n location: 'northcentralus',\n displayName: 'North Central US',\n supportsLogs: true,\n },\n {\n location: 'westus',\n displayName: 'West US',\n supportsLogs: true,\n },\n {\n location: 'southafricanorth',\n displayName: 'South Africa North',\n supportsLogs: true,\n },\n {\n location: 'centralindia',\n displayName: 'Central India',\n supportsLogs: true,\n },\n {\n location: 'eastasia',\n displayName: 'East Asia',\n supportsLogs: true,\n },\n {\n location: 'japaneast',\n displayName: 'Japan East',\n supportsLogs: true,\n },\n {\n location: 'jioindiawest',\n displayName: 'Jio India West',\n supportsLogs: true,\n },\n {\n location: 'koreacentral',\n displayName: 'Korea Central',\n supportsLogs: true,\n },\n {\n location: 'canadacentral',\n displayName: 'Canada Central',\n supportsLogs: true,\n },\n {\n location: 'francecentral',\n displayName: 'France Central',\n supportsLogs: true,\n },\n {\n location: 'germanywestcentral',\n displayName: 'Germany West Central',\n supportsLogs: true,\n },\n {\n location: 'norwayeast',\n displayName: 'Norway East',\n supportsLogs: true,\n },\n {\n location: 'switzerlandnorth',\n displayName: 'Switzerland North',\n supportsLogs: true,\n },\n {\n location: 'uaenorth',\n displayName: 'UAE North',\n supportsLogs: true,\n },\n {\n location: 'brazilsouth',\n displayName: 'Brazil South',\n supportsLogs: true,\n },\n {\n location: 'centralusstage',\n displayName: 'Central US (Stage)',\n supportsLogs: true,\n },\n {\n location: 'eastusstage',\n displayName: 'East US (Stage)',\n supportsLogs: true,\n },\n {\n location: 'eastus2stage',\n displayName: 'East US 2 (Stage)',\n supportsLogs: true,\n },\n {\n location: 'northcentralusstage',\n displayName: 'North Central US (Stage)',\n supportsLogs: true,\n },\n {\n location: 'southcentralusstage',\n displayName: 'South Central US (Stage)',\n supportsLogs: true,\n },\n {\n location: 'westusstage',\n displayName: 'West US (Stage)',\n supportsLogs: true,\n },\n {\n location: 'westus2stage',\n displayName: 'West US 2 (Stage)',\n supportsLogs: true,\n },\n {\n location: 'asia',\n displayName: 'Asia',\n supportsLogs: true,\n },\n {\n location: 'asiapacific',\n displayName: 'Asia Pacific',\n supportsLogs: true,\n },\n {\n location: 'australia',\n displayName: 'Australia',\n supportsLogs: true,\n },\n {\n location: 'brazil',\n displayName: 'Brazil',\n supportsLogs: true,\n },\n {\n location: 'canada',\n displayName: 'Canada',\n supportsLogs: true,\n },\n {\n location: 'europe',\n displayName: 'Europe',\n supportsLogs: true,\n },\n {\n location: 'global',\n displayName: 'Global',\n supportsLogs: true,\n },\n {\n location: 'india',\n displayName: 'India',\n supportsLogs: true,\n },\n {\n location: 'japan',\n displayName: 'Japan',\n supportsLogs: true,\n },\n {\n location: 'uk',\n displayName: 'United Kingdom',\n supportsLogs: true,\n },\n {\n location: 'unitedstates',\n displayName: 'United States',\n supportsLogs: true,\n },\n {\n location: 'eastasiastage',\n displayName: 'East Asia (Stage)',\n supportsLogs: true,\n },\n {\n location: 'southeastasiastage',\n displayName: 'Southeast Asia (Stage)',\n supportsLogs: true,\n },\n {\n location: 'westcentralus',\n displayName: 'West Central US',\n supportsLogs: true,\n },\n {\n location: 'southafricawest',\n displayName: 'South Africa West',\n supportsLogs: true,\n },\n {\n location: 'australiacentral',\n displayName: 'Australia Central',\n supportsLogs: true,\n },\n {\n location: 'australiacentral2',\n displayName: 'Australia Central 2',\n supportsLogs: true,\n },\n {\n location: 'australiasoutheast',\n displayName: 'Australia Southeast',\n supportsLogs: true,\n },\n {\n location: 'japanwest',\n displayName: 'Japan West',\n supportsLogs: true,\n },\n {\n location: 'koreasouth',\n displayName: 'Korea South',\n supportsLogs: true,\n },\n {\n location: 'southindia',\n displayName: 'South India',\n supportsLogs: true,\n },\n {\n location: 'westindia',\n displayName: 'West India',\n supportsLogs: true,\n },\n {\n location: 'canadaeast',\n displayName: 'Canada East',\n supportsLogs: true,\n },\n {\n location: 'francesouth',\n displayName: 'France South',\n supportsLogs: true,\n },\n {\n location: 'germanynorth',\n displayName: 'Germany North',\n supportsLogs: true,\n },\n {\n location: 'norwaywest',\n displayName: 'Norway West',\n supportsLogs: true,\n },\n {\n location: 'switzerlandwest',\n displayName: 'Switzerland West',\n supportsLogs: true,\n },\n {\n location: 'ukwest',\n displayName: 'UK West',\n supportsLogs: true,\n },\n {\n location: 'uaecentral',\n displayName: 'UAE Central',\n supportsLogs: true,\n },\n {\n location: 'brazilsoutheast',\n displayName: 'Brazil Southeast',\n supportsLogs: true,\n },\n {\n location: 'chinaeast',\n displayName: 'China Eest',\n supportsLogs: true,\n },\n {\n location: 'chinaeast2',\n displayName: 'China Eest 2',\n supportsLogs: true,\n },\n {\n location: 'chinanorth',\n displayName: 'China North',\n supportsLogs: true,\n },\n {\n location: 'chinanorth2',\n displayName: 'China North 2',\n supportsLogs: true,\n },\n {\n location: 'chinanorth3',\n displayName: 'China North 3',\n supportsLogs: true,\n },\n];\n\nexport const logsSupportedLocationsKusto = locationMetadata\n .filter((v) => v.supportsLogs)\n .map((v) => `\"${v.location}\"`)\n .join(',');\n\n// Object, keyed by location ID\nexport const locationDisplayNames: Record<string, string> = locationMetadata.reduce(\n (acc, location) => ({\n ...acc,\n [location.location]: location.displayName,\n }),\n {}\n);\n","/**\nThis list is obtained parsing https://docs.microsoft.com/en-us/azure/governance/resource-graph/reference/supported-tables-resources\nTo programatically get the list, execute in the browser console:\n \n const i = {};\n document.querySelectorAll('li').forEach((li) => { \n const m = li.textContent.match(/(.*\\..*\\/.*?)\\s\\((.*)\\)/);\n if (m) {\n i[m[1].toLowerCase()] = m[2];\n }\n });\n i;\n \nNote: Validate that the output makes sense, the format of the page may change.\n */\nexport const resourceTypeDisplayNames: { [k: string]: string } = {\n 'microsoft.recoveryservices/vaults/backupfabrics/protectioncontainers/protecteditems': 'Backup Items',\n 'microsoft.resources/subscriptions': 'Subscriptions',\n 'microsoft.resources/subscriptions/resourcegroups': 'Resource groups',\n 'citrix.services/xenappessentials': 'Citrix Virtual Apps Essentials',\n 'citrix.services/xendesktopessentials': 'Citrix Virtual Desktops Essentials',\n 'dynatrace.observability/monitors': 'Dynatrace',\n 'github.enterprise/accounts': 'GitHub AE',\n 'microsoft.aad/domainservices': 'Azure AD Domain Services',\n 'microsoft.aadiam/privatelinkforazuread': 'Private Link for Azure AD',\n 'microsoft.agfoodplatform/farmbeats': 'Azure FarmBeats',\n 'microsoft.analysisservices/servers': 'Analysis Services',\n 'microsoft.anybuild/clusters': 'AnyBuild clusters',\n 'microsoft.apimanagement/service': 'API Management services',\n 'microsoft.appconfiguration/configurationstores': 'App Configuration',\n 'microsoft.appplatform/spring': 'Azure Spring Cloud',\n 'microsoft.attestation/attestationproviders': 'Attestation providers',\n 'microsoft.authorization/resourcemanagementprivatelinks': 'Resource management private links',\n 'microsoft.automation/automationaccounts': 'Automation Accounts',\n 'microsoft.automation/automationaccounts/runbooks': 'Runbook',\n 'microsoft.autonomoussystems/workspaces': 'Bonsai',\n 'microsoft.avs/privateclouds': 'AVS Private clouds',\n 'microsoft.azureactivedirectory/b2cdirectories': 'B2C Tenants',\n 'microsoft.azureactivedirectory/guestusages': 'Guest Usages',\n 'microsoft.azurearcdata/datacontrollers': 'Azure Arc data controllers',\n 'microsoft.azurearcdata/postgresinstances': 'Azure Arc-enabled PostgreSQL Hyperscale server groups',\n 'microsoft.azurearcdata/sqlmanagedinstances': 'SQL managed instances - Azure Arc',\n 'microsoft.azurearcdata/sqlserverinstances': 'SQL Server - Azure Arc',\n 'microsoft.azuredata/sqlserverregistrations': 'SQL Server registries',\n 'microsoft.azurepercept/accounts': 'Azure Percept accounts',\n 'microsoft.azurestackhci/clusters': 'Azure Stack HCI',\n 'microsoft.azurestackhci/virtualmachines': 'Azure Stack HCI virtual machine - Azure Arc',\n 'microsoft.baremetal/crayservers': 'Cray Servers',\n 'microsoft.baremetal/monitoringservers': 'Monitoring Servers',\n 'microsoft.baremetalinfrastructure/baremetalinstances': 'BareMetal Instances',\n 'microsoft.batch/batchaccounts': 'Batch accounts',\n 'microsoft.bing/accounts': 'Bing Resources',\n 'microsoft.botservice/botservices': 'Bot Services',\n 'microsoft.cache/redis': 'Azure Cache for Redis',\n 'microsoft.cache/redisenterprise': 'Redis Enterprise',\n 'microsoft.cdn/cdnwebapplicationfirewallpolicies': 'Content Delivery Network WAF policies',\n 'microsoft.cdn/profiles (front doors standard/premium': 'Preview)',\n 'microsoft.cdn/profiles/afdendpoints': 'Endpoints',\n 'microsoft.cdn/profiles/endpoints': 'Endpoints',\n 'microsoft.certificateregistration/certificateorders': 'App Service Certificates',\n 'microsoft.chaos/chaosexperiments': 'Chaos Experiments (Classic)',\n 'microsoft.chaos/experiments': 'Chaos Experiments',\n 'microsoft.classiccompute/domainnames': 'Cloud services (classic)',\n 'microsoft.classiccompute/virtualmachines': 'Virtual machines (classic)',\n 'microsoft.classicnetwork/networksecuritygroups': 'Network security groups (classic)',\n 'microsoft.classicnetwork/reservedips': 'Reserved IP addresses (classic)',\n 'microsoft.classicnetwork/virtualnetworks': 'Virtual networks (classic)',\n 'microsoft.classicstorage/storageaccounts': 'Storage accounts (classic)',\n 'microsoft.cloudtest/accounts': 'CloudTest Accounts',\n 'microsoft.cloudtest/hostedpools': '1ES Hosted Pools',\n 'microsoft.cloudtest/images': 'CloudTest Images',\n 'microsoft.cloudtest/pools': 'CloudTest Pools',\n 'microsoft.clusterstor/nodes': 'ClusterStors',\n 'microsoft.cognitiveservices/accounts': 'Cognitive Services',\n 'microsoft.compute/availabilitysets': 'Availability sets',\n 'microsoft.compute/capacityreservationgroups': 'Capacity Reservation Groups',\n 'microsoft.compute/cloudservices': 'Cloud services (extended support)',\n 'microsoft.compute/diskaccesses': 'Disk Accesses',\n 'microsoft.compute/diskencryptionsets': 'Disk Encryption Sets',\n 'microsoft.compute/disks': 'Disks',\n 'microsoft.compute/galleries': 'Azure compute galleries',\n 'microsoft.compute/galleries/applications': 'VM application definitions',\n 'microsoft.compute/galleries/applications/versions': 'VM application versions',\n 'microsoft.compute/galleries/images': 'VM image definitions',\n 'microsoft.compute/galleries/images/versions': 'VM image versions',\n 'microsoft.compute/hostgroups': 'Host groups',\n 'microsoft.compute/hostgroups/hosts': 'Hosts',\n 'microsoft.compute/images': 'Images',\n 'microsoft.compute/proximityplacementgroups': 'Proximity placement groups',\n 'microsoft.compute/restorepointcollections': 'Restore Point Collections',\n 'microsoft.compute/snapshots': 'Snapshots',\n 'microsoft.compute/sshpublickeys': 'SSH keys',\n 'microsoft.compute/virtualmachines': 'Virtual machines',\n 'microsoft.compute/virtualmachinescalesets': 'Virtual machine scale sets',\n 'microsoft.confidentialledger/ledgers': 'Confidential Ledgers',\n 'microsoft.confluent/organizations': 'Confluent organizations',\n 'microsoft.connectedcache/cachenodes': 'Connected Cache Resources',\n 'microsoft.connectedcache/enterprisecustomers': 'Connected Cache Resources',\n 'microsoft.connectedvehicle/platformaccounts': 'Connected Vehicle Platforms',\n 'microsoft.connectedvmwarevsphere/vcenters': 'VMware vCenters',\n 'microsoft.connectedvmwarevsphere/virtualmachines': 'VMware + AVS virtual machines',\n 'microsoft.containerinstance/containergroups': 'Container instances',\n 'microsoft.containerregistry/registries': 'Container registries',\n 'microsoft.containerregistry/registries/replications': 'Container registry replications',\n 'microsoft.containerregistry/registries/webhooks': 'Container registry webhooks',\n 'microsoft.containerservice/managedclusters': 'Kubernetes services',\n 'microsoft.dashboard/grafana': 'Grafana Workspaces',\n 'microsoft.databox/jobs': 'Azure Data Box',\n 'microsoft.databoxedge/databoxedgedevices': 'Azure Stack Edge / Data Box Gateway',\n 'microsoft.databricks/workspaces': 'Azure Databricks Services',\n 'microsoft.datacatalog/catalogs': 'Data Catalog',\n 'microsoft.datacollaboration/workspaces': 'Project CI',\n 'microsoft.datadog/monitors': 'Datadog',\n 'microsoft.datafactory/datafactories': 'Data factories',\n 'microsoft.datafactory/factories': 'Data factories (V2)',\n 'microsoft.datalakeanalytics/accounts': 'Data Lake Analytics',\n 'microsoft.datalakestore/accounts': 'Data Lake Storage Gen1',\n 'microsoft.datamigration/services': 'Azure Database Migration Services',\n 'microsoft.datamigration/services/projects': 'Azure Database Migration Projects',\n 'microsoft.datamigration/sqlmigrationservices': 'Azure Database Migration Services',\n 'microsoft.dataprotection/backupvaults': 'Backup vaults',\n 'microsoft.dataprotection/resourceguards': 'Resource Guards (Preview)',\n 'microsoft.datareplication/replicationvaults': 'Site Recovery Vaults',\n 'microsoft.datashare/accounts': 'Data Shares',\n 'microsoft.dbformariadb/servers': 'Azure Database for MariaDB servers',\n 'microsoft.dbformysql/flexibleservers': 'Azure Database for MySQL flexible servers',\n 'microsoft.dbformysql/servers': 'Azure Database for MySQL servers',\n 'microsoft.dbforpostgresql/flexibleservers': 'Azure Database for PostgreSQL flexible servers',\n 'microsoft.dbforpostgresql/servergroups': 'Azure Database for PostgreSQL server groups',\n 'microsoft.dbforpostgresql/servergroupsv2': 'Azure Database for PostgreSQL server groups',\n 'microsoft.dbforpostgresql/servers': 'Azure Database for PostgreSQL servers',\n 'microsoft.dbforpostgresql/serversv2': 'Azure Database for PostgreSQL servers v2',\n 'microsoft.deploymentmanager/rollouts': 'Rollouts',\n 'microsoft.desktopvirtualization/applicationgroups': 'Application groups',\n 'microsoft.desktopvirtualization/hostpools': 'Host pools',\n 'microsoft.desktopvirtualization/scalingplans': 'Scaling plans',\n 'microsoft.desktopvirtualization/workspaces': 'Workspaces',\n 'microsoft.devices/iothubs': 'IoT Hub',\n 'microsoft.devices/provisioningservices': 'Device Provisioning Services',\n 'microsoft.deviceupdate/accounts': 'Device Update for IoT Hubs',\n 'microsoft.devops/pipelines': 'DevOps Starter',\n 'microsoft.devtestlab/labs': 'DevTest Labs',\n 'microsoft.devtestlab/labs/virtualmachines': 'Virtual machines',\n 'microsoft.digitaltwins/digitaltwinsinstances': 'Azure Digital Twins',\n 'microsoft.documentdb/cassandraclusters': 'Azure Managed Instance for Apache Cassandra',\n 'microsoft.documentdb/databaseaccounts': 'Azure Cosmos DB accounts',\n 'microsoft.domainregistration/domains': 'App Service Domains',\n 'microsoft.edgeorder/addresses': 'Azure Edge Hardware Center Address',\n 'microsoft.edgeorder/orderitems': 'Azure Edge Hardware Center',\n 'microsoft.elastic/monitors': 'Elasticsearch (Elastic Cloud)',\n 'microsoft.eventgrid/domains': 'Event Grid Domains',\n 'microsoft.eventgrid/partnernamespaces': 'Event Grid Partner Namespaces',\n 'microsoft.eventgrid/partnerregistrations': 'Event Grid Partner Registrations',\n 'microsoft.eventgrid/partnertopics': 'Event Grid Partner Topics',\n 'microsoft.eventgrid/systemtopics': 'Event Grid System Topics',\n 'microsoft.eventgrid/topics': 'Event Grid Topics',\n 'microsoft.eventhub/clusters': 'Event Hubs Clusters',\n 'microsoft.eventhub/namespaces': 'Event Hubs Namespaces',\n 'microsoft.experimentation/experimentworkspaces': 'Experiment Workspaces',\n 'microsoft.extendedlocation/customlocations': 'Custom locations',\n 'microsoft.fidalgo/devcenters': 'Fidalgo DevCenters',\n 'microsoft.fidalgo/networksettings': 'Network Configurations',\n 'microsoft.fidalgo/projects': 'Fidalgo Projects',\n 'microsoft.fidalgo/projects/environments': 'Fidalgo Environments',\n 'microsoft.fluidrelay/fluidrelayservers': 'Fluid Relay',\n 'microsoft.genomics/accounts': 'Genomics accounts',\n 'microsoft.hanaonazure/hanainstances': 'SAP HANA on Azure',\n 'microsoft.hanaonazure/sapmonitors': 'Azure Monitors for SAP Solutions',\n 'microsoft.hdinsight/clusterpools': 'HDInsight cluster pools',\n 'microsoft.hdinsight/clusterpools/clusters': 'HDInsight gen2 clusters',\n 'microsoft.hdinsight/clusterpools/clusters/sessionclusters': 'HDInsight session clusters',\n 'microsoft.hdinsight/clusters': 'HDInsight clusters',\n 'microsoft.healthbot/healthbots': 'Azure Health Bot',\n 'microsoft.healthcareapis/services': 'Azure API for FHIR',\n 'microsoft.healthcareapis/workspaces': 'Healthcare APIs Workspaces',\n 'microsoft.healthcareapis/workspaces/dicomservices': 'DICOM services',\n 'microsoft.healthcareapis/workspaces/fhirservices': 'FHIR services',\n 'microsoft.healthcareapis/workspaces/iotconnectors': 'IoT connectors',\n 'microsoft.hpcworkbench/instances': 'HPC Workbenches (preview)',\n 'microsoft.hpcworkbench/instances/chambers': 'Chambers (preview)',\n 'microsoft.hpcworkbench/instances/chambers/accessprofiles': 'Chamber Profiles (preview)',\n 'microsoft.hpcworkbench/instances/chambers/workloads': 'Chamber VMs (preview)',\n 'microsoft.hpcworkbench/instances/consortiums': 'Consortiums (preview)',\n 'microsoft.hybridcompute/machines': 'Servers - Azure Arc',\n 'microsoft.hybridcompute/privatelinkscopes': 'Azure Arc Private Link Scopes',\n 'microsoft.hybriddata/datamanagers': 'StorSimple Data Managers',\n 'microsoft.hybridnetwork/devices': 'Azure Network Function Manager – Devices',\n 'microsoft.hybridnetwork/networkfunctions': 'Azure Network Function Manager – Network Functions',\n 'microsoft.importexport/jobs': 'Import/export jobs',\n 'microsoft.insights/components': 'Application Insights',\n 'microsoft.insights/datacollectionendpoints': 'Data collection endpoints',\n 'microsoft.insights/datacollectionrules': 'Data collection rules',\n 'microsoft.insights/privatelinkscopes': 'Azure Monitor Private Link Scopes',\n 'microsoft.insights/webtests': 'Availability tests',\n 'microsoft.insights/workbooks': 'Azure Workbooks',\n 'microsoft.insights/workbooktemplates': 'Azure Workbook Templates',\n 'microsoft.iotcentral/iotapps': 'IoT Central Applications',\n 'microsoft.keyvault/vaults': 'Key vaults',\n 'microsoft.kubernetes/connectedclusters': 'Kubernetes - Azure Arc',\n 'microsoft.kusto/clusters': 'Azure Data Explorer Clusters',\n 'microsoft.kusto/clusters/databases': 'Azure Data Explorer Databases',\n 'microsoft.labservices/labaccounts': 'Lab accounts',\n 'microsoft.labservices/labplans': 'Lab plans',\n 'microsoft.labservices/labs': 'Labs',\n 'microsoft.loadtestservice/loadtests': 'Azure Load Testing',\n 'microsoft.logic/integrationaccounts': 'Integration accounts',\n 'microsoft.logic/integrationserviceenvironments': 'Integration Service Environments',\n 'microsoft.logic/integrationserviceenvironments/managedapis': 'Managed Connector',\n 'microsoft.logic/workflows': 'Logic apps',\n 'microsoft.logz/monitors': 'Logz main account',\n 'microsoft.logz/monitors/accounts': 'Logz sub account',\n 'microsoft.logz/monitors/metricssource': 'Logz metrics data source',\n 'microsoft.machinelearning/commitmentplans': 'Machine Learning Studio (classic) web service plans',\n 'microsoft.machinelearning/webservices': 'Machine Learning Studio (classic) web services',\n 'microsoft.machinelearning/workspaces': 'Machine Learning Studio (classic) workspaces',\n 'microsoft.machinelearningservices/workspaces': 'Machine learning',\n 'microsoft.machinelearningservices/workspaces/onlineendpoints': 'Machine learning online endpoints',\n 'microsoft.machinelearningservices/workspaces/onlineendpoints/deployments': 'Machine learning online deployments',\n 'microsoft.maintenance/maintenanceconfigurations': 'Maintenance Configurations',\n 'microsoft.managedidentity/userassignedidentities': 'Managed Identities',\n 'microsoft.maps/accounts': 'Azure Maps Accounts',\n 'microsoft.maps/accounts/creators': 'Azure Maps Creator Resources',\n 'microsoft.media/mediaservices': 'Media Services',\n 'microsoft.media/mediaservices/liveevents': 'Live events',\n 'microsoft.media/mediaservices/streamingendpoints': 'Streaming Endpoints',\n 'microsoft.media/videoanalyzers': 'Video Analyzers',\n 'microsoft.migrate/projects': 'Migration projects',\n 'microsoft.mixedreality/objectanchorsaccounts': 'Object Anchors Accounts',\n 'microsoft.mixedreality/objectunderstandingaccounts': 'Object Understanding Accounts',\n 'microsoft.mixedreality/remoterenderingaccounts': 'Remote Rendering Accounts',\n 'microsoft.mixedreality/spatialanchorsaccounts': 'Spatial Anchors Accounts',\n 'microsoft.mobilenetwork/mobilenetworks': 'Mobile Networks',\n 'microsoft.mobilenetwork/mobilenetworks/datanetworks': 'Data Networks',\n 'microsoft.mobilenetwork/mobilenetworks/services': 'Services',\n 'microsoft.mobilenetwork/mobilenetworks/simpolicies': 'Sim Policies',\n 'microsoft.mobilenetwork/mobilenetworks/sites': 'Mobile Network Sites',\n 'microsoft.mobilenetwork/mobilenetworks/slices': 'Slices',\n 'microsoft.mobilenetwork/packetcorecontrolplanes': 'Packet Core Control Planes',\n 'microsoft.mobilenetwork/packetcorecontrolplanes/packetcoredataplanes': 'Packet Core Data Planes',\n 'microsoft.mobilenetwork/packetcorecontrolplanes/packetcoredataplanes/attacheddatanetworks': 'Attached Data Networks',\n 'microsoft.mobilenetwork/sims': 'Sims',\n 'microsoft.netapp/netappaccounts': 'NetApp accounts',\n 'microsoft.netapp/netappaccounts/capacitypools': 'Capacity pools',\n 'microsoft.netapp/netappaccounts/capacitypools/volumes': 'Volumes',\n 'microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots': 'Snapshots',\n 'microsoft.netapp/netappaccounts/snapshotpolicies': 'Snapshot policies',\n 'microsoft.network/applicationgateways': 'Application gateways',\n 'microsoft.network/applicationgatewaywebapplicationfirewallpolicies': 'Application Gateway WAF policies',\n 'microsoft.network/applicationsecuritygroups': 'Application security groups',\n 'microsoft.network/azurefirewalls': 'Firewalls',\n 'microsoft.network/bastionhosts': 'Bastions',\n 'microsoft.network/connections': 'Connections',\n 'microsoft.network/customipprefixes': 'Custom IP Prefixes',\n 'microsoft.network/ddosprotectionplans': 'DDoS protection plans',\n 'microsoft.network/dnsforwardingrulesets': 'Dns Forwarding Rulesets',\n 'microsoft.network/dnsresolvers': 'DNS Private Resolvers',\n 'microsoft.network/dnszones': 'DNS zones',\n 'microsoft.network/expressroutecircuits': 'ExpressRoute circuits',\n 'microsoft.network/expressrouteports': 'ExpressRoute Direct',\n 'microsoft.network/firewallpolicies': 'Firewall Policies',\n 'microsoft.network/frontdoors': 'Front Doors',\n 'microsoft.network/frontdoorwebapplicationfirewallpolicies': 'Web Application Firewall policies (WAF)',\n 'microsoft.network/ipgroups': 'IP Groups',\n 'microsoft.network/loadbalancers': 'Load balancers',\n 'microsoft.network/localnetworkgateways': 'Local network gateways',\n 'microsoft.network/natgateways': 'NAT gateways',\n 'microsoft.network/networkexperimentprofiles': 'Internet Analyzer profiles',\n 'microsoft.network/networkinterfaces': 'Network interfaces',\n 'microsoft.network/networkmanagers': 'Network Managers',\n 'microsoft.network/networksecuritygroups': 'Network security groups',\n 'microsoft.network/networkwatchers': 'Network Watchers',\n 'microsoft.network/networkwatchers/flowlogs': 'NSG Flow Logs',\n 'microsoft.network/privatednszones': 'Private DNS zones',\n 'microsoft.network/privateendpoints': 'Private endpoints',\n 'microsoft.network/privatelinkservices': 'Private link services',\n 'microsoft.network/publicipaddresses': 'Public IP addresses',\n 'microsoft.network/publicipprefixes': 'Public IP Prefixes',\n 'microsoft.network/routefilters': 'Route filters',\n 'microsoft.network/routetables': 'Route tables',\n 'microsoft.network/serviceendpointpolicies': 'Service endpoint policies',\n 'microsoft.network/trafficmanagerprofiles': 'Traffic Manager profiles',\n 'microsoft.network/virtualnetworkgateways': 'Virtual network gateways',\n 'microsoft.network/virtualnetworks': 'Virtual networks',\n 'microsoft.network/virtualwans': 'Virtual WANs',\n 'microsoft.notificationhubs/namespaces': 'Notification Hub Namespaces',\n 'microsoft.notificationhubs/namespaces/notificationhubs': 'Notification Hubs',\n 'microsoft.openenergyplatform/energyservices': 'Project Oak Forest',\n 'microsoft.openlogisticsplatform/workspaces': 'Open Supply Chain Platform',\n 'microsoft.operationalinsights/querypacks': 'Log Analytics query packs',\n 'microsoft.operationalinsights/workspaces': 'Log Analytics workspaces',\n 'microsoft.operationsmanagement/solutions': 'Solutions',\n 'microsoft.orbital/contactprofiles': 'Contact Profiles',\n 'microsoft.orbital/edgesites': 'Edge Sites',\n 'microsoft.orbital/groundstations': 'Ground Stations',\n 'microsoft.orbital/l2connections': 'L2 Connections',\n 'microsoft.orbital/spacecrafts': 'Spacecrafts',\n 'microsoft.peering/peerings': 'Peerings',\n 'microsoft.peering/peeringservices': 'Peering Services',\n 'microsoft.playfab/playeraccountpools': 'PlayFab player account pools',\n 'microsoft.playfab/titles': 'PlayFab titles',\n 'microsoft.portal/dashboards': 'Shared dashboards',\n 'microsoft.powerbidedicated/capacities': 'Power BI Embedded',\n 'microsoft.purview/accounts': 'Microsoft Purview accounts',\n 'microsoft.quantum/workspaces': 'Quantum Workspaces',\n 'microsoft.recommendationsservice/accounts': 'Intelligent Recommendations Accounts',\n 'microsoft.recommendationsservice/accounts/modeling': 'Modeling',\n 'microsoft.recommendationsservice/accounts/serviceendpoints': 'Service Endpoints',\n 'microsoft.recoveryservices/vaults': 'Recovery Services vaults',\n 'microsoft.redhatopenshift/openshiftclusters': 'Azure Red Hat OpenShift',\n 'microsoft.relay/namespaces': 'Relays',\n 'microsoft.resourceconnector/appliances': 'Resource bridges',\n 'microsoft.resourcegraph/queries': 'Resource Graph queries',\n 'microsoft.resources/deploymentscripts': 'Deployment Scripts',\n 'microsoft.resources/templatespecs': 'Template specs',\n 'microsoft.saas/applications': 'Software as a Service (classic)',\n 'microsoft.saas/resources': 'SaaS',\n 'microsoft.scom/managedinstances': 'Aquila Instances',\n 'microsoft.scvmm/virtualmachines': 'SCVMM virtual machine - Azure Arc',\n 'microsoft.scvmm/vmmservers': 'SCVMM management servers',\n 'microsoft.search/searchservices': 'Search services',\n 'microsoft.securitydetonation/chambers': 'Security Detonation Chambers',\n 'microsoft.servicebus/namespaces': 'Service Bus Namespaces',\n 'microsoft.servicefabric/clusters': 'Service Fabric clusters',\n 'microsoft.servicefabric/managedclusters': 'Service Fabric managed clusters',\n 'microsoft.serviceshub/connectors': 'Services Hub Connectors',\n 'microsoft.signalrservice/signalr': 'SignalR',\n 'microsoft.signalrservice/webpubsub': 'Web PubSub Service',\n 'microsoft.solutions/applicationdefinitions': 'Service catalog managed application definitions',\n 'microsoft.solutions/applications': 'Managed applications',\n 'microsoft.sql/instancepools': 'Instance pools',\n 'microsoft.sql/managedinstances': 'SQL managed instances',\n 'microsoft.sql/managedinstances/databases': 'Managed databases',\n 'microsoft.sql/servers': 'SQL servers',\n 'microsoft.sql/servers/databases': 'SQL databases',\n 'microsoft.sql/servers/elasticpools': 'SQL elastic pools',\n 'microsoft.sql/servers/jobagents': 'Elastic Job agents',\n 'microsoft.sql/virtualclusters': 'Virtual clusters',\n 'microsoft.sqlvirtualmachine/sqlvirtualmachines': 'SQL virtual machines',\n 'microsoft.storage/storageaccounts': 'Storage accounts',\n 'microsoft.storagecache/amlfilesystems': 'Lustre File Systems',\n 'microsoft.storagecache/caches': 'HPC caches',\n 'microsoft.storagepool/diskpools': 'Disk Pools',\n 'microsoft.storagesync/storagesyncservices': 'Storage Sync Services',\n 'microsoft.storagesyncdev/storagesyncservices': 'Storage Sync Services',\n 'microsoft.storagesyncint/storagesyncservices': 'Storage Sync Services',\n 'microsoft.storsimple/managers': 'StorSimple Device Managers',\n 'microsoft.streamanalytics/clusters': 'Stream Analytics clusters',\n 'microsoft.streamanalytics/streamingjobs': 'Stream Analytics jobs',\n 'microsoft.synapse/privatelinkhubs': 'Azure Synapse Analytics (private link hubs)',\n 'microsoft.synapse/workspaces': 'Azure Synapse Analytics',\n 'microsoft.synapse/workspaces/bigdatapools': 'Apache Spark pools',\n 'microsoft.synapse/workspaces/kustopools': 'Data Explorer pools (preview)',\n 'microsoft.synapse/workspaces/sqlpools': 'Dedicated SQL pools',\n 'microsoft.testbase/testbaseaccounts': 'Test Base Accounts',\n 'microsoft.testbase/testbaseaccounts/packages': 'Test Base Packages',\n 'microsoft.timeseriesinsights/environments': 'Time Series Insights environments',\n 'microsoft.timeseriesinsights/environments/eventsources': 'Time Series Insights event sources',\n 'microsoft.timeseriesinsights/environments/referencedatasets': 'Time Series Insights reference data sets',\n 'microsoft.videoindexer/accounts': 'Video Analyzer for Media',\n 'microsoft.virtualmachineimages/imagetemplates': 'Image Templates',\n 'microsoft.visualstudio/account': 'Azure DevOps organizations',\n 'microsoft.visualstudio/account/project': 'DevOps Starter',\n 'microsoft.vmwarecloudsimple/dedicatedcloudnodes': 'CloudSimple Nodes',\n 'microsoft.vmwarecloudsimple/dedicatedcloudservices': 'CloudSimple Services',\n 'microsoft.vmwarecloudsimple/virtualmachines': 'CloudSimple Virtual Machines',\n 'microsoft.vsonline/plans': 'Visual Studio Online Plans',\n 'microsoft.web/connectiongateways': 'On-premises data gateways',\n 'microsoft.web/connections': 'API Connections',\n 'microsoft.web/containerapps': 'Container Apps',\n 'microsoft.web/customapis': 'Logic Apps Custom Connector',\n 'microsoft.web/hostingenvironments': 'App Service Environments',\n 'microsoft.web/kubeenvironments': 'App Service Kubernetes Environments',\n 'microsoft.web/serverfarms': 'App Service plans',\n 'microsoft.web/sites': 'App Services',\n 'microsoft.web/sites/slots': 'App Service (Slots)',\n 'microsoft.web/staticsites': 'Static Web Apps',\n 'microsoft.windowsesu/multipleactivationkeys': 'Windows Multiple Activation Keys',\n 'microsoft.windowsiot/deviceservices': 'Windows 10 IoT Core Services',\n 'microsoft.workloads/monitors': 'Azure Monitors for SAP Solutions (v2)',\n 'microsoft.workloads/phpworkloads': 'Scalable WordPress on Linux',\n 'microsoft.workloads/sapvirtualinstances': 'SAP Virtual Instances',\n 'microsoft.workloads/sapvirtualinstances/applicationinstances': 'SAP app server instances',\n 'microsoft.workloads/sapvirtualinstances/centralinstances': 'SAP central server instances',\n 'microsoft.workloads/sapvirtualinstances/databaseinstances': 'SAP database server instances',\n 'nginx.nginxplus/nginxdeployments': 'NGINX Deployment',\n 'providers.test/statefulibizaengines': 'VLCentral Help',\n 'wandisco.fusion/fusiongroups': 'LiveData Planes',\n 'wandisco.fusion/fusiongroups/azurezones': 'Azure Zones',\n 'wandisco.fusion/fusiongroups/azurezones/plugins': 'Plugins',\n 'wandisco.fusion/fusiongroups/hivereplicationrules': 'Hive Replication Rules',\n 'wandisco.fusion/fusiongroups/managedonpremzones': 'On-premises Zones',\n 'wandisco.fusion/fusiongroups/replicationrules': 'Replication Rules',\n 'wandisco.fusion/migrators': 'LiveData Migrators',\n 'wandisco.fusion/migrators/exclusiontemplates': 'Exclusions',\n 'wandisco.fusion/migrators/livedatamigrations': 'Migrations',\n 'wandisco.fusion/migrators/metadatamigrations': 'Metadata Migrations',\n 'wandisco.fusion/migrators/metadatatargets': 'Metadata Targets',\n 'wandisco.fusion/migrators/pathmappings': 'Path Mappings',\n 'wandisco.fusion/migrators/targets': 'Targets',\n 'microsoft.security/insights/classification': 'Data Sensitivity Security Insights (Preview)',\n 'microsoft.security/locations/alerts': 'Security Alerts',\n};\n","/**\nThis list is obtained parsing https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported\nTo programatically get the list, execute in the browser console:\n \n const i = [];\n document.querySelectorAll('*[id]').forEach((el) => { \n if(el.textContent.match(/^(microsoft|Microsoft|Wandisco)/)) {\n i.push(el.textContent)\n }});\n i;\n \nNote: Validate that the output makes sense, the format of the page may change.\n */\nexport const supportedMetricNamespaces = [\n 'Microsoft.AAD/DomainServices',\n 'microsoft.aadiam/azureADMetrics',\n 'Microsoft.AnalysisServices/servers',\n 'Microsoft.ApiManagement/service',\n 'Microsoft.App/containerapps',\n 'Microsoft.AppConfiguration/configurationStores',\n 'Microsoft.AppPlatform/Spring',\n 'Microsoft.Automation/automationAccounts',\n 'microsoft.avs/privateClouds',\n 'Microsoft.Batch/batchAccounts',\n 'Microsoft.BatchAI/workspaces',\n 'microsoft.bing/accounts',\n 'Microsoft.Blockchain/blockchainMembers',\n 'microsoft.botservice/botservices',\n 'Microsoft.Cache/redis',\n 'Microsoft.Cache/redisEnterprise',\n 'Microsoft.Cdn/cdnwebapplicationfirewallpolicies',\n 'Microsoft.Cdn/profiles',\n 'Microsoft.ClassicCompute/domainNames/slots/roles',\n 'Microsoft.ClassicCompute/virtualMachines',\n 'Microsoft.ClassicStorage/storageAccounts',\n 'Microsoft.ClassicStorage/storageAccounts/blobServices',\n 'Microsoft.ClassicStorage/storageAccounts/fileServices',\n 'Microsoft.ClassicStorage/storageAccounts/queueServices',\n 'Microsoft.ClassicStorage/storageAccounts/tableServices',\n 'Microsoft.Cloudtest/hostedpools',\n 'Microsoft.Cloudtest/pools',\n 'Microsoft.ClusterStor/nodes',\n 'Microsoft.CognitiveServices/accounts',\n 'Microsoft.Communication/CommunicationServices',\n 'Microsoft.Compute/cloudServices',\n 'Microsoft.Compute/cloudServices/roles',\n 'microsoft.compute/disks',\n 'Microsoft.Compute/virtualMachines',\n 'Microsoft.Compute/virtualMachineScaleSets',\n 'Microsoft.Compute/virtualMachineScaleSets/virtualMachines',\n 'Microsoft.ConnectedCache/CacheNodes',\n 'Microsoft.ConnectedVehicle/platformAccounts',\n 'Microsoft.ContainerInstance/containerGroups',\n 'Microsoft.ContainerRegistry/registries',\n 'Microsoft.ContainerService/managedClusters',\n 'Microsoft.CustomProviders/resourceproviders',\n 'Microsoft.DataBoxEdge/dataBoxEdgeDevices',\n 'Microsoft.DataCollaboration/workspaces',\n 'Microsoft.DataFactory/datafactories',\n 'Microsoft.DataFactory/factories',\n 'Microsoft.DataLakeAnalytics/accounts',\n 'Microsoft.DataLakeStore/accounts',\n 'Microsoft.DataProtection/BackupVaults',\n 'Microsoft.DataShare/accounts',\n 'Microsoft.DBforMariaDB/servers',\n 'Microsoft.DBforMySQL/flexibleServers',\n 'Microsoft.DBforMySQL/servers',\n 'Microsoft.DBforPostgreSQL/flexibleServers',\n 'Microsoft.DBForPostgreSQL/serverGroupsv2',\n 'Microsoft.DBforPostgreSQL/servers',\n 'Microsoft.DBforPostgreSQL/serversv2',\n 'Microsoft.Devices/ElasticPools',\n 'Microsoft.Devices/ElasticPools/IotHubTenants',\n 'Microsoft.Devices/IotHubs',\n 'Microsoft.Devices/provisioningServices',\n 'Microsoft.DigitalTwins/digitalTwinsInstances',\n 'Microsoft.DocumentDB/cassandraClusters',\n 'Microsoft.DocumentDB/DatabaseAccounts',\n 'microsoft.edgezones/edgezones',\n 'Microsoft.EventGrid/domains',\n 'Microsoft.EventGrid/eventSubscriptions',\n 'Microsoft.EventGrid/extensionTopics',\n 'Microsoft.EventGrid/partnerNamespaces',\n 'Microsoft.EventGrid/partnerTopics',\n 'Microsoft.EventGrid/systemTopics',\n 'Microsoft.EventGrid/topics',\n 'Microsoft.EventHub/clusters',\n 'Microsoft.EventHub/Namespaces',\n 'Microsoft.HDInsight/clusters',\n 'Microsoft.HealthcareApis/services',\n 'Microsoft.HealthcareApis/workspaces/fhirservices',\n 'Microsoft.HealthcareApis/workspaces/iotconnectors',\n 'microsoft.hybridnetwork/networkfunctions',\n 'microsoft.hybridnetwork/virtualnetworkfunctions',\n 'microsoft.insights/autoscalesettings',\n 'Microsoft.Insights/Components',\n 'Microsoft.IoTCentral/IoTApps',\n 'microsoft.keyvault/managedhsms',\n 'Microsoft.KeyVault/vaults',\n 'microsoft.kubernetes/connectedClusters',\n 'Microsoft.Kusto/Clusters',\n 'Microsoft.Logic/integrationServiceEnvironments',\n 'Microsoft.Logic/Workflows',\n 'Microsoft.MachineLearningServices/workspaces',\n 'Microsoft.Maps/accounts',\n 'Microsoft.Media/mediaservices',\n 'Microsoft.Media/mediaservices/liveEvents',\n 'Microsoft.Media/mediaservices/streamingEndpoints',\n 'Microsoft.Media/videoanalyzers',\n 'Microsoft.MixedReality/remoteRenderingAccounts',\n 'Microsoft.MixedReality/spatialAnchorsAccounts',\n 'Microsoft.NetApp/netAppAccounts/capacityPools',\n 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes',\n 'Microsoft.Network/applicationgateways',\n 'Microsoft.Network/azureFirewalls',\n 'microsoft.network/bastionHosts',\n 'Microsoft.Network/connections',\n 'Microsoft.Network/dnsForwardingRulesets',\n 'Microsoft.Network/dnsResolvers',\n 'Microsoft.Network/dnszones',\n 'Microsoft.Network/expressRouteCircuits',\n 'Microsoft.Network/expressRouteCircuits/peerings',\n 'Microsoft.Network/expressRouteGateways',\n 'Microsoft.Network/expressRoutePorts',\n 'Microsoft.Network/frontdoors',\n 'Microsoft.Network/loadBalancers',\n 'Microsoft.Network/natGateways',\n 'Microsoft.Network/networkInterfaces',\n 'Microsoft.Network/networkWatchers/connectionMonitors',\n 'microsoft.network/p2svpngateways',\n 'Microsoft.Network/privateDnsZones',\n 'Microsoft.Network/privateEndpoints',\n 'Microsoft.Network/privateLinkServices',\n 'Microsoft.Network/publicIPAddresses',\n 'Microsoft.Network/trafficManagerProfiles',\n 'Microsoft.Network/virtualHubs',\n 'microsoft.network/virtualnetworkgateways',\n 'Microsoft.Network/virtualNetworks',\n 'Microsoft.Network/virtualRouters',\n 'microsoft.network/vpngateways',\n 'Microsoft.NotificationHubs/Namespaces/NotificationHubs',\n 'Microsoft.OperationalInsights/workspaces',\n 'Microsoft.Peering/peerings',\n 'Microsoft.Peering/peeringServices',\n 'Microsoft.PowerBIDedicated/capacities',\n 'microsoft.purview/accounts',\n 'Microsoft.RecoveryServices/Vaults',\n 'Microsoft.Relay/namespaces',\n 'microsoft.resources/subscriptions',\n 'Microsoft.Search/searchServices',\n 'microsoft.securitydetonation/chambers',\n 'Microsoft.ServiceBus/Namespaces',\n 'Microsoft.SignalRService/SignalR',\n 'Microsoft.SignalRService/WebPubSub',\n 'Microsoft.Sql/managedInstances',\n 'Microsoft.Sql/servers/databases',\n 'Microsoft.Sql/servers/elasticPools',\n 'Microsoft.Storage/storageAccounts',\n 'Microsoft.Storage/storageAccounts/blobServices',\n 'Microsoft.Storage/storageAccounts/fileServices',\n 'Microsoft.Storage/storageAccounts/queueServices',\n 'Microsoft.Storage/storageAccounts/tableServices',\n 'Microsoft.StorageCache/caches',\n 'microsoft.storagesync/storageSyncServices',\n 'Microsoft.StreamAnalytics/streamingjobs',\n 'Microsoft.Synapse/workspaces',\n 'Microsoft.Synapse/workspaces/bigDataPools',\n 'Microsoft.Synapse/workspaces/kustoPools',\n 'Microsoft.Synapse/workspaces/sqlPools',\n 'Microsoft.TimeSeriesInsights/environments',\n 'Microsoft.TimeSeriesInsights/environments/eventsources',\n 'Microsoft.VMwareCloudSimple/virtualMachines',\n 'Microsoft.Web/connections',\n 'Microsoft.Web/containerapps',\n 'Microsoft.Web/hostingEnvironments',\n 'Microsoft.Web/hostingEnvironments/multiRolePools',\n 'Microsoft.Web/hostingEnvironments/workerPools',\n 'Microsoft.Web/serverfarms',\n 'Microsoft.Web/sites',\n 'Microsoft.Web/sites/slots',\n 'Microsoft.Web/staticSites',\n 'Wandisco.Fusion/migrators',\n];\n","import { find, startsWith } from 'lodash';\n\nimport { DataSourceInstanceSettings, ScopedVars } from '@grafana/data';\nimport { DataSourceWithBackend, getTemplateSrv, TemplateSrv } from '@grafana/runtime';\nimport { getTimeSrv, TimeSrv } from 'app/features/dashboard/services/TimeSrv';\n\nimport { resourceTypeDisplayNames, supportedMetricNamespaces } from '../azureMetadata';\nimport { getAuthType, getAzureCloud, getAzurePortalUrl } from '../credentials';\nimport TimegrainConverter from '../time_grain_converter';\nimport {\n AzureDataSourceJsonData,\n AzureMonitorMetricDefinitionsResponse,\n AzureMonitorMetricNamespacesResponse,\n AzureMonitorMetricNamesResponse,\n AzureMonitorMetricsMetadataResponse,\n AzureMonitorQuery,\n AzureMonitorResourceGroupsResponse,\n AzureQueryType,\n DatasourceValidationResult,\n GetMetricNamespacesQuery,\n GetMetricNamesQuery,\n GetMetricMetadataQuery,\n} from '../types';\nimport { routeNames } from '../utils/common';\n\nimport ResponseParser from './response_parser';\nimport UrlBuilder from './url_builder';\n\nconst defaultDropdownValue = 'select';\n\nfunction hasValue(item?: string) {\n return !!(item && item !== defaultDropdownValue);\n}\n\nexport default class AzureMonitorDatasource extends DataSourceWithBackend<AzureMonitorQuery, AzureDataSourceJsonData> {\n apiVersion = '2018-01-01';\n apiPreviewVersion = '2017-12-01-preview';\n listByResourceGroupApiVersion = '2021-04-01';\n defaultSubscriptionId?: string;\n resourcePath: string;\n azurePortalUrl: string;\n declare resourceGroup: string;\n declare resourceName: string;\n timeSrv: TimeSrv;\n templateSrv: TemplateSrv;\n\n constructor(private instanceSettings: DataSourceInstanceSettings<AzureDataSourceJsonData>) {\n super(instanceSettings);\n\n this.timeSrv = getTimeSrv();\n this.templateSrv = getTemplateSrv();\n this.defaultSubscriptionId = instanceSettings.jsonData.subscriptionId;\n\n const cloud = getAzureCloud(instanceSettings);\n this.resourcePath = routeNames.azureMonitor;\n this.azurePortalUrl = getAzurePortalUrl(cloud);\n }\n\n isConfigured(): boolean {\n // If validation didn't return any error then the data source is properly configured\n return !this.validateDatasource();\n }\n\n filterQuery(item: AzureMonitorQuery): boolean {\n const hasResourceUri = !!item?.azureMonitor?.resourceUri;\n const hasLegacyQuery =\n hasValue(item?.azureMonitor?.resourceGroup) &&\n hasValue(item?.azureMonitor?.resourceName) &&\n hasValue(item?.azureMonitor?.metricDefinition);\n\n return !!(\n item.hide !== true &&\n (hasResourceUri || hasLegacyQuery) &&\n hasValue(item?.azureMonitor?.metricName) &&\n hasValue(item?.azureMonitor?.aggregation)\n );\n }\n\n applyTemplateVariables(target: AzureMonitorQuery, scopedVars: ScopedVars): AzureMonitorQuery {\n const item = target.azureMonitor;\n\n if (!item) {\n // return target;\n throw new Error('Query is not a valid Azure Monitor Metrics query');\n }\n\n // fix for timeGrainUnit which is a deprecated/removed field name\n if (item.timeGrain && item.timeGrainUnit && item.timeGrain !== 'auto') {\n item.timeGrain = TimegrainConverter.createISO8601Duration(item.timeGrain, item.timeGrainUnit);\n }\n\n const templateSrv = getTemplateSrv();\n\n const resourceUri = templateSrv.replace(item.resourceUri, scopedVars);\n const subscriptionId = templateSrv.replace(target.subscription || this.defaultSubscriptionId, scopedVars);\n const resourceGroup = templateSrv.replace(item.resourceGroup, scopedVars);\n const resourceName = templateSrv.replace(item.resourceName, scopedVars);\n const metricNamespace = templateSrv.replace(item.metricNamespace, scopedVars);\n const metricDefinition = templateSrv.replace(item.metricDefinition, scopedVars);\n const timeGrain = templateSrv.replace((item.timeGrain || '').toString(), scopedVars);\n const aggregation = templateSrv.replace(item.aggregation, scopedVars);\n const top = templateSrv.replace(item.top || '', scopedVars);\n\n const dimensionFilters = (item.dimensionFilters ?? [])\n .filter((f) => f.dimension && f.dimension !== 'None')\n .map((f) => {\n const filters = f.filters?.map((filter) => templateSrv.replace(filter ?? '', scopedVars));\n return {\n dimension: templateSrv.replace(f.dimension, scopedVars),\n operator: f.operator || 'eq',\n filters: filters || [],\n };\n });\n\n return {\n refId: target.refId,\n subscription: subscriptionId,\n queryType: AzureQueryType.AzureMonitor,\n azureMonitor: {\n resourceUri,\n resourceGroup,\n resourceName,\n metricDefinition,\n timeGrain,\n allowedTimeGrainsMs: item.allowedTimeGrainsMs,\n metricName: templateSrv.replace(item.metricName, scopedVars),\n metricNamespace:\n metricNamespace && metricNamespace !== defaultDropdownValue ? metricNamespace : metricDefinition,\n aggregation: aggregation,\n dimensionFilters,\n top: top || '10',\n alias: item.alias,\n },\n };\n }\n\n async getSubscriptions(): Promise<Array<{ text: string; value: string }>> {\n if (!this.isConfigured()) {\n return [];\n }\n\n return this.getResource(`${this.resourcePath}/subscriptions?api-version=2019-03-01`).then((result: any) => {\n return ResponseParser.parseSubscriptions(result);\n });\n }\n\n getResourceGroups(subscriptionId: string) {\n return this.getResource(\n `${this.resourcePath}/subscriptions/${subscriptionId}/resourceGroups?api-version=${this.listByResourceGroupApiVersion}`\n ).then((result: AzureMonitorResourceGroupsResponse) => {\n return ResponseParser.parseResponseValues(result, 'name', 'name');\n });\n }\n\n getMetricDefinitions(subscriptionId: string, resourceGroup: string) {\n return this.getResource(\n `${this.resourcePath}/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/resources?api-version=${this.listByResourceGroupApiVersion}`\n )\n .then((result: AzureMonitorMetricDefinitionsResponse) => {\n return ResponseParser.parseResponseValues(result, 'type', 'type');\n })\n .then((result) =>\n result.filter((t) => {\n for (let i = 0; i < supportedMetricNamespaces.length; i++) {\n if (t.value.toLowerCase() === supportedMetricNamespaces[i].toLowerCase()) {\n return true;\n }\n }\n return false;\n })\n )\n .then((result) => {\n let shouldHardcodeBlobStorage = false;\n for (let i = 0; i < result.length; i++) {\n if (result[i].value === 'Microsoft.Storage/storageAccounts') {\n shouldHardcodeBlobStorage = true;\n break;\n }\n }\n\n if (shouldHardcodeBlobStorage) {\n result.push({\n text: 'Microsoft.Storage/storageAccounts/blobServices',\n value: 'Microsoft.Storage/storageAccounts/blobServices',\n });\n result.push({\n text: 'Microsoft.Storage/storageAccounts/fileServices',\n value: 'Microsoft.Storage/storageAccounts/fileServices',\n });\n result.push({\n text: 'Microsoft.Storage/storageAccounts/tableServices',\n value: 'Microsoft.Storage/storageAccounts/tableServices',\n });\n result.push({\n text: 'Microsoft.Storage/storageAccounts/queueServices',\n value: 'Microsoft.Storage/storageAccounts/queueServices',\n });\n }\n\n return result.map((v) => ({\n value: v.value,\n text: resourceTypeDisplayNames[v.value.toLowerCase()] || v.value,\n }));\n });\n }\n\n getResourceNames(subscriptionId: string, resourceGroup: string, metricDefinition: string, skipToken?: string) {\n const validMetricDefinition = startsWith(metricDefinition, 'Microsoft.Storage/storageAccounts/')\n ? 'Microsoft.Storage/storageAccounts'\n : metricDefinition;\n let url =\n `${this.resourcePath}/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/resources?` +\n `$filter=resourceType eq '${validMetricDefinition}'&` +\n `api-version=${this.listByResourceGroupApiVersion}`;\n if (skipToken) {\n url += `&$skiptoken=${skipToken}`;\n }\n return this.getResource(url).then(async (result: any) => {\n let list: Array<{ text: string; value: string }> = [];\n if (startsWith(metricDefinition, 'Microsoft.Storage/storageAccounts/')) {\n list = ResponseParser.parseResourceNames(result, 'Microsoft.Storage/storageAccounts');\n for (let i = 0; i < list.length; i++) {\n list[i].text += '/default';\n list[i].value += '/default';\n }\n } else {\n list = ResponseParser.parseResourceNames(result, metricDefinition);\n }\n\n if (result.nextLink) {\n // If there is a nextLink, we should request more pages\n const nextURL = new URL(result.nextLink);\n const nextToken = nextURL.searchParams.get('$skiptoken');\n if (!nextToken) {\n throw Error('unable to request the next page of resources');\n }\n const nextPage = await this.getResourceNames(subscriptionId, resourceGroup, metricDefinition, nextToken);\n list = list.concat(nextPage);\n }\n\n return list;\n });\n }\n\n getMetricNamespaces(query: GetMetricNamespacesQuery) {\n const url = UrlBuilder.buildAzureMonitorGetMetricNamespacesUrl(\n this.resourcePath,\n this.apiPreviewVersion,\n this.replaceTemplateVariables(query),\n this.templateSrv\n );\n return this.getResource(url)\n .then((result: AzureMonitorMetricNamespacesResponse) => {\n return ResponseParser.parseResponseValues(result, 'name', 'properties.metricNamespaceName');\n })\n .then((result) => {\n if (url.includes('Microsoft.Storage/storageAccounts')) {\n const storageNamespaces = [\n 'Microsoft.Storage/storageAccounts',\n 'Microsoft.Storage/storageAccounts/blobServices',\n 'Microsoft.Storage/storageAccounts/fileServices',\n 'Microsoft.Storage/storageAccounts/tableServices',\n 'Microsoft.Storage/storageAccounts/queueServices',\n ];\n for (const namespace of storageNamespaces) {\n if (!find(result, ['value', namespace.toLowerCase()])) {\n result.push({ value: namespace, text: namespace });\n }\n }\n }\n return result;\n });\n }\n\n getMetricNames(query: GetMetricNamesQuery) {\n const url = UrlBuilder.buildAzureMonitorGetMetricNamesUrl(\n this.resourcePath,\n this.apiVersion,\n this.replaceTemplateVariables(query),\n this.templateSrv\n );\n return this.getResource(url).then((result: AzureMonitorMetricNamesResponse) => {\n return ResponseParser.parseResponseValues(result, 'name.localizedValue', 'name.value');\n });\n }\n\n getMetricMetadata(query: GetMetricMetadataQuery) {\n const { metricName } = query;\n const url = UrlBuilder.buildAzureMonitorGetMetricNamesUrl(\n this.resourcePath,\n this.apiVersion,\n this.replaceTemplateVariables(query),\n this.templateSrv\n );\n return this.getResource(url).then((result: AzureMonitorMetricsMetadataResponse) => {\n return ResponseParser.parseMetadata(result, metricName);\n });\n }\n\n async testDatasource(): Promise<DatasourceValidationResult> {\n const validationError = this.validateDatasource();\n if (validationError) {\n return Promise.resolve(validationError);\n }\n\n try {\n const url = `${this.resourcePath}/subscriptions?api-version=2019-03-01`;\n\n return await this.getResource(url).then<DatasourceValidationResult>((response: any) => {\n return {\n status: 'success',\n message: 'Successfully queried the Azure Monitor service.',\n title: 'Success',\n };\n });\n } catch (e) {\n let message = 'Azure Monitor: ';\n message += e.statusText ? e.statusText + ': ' : '';\n\n if (e.data && e.data.error && e.data.error.code) {\n message += e.data.error.code + '. ' + e.data.error.message;\n } else if (e.data && e.data.error) {\n message += e.data.error;\n } else if (e.data) {\n message += e.data;\n } else {\n message += 'Cannot connect to Azure Monitor REST API.';\n }\n return {\n status: 'error',\n message: message,\n };\n }\n }\n\n private validateDatasource(): DatasourceValidationResult | undefined {\n const authType = getAuthType(this.instanceSettings);\n\n if (authType === 'clientsecret') {\n if (!this.isValidConfigField(this.instanceSettings.jsonData.tenantId)) {\n return {\n status: 'error',\n message: 'The Tenant Id field is required.',\n };\n }\n\n if (!this.isValidConfigField(this.instanceSettings.jsonData.clientId)) {\n return {\n status: 'error',\n message: 'The Client Id field is required.',\n };\n }\n }\n\n return undefined;\n }\n\n private isValidConfigField(field?: string): boolean {\n return typeof field === 'string' && field.length > 0;\n }\n\n private replaceTemplateVariables<T extends { [K in keyof T]: string }>(query: T) {\n const templateSrv = getTemplateSrv();\n\n const workingQuery: { [K in keyof T]: string } = { ...query };\n const keys = Object.keys(query) as Array<keyof T>;\n keys.forEach((key) => {\n workingQuery[key] = templateSrv.replace(workingQuery[key]);\n });\n\n return workingQuery;\n }\n}\n","// eslint-disable-next-line lodash/import-scope\nimport _ from 'lodash';\n\nimport { ScopedVars } from '@grafana/data';\nimport { getTemplateSrv, DataSourceWithBackend } from '@grafana/runtime';\n\nimport { AzureMonitorQuery, AzureDataSourceJsonData, AzureQueryType } from '../types';\nimport { interpolateVariable } from '../utils/common';\n\nexport default class AzureResourceGraphDatasource extends DataSourceWithBackend<\n AzureMonitorQuery,\n AzureDataSourceJsonData\n> {\n filterQuery(item: AzureMonitorQuery): boolean {\n return !!item.azureResourceGraph?.query;\n }\n\n applyTemplateVariables(target: AzureMonitorQuery, scopedVars: ScopedVars): AzureMonitorQuery {\n const item = target.azureResourceGraph;\n if (!item) {\n return target;\n }\n\n const templateSrv = getTemplateSrv();\n const variableNames = templateSrv.getVariables().map((v) => `$${v.name}`);\n const subscriptionVar = _.find(target.subscriptions, (sub) => _.includes(variableNames, sub));\n const interpolatedSubscriptions = templateSrv\n .replace(subscriptionVar, scopedVars, (v: any) => v)\n .split(',')\n .filter((v) => v.length > 0);\n const subscriptions = [\n ...interpolatedSubscriptions,\n ..._.filter(target.subscriptions, (sub) => !_.includes(variableNames, sub)),\n ];\n const query = templateSrv.replace(item.query, scopedVars, interpolateVariable);\n\n return {\n refId: target.refId,\n queryType: AzureQueryType.AzureResourceGraph,\n subscriptions,\n azureResourceGraph: {\n resultFormat: 'table',\n query,\n },\n };\n }\n}\n","import { DataSourceWithBackend } from '@grafana/runtime';\n\nimport { DataSourceInstanceSettings } from '../../../../../../packages/grafana-data/src';\nimport {\n locationDisplayNames,\n logsSupportedLocationsKusto,\n logsResourceTypes,\n resourceTypeDisplayNames,\n supportedMetricNamespaces,\n} from '../azureMetadata';\nimport { ResourceRow, ResourceRowGroup, ResourceRowType } from '../components/ResourcePicker/types';\nimport { addResources, parseResourceURI } from '../components/ResourcePicker/utils';\nimport {\n AzureDataSourceJsonData,\n AzureGraphResponse,\n AzureMonitorQuery,\n AzureResourceGraphOptions,\n AzureResourceSummaryItem,\n RawAzureResourceGroupItem,\n RawAzureResourceItem,\n RawAzureSubscriptionItem,\n} from '../types';\nimport { routeNames } from '../utils/common';\n\nconst RESOURCE_GRAPH_URL = '/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01';\n\nconst logsSupportedResourceTypesKusto = logsResourceTypes.map((v) => `\"${v}\"`).join(',');\nconst supportedMetricNamespacesKusto = supportedMetricNamespaces.map((v) => `\"${v.toLocaleLowerCase()}\"`).join(',');\n\nexport type ResourcePickerQueryType = 'logs' | 'metrics';\n\nexport default class ResourcePickerData extends DataSourceWithBackend<AzureMonitorQuery, AzureDataSourceJsonData> {\n private resourcePath: string;\n resultLimit = 200;\n\n constructor(instanceSettings: DataSourceInstanceSettings<AzureDataSourceJsonData>) {\n super(instanceSettings);\n this.resourcePath = `${routeNames.resourceGraph}`;\n }\n\n async fetchInitialRows(type: ResourcePickerQueryType, currentSelection?: string): Promise<ResourceRowGroup> {\n const subscriptions = await this.getSubscriptions();\n if (!currentSelection) {\n return subscriptions;\n }\n\n let resources = subscriptions;\n const parsedURI = parseResourceURI(currentSelection);\n if (parsedURI) {\n const resourceGroupURI = `/subscriptions/${parsedURI.subscriptionID}/resourceGroups/${parsedURI.resourceGroup}`;\n\n if (parsedURI.resourceGroup) {\n const resourceGroups = await this.getResourceGroupsBySubscriptionId(parsedURI.subscriptionID, type);\n resources = addResources(resources, `/subscriptions/${parsedURI.subscriptionID}`, resourceGroups);\n }\n\n if (parsedURI.resource) {\n const resourcesForResourceGroup = await this.getResourcesForResourceGroup(resourceGroupURI, type);\n resources = addResources(resources, resourceGroupURI, resourcesForResourceGroup);\n }\n }\n return resources;\n }\n\n async fetchAndAppendNestedRow(\n rows: ResourceRowGroup,\n parentRow: ResourceRow,\n type: ResourcePickerQueryType\n ): Promise<ResourceRowGroup> {\n const nestedRows =\n parentRow.type === ResourceRowType.Subscription\n ? await this.getResourceGroupsBySubscriptionId(parentRow.id, type)\n : await this.getResourcesForResourceGroup(parentRow.id, type);\n\n return addResources(rows, parentRow.uri, nestedRows);\n }\n\n search = async (searchPhrase: string, searchType: ResourcePickerQueryType): Promise<ResourceRowGroup> => {\n let searchQuery = 'resources';\n if (searchType === 'logs') {\n searchQuery += `\n | union resourcecontainers`;\n }\n searchQuery += `\n | where id contains \"${searchPhrase}\"\n ${this.filterByType(searchType)}\n | order by tolower(name) asc\n | limit ${this.resultLimit}\n `;\n const { data: response } = await this.makeResourceGraphRequest<RawAzureResourceItem[]>(searchQuery);\n return response.map((item) => {\n const parsedUri = parseResourceURI(item.id);\n if (!parsedUri || !(parsedUri.resource || parsedUri.resourceGroup || parsedUri.subscriptionID)) {\n throw new Error('unable to fetch resource details');\n }\n let id = parsedUri.subscriptionID;\n let type = ResourceRowType.Subscription;\n if (parsedUri.resource) {\n id = parsedUri.resource;\n type = ResourceRowType.Resource;\n } else if (parsedUri.resourceGroup) {\n id = parsedUri.resourceGroup;\n type = ResourceRowType.ResourceGroup;\n }\n return {\n name: item.name,\n id,\n uri: item.id,\n resourceGroupName: item.resourceGroup,\n type,\n typeLabel: resourceTypeDisplayNames[item.type] || item.type,\n location: locationDisplayNames[item.location] || item.location,\n };\n });\n };\n\n // private\n async getSubscriptions(): Promise<ResourceRowGroup> {\n const query = `\n resources\n | join kind=inner (\n ResourceContainers\n | where type == 'microsoft.resources/subscriptions'\n | project subscriptionName=name, subscriptionURI=id, subscriptionId\n ) on subscriptionId\n | summarize count() by subscriptionName, subscriptionURI, subscriptionId\n | order by subscriptionName desc\n `;\n\n let resources: RawAzureSubscriptionItem[] = [];\n\n let allFetched = false;\n let $skipToken = undefined;\n while (!allFetched) {\n // The response may include several pages\n let options: Partial<AzureResourceGraphOptions> = {};\n if ($skipToken) {\n options = {\n $skipToken,\n };\n }\n const resourceResponse = await this.makeResourceGraphRequest<RawAzureSubscriptionItem[]>(query, 1, options);\n if (!resourceResponse.data.length) {\n throw new Error('No subscriptions were found');\n }\n resources = resources.concat(resourceResponse.data);\n $skipToken = resourceResponse.$skipToken;\n allFetched = !$skipToken;\n }\n\n return resources.map((subscription) => ({\n name: subscription.subscriptionName,\n id: subscription.subscriptionId,\n uri: `/subscriptions/${subscription.subscriptionId}`,\n typeLabel: 'Subscription',\n type: ResourceRowType.Subscription,\n children: [],\n }));\n }\n\n async getResourceGroupsBySubscriptionId(\n subscriptionId: string,\n type: ResourcePickerQueryType\n ): Promise<ResourceRowGroup> {\n const query = `\n resources\n | join kind=inner (\n ResourceContainers\n | where type == 'microsoft.resources/subscriptions/resourcegroups'\n | project resourceGroupURI=id, resourceGroupName=name, resourceGroup, subscriptionId\n ) on resourceGroup, subscriptionId\n\n ${this.filterByType(type)}\n | where subscriptionId == '${subscriptionId}'\n | summarize count() by resourceGroupName, resourceGroupURI\n | order by resourceGroupURI asc`;\n\n let resourceGroups: RawAzureResourceGroupItem[] = [];\n let allFetched = false;\n let $skipToken = undefined;\n while (!allFetched) {\n // The response may include several pages\n let options: Partial<AzureResourceGraphOptions> = {};\n if ($skipToken) {\n options = {\n $skipToken,\n };\n }\n const resourceResponse = await this.makeResourceGraphRequest<RawAzureResourceGroupItem[]>(query, 1, options);\n resourceGroups = resourceGroups.concat(resourceResponse.data);\n $skipToken = resourceResponse.$skipToken;\n allFetched = !$skipToken;\n }\n\n return resourceGroups.map((r) => {\n const parsedUri = parseResourceURI(r.resourceGroupURI);\n if (!parsedUri || !parsedUri.resourceGroup) {\n throw new Error('unable to fetch resource groups');\n }\n return {\n name: r.resourceGroupName,\n uri: r.resourceGroupURI,\n id: parsedUri.resourceGroup,\n type: ResourceRowType.ResourceGroup,\n typeLabel: 'Resource Group',\n children: [],\n };\n });\n }\n\n async getResourcesForResourceGroup(\n resourceGroupId: string,\n type: ResourcePickerQueryType\n ): Promise<ResourceRowGroup> {\n const { data: response } = await this.makeResourceGraphRequest<RawAzureResourceItem[]>(`\n resources\n | where id hasprefix \"${resourceGroupId}\"\n ${this.filterByType(type)} and location in (${logsSupportedLocationsKusto})\n `);\n\n return response.map((item) => {\n const parsedUri = parseResourceURI(item.id);\n if (!parsedUri || !parsedUri.resource) {\n throw new Error('unable to fetch resource details');\n }\n return {\n name: item.name,\n id: parsedUri.resource,\n uri: item.id,\n resourceGroupName: item.resourceGroup,\n type: ResourceRowType.Resource,\n typeLabel: resourceTypeDisplayNames[item.type] || item.type,\n location: locationDisplayNames[item.location] || item.location,\n };\n });\n }\n\n // used to make the select resource button that launches the resource picker show a nicer file path to users\n async getResourceURIDisplayProperties(resourceURI: string): Promise<AzureResourceSummaryItem> {\n const { subscriptionID, resourceGroup, resource } = parseResourceURI(resourceURI) ?? {};\n\n if (!subscriptionID) {\n throw new Error('Invalid resource URI passed');\n }\n\n // resourceGroupURI and resourceURI could be invalid values, but that's okay because the join\n // will just silently fail as expected\n const subscriptionURI = `/subscriptions/${subscriptionID}`;\n const resourceGroupURI = `${subscriptionURI}/resourceGroups/${resourceGroup}`;\n\n const query = `\n resourcecontainers\n | where type == \"microsoft.resources/subscriptions\"\n | where id =~ \"${subscriptionURI}\"\n | project subscriptionName=name, subscriptionId\n\n | join kind=leftouter (\n resourcecontainers \n | where type == \"microsoft.resources/subscriptions/resourcegroups\"\n | where id =~ \"${resourceGroupURI}\"\n | project resourceGroupName=name, resourceGroup, subscriptionId\n ) on subscriptionId\n\n | join kind=leftouter (\n resources\n | where id =~ \"${resourceURI}\"\n | project resourceName=name, subscriptionId\n ) on subscriptionId\n\n | project subscriptionName, resourceGroupName, resourceName\n `;\n\n const { data: response } = await this.makeResourceGraphRequest<AzureResourceSummaryItem[]>(query);\n\n if (!response.length) {\n throw new Error('unable to fetch resource details');\n }\n\n const { subscriptionName, resourceGroupName, resourceName } = response[0];\n // if the name is undefined it could be because the id is undefined or because we are using a template variable.\n // Either way we can use it as a fallback. We don't really want to interpolate these variables because we want\n // to show the user when they are using template variables `$sub/$rg/$resource`\n return {\n subscriptionName: subscriptionName || subscriptionID,\n resourceGroupName: resourceGroupName || resourceGroup,\n resourceName: resourceName || resource,\n };\n }\n\n async getResourceURIFromWorkspace(workspace: string) {\n const { data: response } = await this.makeResourceGraphRequest<RawAzureResourceItem[]>(`\n resources\n | where properties['customerId'] == \"${workspace}\"\n | project id\n `);\n\n if (!response.length) {\n throw new Error('unable to find resource for workspace ' + workspace);\n }\n\n return response[0].id;\n }\n\n async makeResourceGraphRequest<T = unknown>(\n query: string,\n maxRetries = 1,\n reqOptions?: Partial<AzureResourceGraphOptions>\n ): Promise<AzureGraphResponse<T>> {\n try {\n return await this.postResource(this.resourcePath + RESOURCE_GRAPH_URL, {\n query: query,\n options: {\n resultFormat: 'objectArray',\n ...reqOptions,\n },\n });\n } catch (error) {\n if (maxRetries > 0) {\n return this.makeResourceGraphRequest(query, maxRetries - 1);\n }\n\n throw error;\n }\n }\n\n private filterByType = (t: ResourcePickerQueryType) => {\n return t === 'logs'\n ? `| where type in (${logsSupportedResourceTypesKusto})`\n : `| where type in (${supportedMetricNamespacesKusto})`;\n };\n}\n","/**\nThis list is obtained parsing https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/resource-logs-categories\nTo programatically get the list, execute in the browser console:\n \n const i = [];\n document.querySelectorAll('*[id]').forEach((el) => { \n if(el.textContent.match(/^(microsoft|Microsoft|Wandisco)/)) {\n i.push(el.textContent.toLowerCase())\n }});\n i;\n \nNote: Validate that the output makes sense, the format of the page may change.\n \nThat list is not complete so we should merge it with the one below. You can do with a node console:\n \n const u = require('lodash')\n const new = [list from above]\n const logsResourceTypes = [this list]\n console.dir(u.uniq(logsResourceTypes.concat(new)).sort(), {'maxArrayLength': null})\n \n */\n\nexport const logsResourceTypes = [\n 'microsoft.aad/domainservices',\n 'microsoft.aadiam/azureadmetrics',\n 'microsoft.aadiam/tenants',\n 'microsoft.agfoodplatform/farmbeats',\n 'microsoft.analysisservices/servers',\n 'microsoft.apimanagement/service',\n 'microsoft.appconfiguration/configurationstores',\n 'microsoft.appplatform/spring',\n 'microsoft.attestation/attestationproviders',\n 'microsoft.automation/automationaccounts',\n 'microsoft.autonomousdevelopmentplatform/accounts',\n 'microsoft.autonomousdevelopmentplatform/datapools',\n 'microsoft.autonomousdevelopmentplatform/workspaces',\n 'microsoft.avs/privateclouds',\n 'microsoft.azurestackresourcemonitor/storageaccountmonitor',\n 'microsoft.batch/batchaccounts',\n 'microsoft.batchai/workspaces',\n 'microsoft.blockchain/blockchainmembers',\n 'microsoft.blockchain/cordamembers',\n 'microsoft.botservice/botservices',\n 'microsoft.cache/redis',\n 'microsoft.cache/redisenterprise',\n 'microsoft.cdn/cdnwebapplicationfirewallpolicies',\n 'microsoft.cdn/profiles',\n 'microsoft.cdn/profiles/endpoints',\n 'microsoft.classiccompute/domainnames',\n 'microsoft.classiccompute/virtualmachines',\n 'microsoft.classicnetwork/networksecuritygroups',\n 'microsoft.classicstorage/storageaccounts',\n 'microsoft.cognitiveservices/accounts',\n 'microsoft.communication/communicationservices',\n 'microsoft.compute/disks',\n 'microsoft.compute/virtualmachines',\n 'microsoft.compute/virtualmachinescalesets',\n 'microsoft.connectedcache/cachenodes',\n 'microsoft.connectedvehicle/platformaccounts',\n 'microsoft.containerinstance/containergroups',\n 'microsoft.containerregistry/registries',\n 'microsoft.containerservice/managedclusters',\n 'microsoft.customerinsights/hubs',\n 'microsoft.customproviders/resourceproviders',\n 'microsoft.d365customerinsights/instances',\n 'microsoft.dashboard/grafana',\n 'microsoft.databoxedge/databoxedgedevices',\n 'microsoft.databricks/workspaces',\n 'microsoft.datacollaboration/workspaces',\n 'microsoft.datafactory/datafactories',\n 'microsoft.datafactory/factories',\n 'microsoft.datalakeanalytics/accounts',\n 'microsoft.datalakestore/accounts',\n 'microsoft.datashare/accounts',\n 'microsoft.dbformariadb/servers',\n 'microsoft.dbformysql/flexibleservers',\n 'microsoft.dbformysql/servers',\n 'microsoft.dbforpostgresql/flexibleservers',\n 'microsoft.dbforpostgresql/servergroupsv2',\n 'microsoft.dbforpostgresql/servers',\n 'microsoft.dbforpostgresql/serversv2',\n 'microsoft.desktopvirtualization/applicationgroups',\n 'microsoft.desktopvirtualization/hostpools',\n 'microsoft.desktopvirtualization/scalingplans',\n 'microsoft.desktopvirtualization/workspaces',\n 'microsoft.devices/elasticpools/iothubtenants',\n 'microsoft.devices/iothubs',\n 'microsoft.devices/provisioningservices',\n 'microsoft.digitaltwins/digitaltwinsinstances',\n 'microsoft.documentdb/cassandraclusters',\n 'microsoft.documentdb/databaseaccounts',\n 'microsoft.eventgrid/domains',\n 'microsoft.eventgrid/partnernamespaces',\n 'microsoft.eventgrid/partnertopics',\n 'microsoft.eventgrid/systemtopics',\n 'microsoft.eventgrid/topics',\n 'microsoft.eventhub/clusters',\n 'microsoft.eventhub/namespaces',\n 'microsoft.experimentation/experimentworkspaces',\n 'microsoft.fabric.admin/fabriclocations',\n 'microsoft.hdinsight/clusters',\n 'microsoft.healthcareapis/services',\n 'microsoft.healthcareapis/workspaces/dicomservices',\n 'microsoft.healthcareapis/workspaces/fhirservices',\n 'microsoft.insights/autoscalesettings',\n 'microsoft.insights/components',\n 'microsoft.insights/qos',\n 'microsoft.iotcentral/iotapps',\n 'microsoft.keyvault/managedhsms',\n 'microsoft.keyvault/vaults',\n 'microsoft.kubernetes/connectedclusters',\n 'microsoft.kusto/clusters',\n 'microsoft.loadtestservice/loadtests',\n 'microsoft.logic/integrationaccounts',\n 'microsoft.logic/integrationserviceenvironments',\n 'microsoft.logic/workflows',\n 'microsoft.machinelearningservices/workspaces',\n 'microsoft.media/mediaservices',\n 'microsoft.media/mediaservices/liveevents',\n 'microsoft.media/mediaservices/streamingendpoints',\n 'microsoft.media/videoanalyzers',\n 'microsoft.netapp/netappaccounts/capacitypools',\n 'microsoft.netapp/netappaccounts/capacitypools/volumes',\n 'microsoft.network/applicationgateways',\n 'microsoft.network/azurefirewalls',\n 'microsoft.network/bastionhosts',\n 'microsoft.network/connections',\n 'microsoft.network/dnszones',\n 'microsoft.network/expressroutecircuits',\n 'microsoft.network/expressroutegateways',\n 'microsoft.network/expressrouteports',\n 'microsoft.network/frontdoors',\n 'microsoft.network/loadbalancers',\n 'microsoft.network/natgateways',\n 'microsoft.network/networkinterfaces',\n 'microsoft.network/networksecuritygroups',\n 'microsoft.network/networksecurityperimeters',\n 'microsoft.network/networkvirtualappliances',\n 'microsoft.network/networkwatchers',\n 'microsoft.network/networkwatchers/connectionmonitors',\n 'microsoft.network/p2svpngateways',\n 'microsoft.network/privateendpoints',\n 'microsoft.network/privatelinkservices',\n 'microsoft.network/publicipaddresses',\n 'microsoft.network/trafficmanagerprofiles',\n 'microsoft.network/virtualnetworkgateways',\n 'microsoft.network/virtualnetworks',\n 'microsoft.network/vpngateways',\n 'microsoft.networkfunction/azuretrafficcollectors',\n 'microsoft.notificationhubs/namespaces',\n 'microsoft.notificationhubs/namespaces/notificationhubs',\n 'microsoft.openlogisticsplatform/workspaces',\n 'microsoft.operationalinsights/workspaces',\n 'microsoft.operationsmanagement/solutions',\n 'microsoft.peering/peeringservices',\n 'microsoft.powerbi/tenants',\n 'microsoft.powerbi/tenants/workspaces',\n 'microsoft.powerbidedicated/capacities',\n 'microsoft.purview/accounts',\n 'microsoft.recoveryservices/vaults',\n 'microsoft.relay/namespaces',\n 'microsoft.resources/subscriptions',\n 'microsoft.resources/subscriptions/resourcegroups',\n 'microsoft.search/searchservices',\n 'microsoft.security/antimalwaresettings',\n 'microsoft.securityinsights/settings',\n 'microsoft.servicebus/namespaces',\n 'microsoft.signalrservice/signalr',\n 'microsoft.signalrservice/webpubsub',\n 'microsoft.singularity/accounts',\n 'microsoft.sql/managedinstances',\n 'microsoft.sql/managedinstances/databases',\n 'microsoft.sql/servers/databases',\n 'microsoft.sql/servers/elasticpools',\n 'microsoft.storage/storageaccounts',\n 'microsoft.storage/storageaccounts/blobservices',\n 'microsoft.storage/storageaccounts/fileservices',\n 'microsoft.storage/storageaccounts/queueservices',\n 'microsoft.storage/storageaccounts/tableservices',\n 'microsoft.storagecache/caches',\n 'microsoft.storagesync/storagesyncservices',\n 'microsoft.streamanalytics/streamingjobs',\n 'microsoft.synapse/workspaces',\n 'microsoft.synapse/workspaces/bigdatapools',\n 'microsoft.synapse/workspaces/kustopools',\n 'microsoft.synapse/workspaces/scopepools',\n 'microsoft.synapse/workspaces/sqlpools',\n 'microsoft.timeseriesinsights/environments',\n 'microsoft.timeseriesinsights/environments/eventsources',\n 'microsoft.videoindexer/accounts',\n 'microsoft.vmwarecloudsimple/virtualmachines',\n 'microsoft.web/hostingenvironments',\n 'microsoft.web/hostingenvironments/workerpools',\n 'microsoft.web/serverfarms',\n 'microsoft.web/sites',\n 'microsoft.web/sites/slots',\n];\n","import { AnnotationQuery } from '@grafana/data';\n\nimport { AzureMonitorQuery, AzureQueryType } from '../types';\n\n// The old Angular annotations editor put some properties (rawQuery, workspace, subscription)\n// on the root annotation object, rather than down in the 'targets' query value\n// This migration moves them to a Log Analytics query compatible with the React query editor\n// The old Angular annotations editor did not support any other query types.\nexport default function migrateAnnotation(annotation: AnnotationQuery<AzureMonitorQuery>) {\n const oldQuery = typeof annotation.rawQuery === 'string' ? annotation.rawQuery : null;\n const oldWorkspace = typeof annotation.workspace === 'string' ? annotation.workspace : null;\n\n if (!(oldQuery && oldWorkspace && !annotation.target?.azureLogAnalytics?.query)) {\n return annotation;\n }\n\n const newQuery: AzureMonitorQuery = {\n ...(annotation.target ?? {}),\n refId: annotation.target?.refId ?? 'Anno',\n queryType: AzureQueryType.LogAnalytics,\n azureLogAnalytics: {\n query: oldQuery,\n resource: oldWorkspace,\n },\n };\n\n return {\n ...annotation,\n rawQuery: undefined,\n workspace: undefined,\n subscription: undefined,\n queryType: undefined,\n target: newQuery,\n };\n}\n","import { isGUIDish } from './components/ResourcePicker/utils';\nimport DataSource from './datasource';\nimport { AzureMonitorQuery, AzureQueryType } from './types';\nimport {\n AppInsightsGroupByQuery,\n AppInsightsMetricNameQuery,\n GrafanaTemplateVariableQuery,\n MetricDefinitionsQuery,\n MetricNamespaceQuery,\n MetricNamesQuery,\n ResourceGroupsQuery,\n ResourceNamesQuery,\n SubscriptionsQuery,\n WorkspacesQuery,\n} from './types/templateVariables';\n\n/* \n Grafana Template Variable Functions\n ex: Subscriptions()\n\n These are helper functions we have created and exposed to users to make the writing of template variables easier. \n Due to legacy reasons, we still need to parse strings to determine if a query is a Grafana Template Variable Function \n or if it's a KQL-type query\n*/\n\nexport const grafanaTemplateVariableFnMatches = (query: string) => {\n return {\n subscriptions: query.match(/^Subscriptions\\(\\)/i),\n resourceGroups: query.match(/^ResourceGroups\\(\\)/i),\n resourceGroupsWithSub: query.match(/^ResourceGroups\\(([^\\)]+?)(,\\s?([^,]+?))?\\)/i),\n metricDefinitions: query.match(/^Namespaces\\(([^\\)]+?)(,\\s?([^,]+?))?\\)/i),\n metricDefinitionsWithSub: query.match(/^Namespaces\\(([^,]+?),\\s?([^,]+?)\\)/i),\n resourceNames: query.match(/^ResourceNames\\(([^,]+?),\\s?([^,]+?)\\)/i),\n resourceNamesWithSub: query.match(/^ResourceNames\\(([^,]+?),\\s?([^,]+?),\\s?(.+?)\\)/i),\n metricNamespace: query.match(/^MetricNamespace\\(([^,]+?),\\s?([^,]+?),\\s?([^,]+?)\\)/i),\n metricNamespaceWithSub: query.match(/^metricnamespace\\(([^,]+?),\\s?([^,]+?),\\s?([^,]+?),\\s?([^,]+?)\\)/i),\n metricNames: query.match(/^MetricNames\\(([^,]+?),\\s?([^,]+?),\\s?([^,]+?),\\s?([^,]+?)\\)/i),\n metricNamesWithSub: query.match(/^MetricNames\\(([^,]+?),\\s?([^,]+?),\\s?([^,]+?),\\s?([^,]+?),\\s?(.+?)\\)/i),\n appInsightsMetricNameQuery: query.match(/^AppInsightsMetricNames\\(\\)/i),\n appInsightsGroupByQuery: query.match(/^AppInsightsGroupBys\\(([^\\)]+?)(,\\s?([^,]+?))?\\)/i),\n workspacesQuery: query.match(/^workspaces\\(\\)/i),\n workspacesQueryWithSub: query.match(/^workspaces\\([\"']?([^\\)]+?)[\"']?\\)/i),\n };\n};\n\nconst isGrafanaTemplateVariableFnQuery = (query: string) => {\n const matches: Record<string, RegExpMatchArray | null> = grafanaTemplateVariableFnMatches(query);\n return Object.keys(matches).some((key) => !!matches[key]);\n};\n\nconst createGrafanaTemplateVariableQuery = (rawQuery: string, datasource: DataSource): AzureMonitorQuery => {\n const matchesForQuery = grafanaTemplateVariableFnMatches(rawQuery);\n const defaultSubscriptionId = datasource.azureMonitorDatasource.defaultSubscriptionId;\n const createGrafanaTemplateVariableDetails = (): GrafanaTemplateVariableQuery => {\n // deprecated app insights template variables (will most likely remove in grafana 9)\n if (matchesForQuery.appInsightsMetricNameQuery) {\n const queryDetails: AppInsightsMetricNameQuery = { rawQuery, kind: 'AppInsightsMetricNameQuery' };\n return queryDetails;\n }\n\n if (matchesForQuery.appInsightsGroupByQuery) {\n const queryDetails: AppInsightsGroupByQuery = {\n kind: 'AppInsightsGroupByQuery',\n rawQuery,\n metricName: matchesForQuery.appInsightsGroupByQuery[1],\n };\n return queryDetails;\n }\n\n if (matchesForQuery.subscriptions) {\n const queryDetails: SubscriptionsQuery = {\n kind: 'SubscriptionsQuery',\n rawQuery,\n };\n return queryDetails;\n }\n\n if (matchesForQuery.resourceGroupsWithSub) {\n const queryDetails: ResourceGroupsQuery = {\n kind: 'ResourceGroupsQuery',\n rawQuery,\n subscription: matchesForQuery.resourceGroupsWithSub[1],\n };\n return queryDetails;\n }\n\n if (matchesForQuery.resourceGroups && defaultSubscriptionId) {\n const queryDetails: ResourceGroupsQuery = {\n kind: 'ResourceGroupsQuery',\n rawQuery,\n subscription: defaultSubscriptionId,\n };\n return queryDetails;\n }\n\n if (matchesForQuery.metricDefinitionsWithSub) {\n const queryDetails: MetricDefinitionsQuery = {\n kind: 'MetricDefinitionsQuery',\n rawQuery,\n subscription: matchesForQuery.metricDefinitionsWithSub[1],\n resourceGroup: matchesForQuery.metricDefinitionsWithSub[2],\n };\n return queryDetails;\n }\n\n if (matchesForQuery.metricDefinitions && defaultSubscriptionId) {\n const queryDetails: MetricDefinitionsQuery = {\n kind: 'MetricDefinitionsQuery',\n rawQuery,\n subscription: defaultSubscriptionId,\n resourceGroup: matchesForQuery.metricDefinitions[1],\n };\n return queryDetails;\n }\n\n if (matchesForQuery.resourceNamesWithSub) {\n const queryDetails: ResourceNamesQuery = {\n kind: 'ResourceNamesQuery',\n rawQuery,\n subscription: matchesForQuery.resourceNamesWithSub[1],\n resourceGroup: matchesForQuery.resourceNamesWithSub[2],\n metricDefinition: matchesForQuery.resourceNamesWithSub[3],\n };\n return queryDetails;\n }\n\n if (matchesForQuery.resourceNames && defaultSubscriptionId) {\n const queryDetails: ResourceNamesQuery = {\n kind: 'ResourceNamesQuery',\n rawQuery,\n subscription: defaultSubscriptionId,\n resourceGroup: matchesForQuery.resourceNames[1],\n metricDefinition: matchesForQuery.resourceNames[2],\n };\n return queryDetails;\n }\n\n if (matchesForQuery.metricNamespaceWithSub) {\n const queryDetails: MetricNamespaceQuery = {\n kind: 'MetricNamespaceQuery',\n rawQuery,\n subscription: matchesForQuery.metricNamespaceWithSub[1],\n resourceGroup: matchesForQuery.metricNamespaceWithSub[2],\n metricDefinition: matchesForQuery.metricNamespaceWithSub[3],\n resourceName: matchesForQuery.metricNamespaceWithSub[4],\n };\n return queryDetails;\n }\n\n if (matchesForQuery.metricNamespace && defaultSubscriptionId) {\n const queryDetails: MetricNamespaceQuery = {\n kind: 'MetricNamespaceQuery',\n rawQuery,\n subscription: defaultSubscriptionId,\n resourceGroup: matchesForQuery.metricNamespace[1],\n metricDefinition: matchesForQuery.metricNamespace[2],\n resourceName: matchesForQuery.metricNamespace[3],\n };\n return queryDetails;\n }\n\n if (matchesForQuery.metricNames && defaultSubscriptionId) {\n if (matchesForQuery.metricNames[3].indexOf(',') === -1) {\n const queryDetails: MetricNamesQuery = {\n kind: 'MetricNamesQuery',\n rawQuery,\n subscription: defaultSubscriptionId,\n resourceGroup: matchesForQuery.metricNames[1],\n metricDefinition: matchesForQuery.metricNames[2],\n resourceName: matchesForQuery.metricNames[3],\n metricNamespace: matchesForQuery.metricNames[4],\n };\n return queryDetails;\n }\n }\n\n if (matchesForQuery.metricNamesWithSub) {\n const queryDetails: MetricNamesQuery = {\n kind: 'MetricNamesQuery',\n rawQuery,\n subscription: matchesForQuery.metricNamesWithSub[1],\n resourceGroup: matchesForQuery.metricNamesWithSub[2],\n metricDefinition: matchesForQuery.metricNamesWithSub[3],\n resourceName: matchesForQuery.metricNamesWithSub[4],\n metricNamespace: matchesForQuery.metricNamesWithSub[5],\n };\n return queryDetails;\n }\n\n if (matchesForQuery.workspacesQueryWithSub) {\n const queryDetails: WorkspacesQuery = {\n kind: 'WorkspacesQuery',\n rawQuery,\n subscription: (matchesForQuery.workspacesQueryWithSub[1] || '').trim(),\n };\n return queryDetails;\n }\n\n if (matchesForQuery.workspacesQuery && defaultSubscriptionId) {\n const queryDetails: WorkspacesQuery = {\n kind: 'WorkspacesQuery',\n rawQuery,\n subscription: defaultSubscriptionId,\n };\n return queryDetails;\n }\n\n // fallback\n const queryDetails: SubscriptionsQuery = { kind: 'SubscriptionsQuery', rawQuery };\n return queryDetails;\n };\n\n const query: AzureMonitorQuery = {\n refId: 'A',\n queryType: AzureQueryType.GrafanaTemplateVariableFn,\n grafanaTemplateVariableFn: createGrafanaTemplateVariableDetails(),\n subscription: defaultSubscriptionId,\n };\n return query;\n};\n\nconst createLogAnalyticsTemplateVariableQuery = async (\n rawQuery: string,\n datasource: DataSource\n): Promise<AzureMonitorQuery> => {\n const defaultSubscriptionId = datasource.azureMonitorDatasource.defaultSubscriptionId;\n let resource = '';\n // if there's an existing query, we try to get the resourcesuri from a deprecated default workspace\n // a note this is very similar logic to what is used in useMigrations but moved out of the react-hook land\n if (rawQuery) {\n const defaultWorkspaceId = datasource.azureLogAnalyticsDatasource.getDeprecatedDefaultWorkSpace();\n if (defaultWorkspaceId) {\n const isWorkspaceGUID = isGUIDish(defaultWorkspaceId);\n if (isWorkspaceGUID) {\n resource = await datasource.resourcePickerData.getResourceURIFromWorkspace(defaultWorkspaceId);\n } else {\n resource = defaultWorkspaceId;\n }\n } else {\n const maybeFirstWorkspace = await datasource.azureLogAnalyticsDatasource.getFirstWorkspace();\n resource = maybeFirstWorkspace || '';\n }\n }\n\n return {\n refId: 'A',\n queryType: AzureQueryType.LogAnalytics,\n azureLogAnalytics: {\n query: rawQuery,\n resource,\n },\n subscription: defaultSubscriptionId,\n };\n};\n\nexport const migrateStringQueriesToObjectQueries = async (\n rawQuery: string | AzureMonitorQuery,\n options: { datasource: DataSource }\n): Promise<AzureMonitorQuery> => {\n // no need to migrate already migrated queries\n if (typeof rawQuery !== 'string') {\n return rawQuery;\n }\n\n return isGrafanaTemplateVariableFnQuery(rawQuery)\n ? createGrafanaTemplateVariableQuery(rawQuery, options.datasource)\n : createLogAnalyticsTemplateVariableQuery(rawQuery, options.datasource);\n};\n","import React, { ChangeEvent, useCallback, useEffect, useState } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Alert, InlineField, Input, Select } from '@grafana/ui';\n\nimport DataSource from '../../datasource';\nimport { migrateStringQueriesToObjectQueries } from '../../grafanaTemplateVariableFns';\nimport { AzureMonitorQuery, AzureQueryType } from '../../types';\nimport useLastError from '../../utils/useLastError';\nimport LogsQueryEditor from '../LogsQueryEditor';\nimport { Space } from '../Space';\n\nconst AZURE_QUERY_VARIABLE_TYPE_OPTIONS = [\n { label: 'Grafana Query Function', value: AzureQueryType.GrafanaTemplateVariableFn },\n { label: 'Logs', value: AzureQueryType.LogAnalytics },\n];\n\nconst GrafanaTemplateVariableFnInput = ({\n query,\n updateQuery,\n datasource,\n}: {\n query: AzureMonitorQuery;\n updateQuery: (val: AzureMonitorQuery) => void;\n datasource: DataSource;\n}) => {\n const [inputVal, setInputVal] = useState('');\n useEffect(() => {\n setInputVal(query.grafanaTemplateVariableFn?.rawQuery || '');\n }, [query.grafanaTemplateVariableFn?.rawQuery]);\n\n const onRunQuery = useCallback(\n (newQuery: string) => {\n migrateStringQueriesToObjectQueries(newQuery, { datasource }).then((updatedQuery) => {\n if (updatedQuery.queryType === AzureQueryType.GrafanaTemplateVariableFn) {\n updateQuery(updatedQuery);\n } else {\n updateQuery({\n ...query,\n grafanaTemplateVariableFn: {\n kind: 'UnknownQuery',\n rawQuery: newQuery,\n },\n });\n }\n });\n },\n [datasource, query, updateQuery]\n );\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n setInputVal(event.target.value);\n };\n\n return (\n <InlineField label=\"Grafana template variable function\">\n <Input\n placeholder={'type a grafana template variable function, ex: Subscriptions()'}\n value={inputVal}\n onChange={onChange}\n onBlur={() => onRunQuery(inputVal)}\n />\n </InlineField>\n );\n};\n\ntype Props = {\n query: AzureMonitorQuery | string;\n onChange: (query: AzureMonitorQuery) => void;\n datasource: DataSource;\n};\n\nconst VariableEditor = (props: Props) => {\n const defaultQuery: AzureMonitorQuery = {\n refId: 'A',\n queryType: AzureQueryType.GrafanaTemplateVariableFn,\n };\n const [query, setQuery] = useState(defaultQuery);\n\n useEffect(() => {\n migrateStringQueriesToObjectQueries(props.query, { datasource: props.datasource }).then((migratedQuery) => {\n setQuery(migratedQuery);\n });\n }, [props.query, props.datasource]);\n\n const onQueryTypeChange = (selectableValue: SelectableValue) => {\n if (selectableValue.value) {\n setQuery({\n ...query,\n queryType: selectableValue.value,\n });\n }\n };\n const onLogsQueryChange = (queryChange: AzureMonitorQuery) => {\n setQuery(queryChange);\n\n // only hit backend if there's something to query (prevents error when selecting the resource before pinging a query)\n if (queryChange.azureLogAnalytics?.query) {\n props.onChange(queryChange);\n }\n };\n\n const [errorMessage, setError] = useLastError();\n\n const variableOptionGroup = {\n label: 'Template Variables',\n // TODO: figure out a way to filter out the current variable from the variables list\n // options: props.datasource.getVariables().map((v) => ({ label: v, value: v })),\n options: [],\n };\n\n return (\n <>\n <InlineField label=\"Select query type\">\n <Select\n aria-label=\"select query type\"\n onChange={onQueryTypeChange}\n options={AZURE_QUERY_VARIABLE_TYPE_OPTIONS}\n width={25}\n value={query.queryType}\n />\n </InlineField>\n {query.queryType === AzureQueryType.LogAnalytics && (\n <>\n <LogsQueryEditor\n subscriptionId={query.subscription}\n query={query}\n datasource={props.datasource}\n onChange={onLogsQueryChange}\n variableOptionGroup={variableOptionGroup}\n setError={setError}\n hideFormatAs={true}\n />\n {errorMessage && (\n <>\n <Space v={2} />\n <Alert severity=\"error\" title=\"An error occurred while requesting metadata from Azure Monitor\">\n {errorMessage}\n </Alert>\n </>\n )}\n </>\n )}\n {query.queryType === AzureQueryType.GrafanaTemplateVariableFn && (\n <GrafanaTemplateVariableFnInput query={query} updateQuery={props.onChange} datasource={props.datasource} />\n )}\n </>\n );\n};\n\nexport default VariableEditor;\n","import { from, lastValueFrom, Observable } from 'rxjs';\n\nimport {\n CustomVariableSupport,\n DataQueryRequest,\n DataQueryResponse,\n MetricFindValue,\n toDataFrame,\n} from '@grafana/data';\nimport { getTemplateSrv } from '@grafana/runtime';\n\nimport VariableEditor from './components/VariableEditor/VariableEditor';\nimport DataSource from './datasource';\nimport { migrateStringQueriesToObjectQueries } from './grafanaTemplateVariableFns';\nimport { AzureMonitorQuery, AzureQueryType } from './types';\nimport { GrafanaTemplateVariableQuery } from './types/templateVariables';\nimport messageFromError from './utils/messageFromError';\n\nexport class VariableSupport extends CustomVariableSupport<DataSource, AzureMonitorQuery> {\n constructor(private readonly datasource: DataSource) {\n super();\n this.datasource = datasource;\n this.query = this.query.bind(this);\n }\n\n editor = VariableEditor;\n\n query(request: DataQueryRequest<AzureMonitorQuery>): Observable<DataQueryResponse> {\n const promisedResults = async () => {\n const queryObj = await migrateStringQueriesToObjectQueries(request.targets[0], { datasource: this.datasource });\n\n if (queryObj.queryType === AzureQueryType.GrafanaTemplateVariableFn && queryObj.grafanaTemplateVariableFn) {\n try {\n const templateVariablesResults = await this.callGrafanaTemplateVariableFn(queryObj.grafanaTemplateVariableFn);\n return {\n data: templateVariablesResults?.length ? [toDataFrame(templateVariablesResults)] : [],\n };\n } catch (err) {\n return { data: [], error: { message: messageFromError(err) } };\n }\n }\n request.targets[0] = queryObj;\n return lastValueFrom(this.datasource.query(request));\n };\n\n return from(promisedResults());\n }\n\n callGrafanaTemplateVariableFn(query: GrafanaTemplateVariableQuery): Promise<MetricFindValue[]> | null {\n if (query.kind === 'SubscriptionsQuery') {\n return this.datasource.getSubscriptions();\n }\n\n if (query.kind === 'ResourceGroupsQuery') {\n return this.datasource.getResourceGroups(this.replaceVariable(query.subscription));\n }\n\n if (query.kind === 'MetricDefinitionsQuery') {\n return this.datasource.getMetricDefinitions(\n this.replaceVariable(query.subscription),\n this.replaceVariable(query.resourceGroup)\n );\n }\n\n if (query.kind === 'ResourceNamesQuery') {\n return this.datasource.getResourceNames(\n this.replaceVariable(query.subscription),\n this.replaceVariable(query.resourceGroup),\n this.replaceVariable(query.metricDefinition)\n );\n }\n\n if (query.kind === 'MetricNamespaceQuery') {\n return this.datasource.azureMonitorDatasource.getMetricNamespaces(query);\n }\n\n if (query.kind === 'MetricNamesQuery') {\n return this.datasource.azureMonitorDatasource.getMetricNames(query);\n }\n\n if (query.kind === 'WorkspacesQuery') {\n return this.datasource.azureLogAnalyticsDatasource.getWorkspaces(this.replaceVariable(query.subscription));\n }\n\n return null;\n }\n\n replaceVariable(metric: string) {\n return getTemplateSrv().replace((metric || '').trim());\n }\n}\n","import { cloneDeep, upperFirst } from 'lodash';\nimport { forkJoin, Observable, of } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport {\n DataFrame,\n DataQueryRequest,\n DataQueryResponse,\n DataSourceApi,\n DataSourceInstanceSettings,\n LoadingState,\n ScopedVars,\n} from '@grafana/data';\nimport { getTemplateSrv, TemplateSrv } from 'app/features/templating/template_srv';\n\nimport AzureLogAnalyticsDatasource from './azure_log_analytics/azure_log_analytics_datasource';\nimport AzureMonitorDatasource from './azure_monitor/azure_monitor_datasource';\nimport AzureResourceGraphDatasource from './azure_resource_graph/azure_resource_graph_datasource';\nimport ResourcePickerData from './resourcePicker/resourcePickerData';\nimport { AzureDataSourceJsonData, AzureMonitorQuery, AzureQueryType, DatasourceValidationResult } from './types';\nimport migrateAnnotation from './utils/migrateAnnotation';\nimport { datasourceMigrations } from './utils/migrateQuery';\nimport { VariableSupport } from './variables';\n\nexport default class Datasource extends DataSourceApi<AzureMonitorQuery, AzureDataSourceJsonData> {\n annotations = {\n prepareAnnotation: migrateAnnotation,\n };\n\n azureMonitorDatasource: AzureMonitorDatasource;\n azureLogAnalyticsDatasource: AzureLogAnalyticsDatasource;\n resourcePickerData: ResourcePickerData;\n azureResourceGraphDatasource: AzureResourceGraphDatasource;\n\n pseudoDatasource: {\n [key in AzureQueryType]?: AzureMonitorDatasource | AzureLogAnalyticsDatasource | AzureResourceGraphDatasource;\n } = {};\n\n declare optionsKey: Record<AzureQueryType, string>;\n\n constructor(\n instanceSettings: DataSourceInstanceSettings<AzureDataSourceJsonData>,\n private readonly templateSrv: TemplateSrv = getTemplateSrv()\n ) {\n super(instanceSettings);\n this.azureMonitorDatasource = new AzureMonitorDatasource(instanceSettings);\n this.azureLogAnalyticsDatasource = new AzureLogAnalyticsDatasource(instanceSettings);\n this.azureResourceGraphDatasource = new AzureResourceGraphDatasource(instanceSettings);\n this.resourcePickerData = new ResourcePickerData(instanceSettings);\n\n this.pseudoDatasource = {\n [AzureQueryType.AzureMonitor]: this.azureMonitorDatasource,\n [AzureQueryType.LogAnalytics]: this.azureLogAnalyticsDatasource,\n [AzureQueryType.AzureResourceGraph]: this.azureResourceGraphDatasource,\n };\n\n this.variables = new VariableSupport(this);\n }\n\n filterQuery(item: AzureMonitorQuery): boolean {\n if (!item.queryType) {\n return true;\n }\n const ds = this.pseudoDatasource[item.queryType];\n return ds?.filterQuery?.(item) ?? true;\n }\n\n query(options: DataQueryRequest<AzureMonitorQuery>): Observable<DataQueryResponse> {\n const byType = new Map<AzureQueryType, DataQueryRequest<AzureMonitorQuery>>();\n\n for (const baseTarget of options.targets) {\n // Migrate old query structures\n const target = datasourceMigrations(baseTarget, this.templateSrv);\n\n // Skip hidden or invalid queries or ones without properties\n if (!target.queryType || target.hide || !hasQueryForType(target)) {\n continue;\n }\n\n // Initialize the list of queries\n if (!byType.has(target.queryType)) {\n const queryForType = cloneDeep(options);\n queryForType.requestId = `${queryForType.requestId}-${target.refId}`;\n queryForType.targets = [];\n byType.set(target.queryType, queryForType);\n }\n\n const queryForType = byType.get(target.queryType);\n queryForType?.targets.push(target);\n }\n\n const observables: Array<Observable<DataQueryResponse>> = Array.from(byType.entries()).map(([queryType, req]) => {\n const ds = this.pseudoDatasource[queryType];\n if (!ds) {\n throw new Error('Data source not created for query type ' + queryType);\n }\n\n return ds.query(req);\n });\n\n // Single query can skip merge\n if (observables.length === 1) {\n return observables[0];\n }\n\n if (observables.length > 1) {\n return forkJoin(observables).pipe(\n map((results: DataQueryResponse[]) => {\n const data: DataFrame[] = [];\n for (const result of results) {\n for (const frame of result.data) {\n data.push(frame);\n }\n }\n\n return { state: LoadingState.Done, data };\n })\n );\n }\n\n return of({ state: LoadingState.Done, data: [] });\n }\n\n targetContainsTemplate(query: AzureMonitorQuery) {\n if (query.subscription && this.templateSrv.containsTemplate(query.subscription)) {\n return true;\n }\n\n let subQuery;\n if (query.queryType === AzureQueryType.AzureMonitor) {\n subQuery = JSON.stringify(query.azureMonitor);\n } else if (query.queryType === AzureQueryType.LogAnalytics) {\n subQuery = JSON.stringify(query.azureLogAnalytics);\n } else if (query.queryType === AzureQueryType.AzureResourceGraph) {\n subQuery = JSON.stringify([query.azureResourceGraph, query.subscriptions]);\n }\n\n return !!subQuery && this.templateSrv.containsTemplate(subQuery);\n }\n\n async annotationQuery(options: any) {\n return this.azureLogAnalyticsDatasource.annotationQuery(options);\n }\n\n async testDatasource(): Promise<DatasourceValidationResult> {\n const promises: Array<Promise<DatasourceValidationResult>> = [];\n\n promises.push(this.azureMonitorDatasource.testDatasource());\n promises.push(this.azureLogAnalyticsDatasource.testDatasource());\n\n return await Promise.all(promises).then((results) => {\n let status: 'success' | 'error' = 'success';\n let message = '';\n\n for (let i = 0; i < results.length; i++) {\n if (results[i].status !== 'success') {\n status = results[i].status;\n }\n message += `${i + 1}. ${results[i].message} `;\n }\n\n return {\n status: status,\n message: message,\n title: upperFirst(status),\n };\n });\n }\n\n /* Azure Monitor REST API methods */\n getResourceGroups(subscriptionId: string) {\n return this.azureMonitorDatasource.getResourceGroups(this.replaceTemplateVariable(subscriptionId));\n }\n\n getMetricDefinitions(subscriptionId: string, resourceGroup: string) {\n return this.azureMonitorDatasource.getMetricDefinitions(\n this.replaceTemplateVariable(subscriptionId),\n this.replaceTemplateVariable(resourceGroup)\n );\n }\n\n getResourceNames(subscriptionId: string, resourceGroup: string, metricDefinition: string) {\n return this.azureMonitorDatasource.getResourceNames(\n this.replaceTemplateVariable(subscriptionId),\n this.replaceTemplateVariable(resourceGroup),\n this.replaceTemplateVariable(metricDefinition)\n );\n }\n\n /*Azure Log Analytics */\n getAzureLogAnalyticsWorkspaces(subscriptionId: string) {\n return this.azureLogAnalyticsDatasource.getWorkspaces(subscriptionId);\n }\n\n getSubscriptions() {\n return this.azureMonitorDatasource.getSubscriptions();\n }\n\n interpolateVariablesInQueries(queries: AzureMonitorQuery[], scopedVars: ScopedVars): AzureMonitorQuery[] {\n const mapped = queries.map((query) => {\n if (!query.queryType) {\n return query;\n }\n\n const ds = this.pseudoDatasource[query.queryType];\n return {\n datasource: ds?.getRef(),\n ...(ds?.applyTemplateVariables(query, scopedVars) ?? query),\n };\n });\n\n return mapped;\n }\n\n replaceTemplateVariable(variable: string) {\n return this.templateSrv.replace(variable);\n }\n\n getVariables() {\n return this.templateSrv.getVariables().map((v) => `$${v.name}`);\n }\n\n isTemplateVariable(value: string) {\n return this.getVariables().includes(value);\n }\n}\n\nfunction hasQueryForType(query: AzureMonitorQuery): boolean {\n switch (query.queryType) {\n case AzureQueryType.AzureMonitor:\n return !!query.azureMonitor;\n\n case AzureQueryType.LogAnalytics:\n return !!query.azureLogAnalytics;\n\n case AzureQueryType.AzureResourceGraph:\n return !!query.azureResourceGraph;\n\n case AzureQueryType.GrafanaTemplateVariableFn:\n return !!query.grafanaTemplateVariableFn;\n\n default:\n return false;\n }\n}\n","import { DataSourcePlugin } from '@grafana/data';\n\nimport { ConfigEditor } from './components/ConfigEditor';\nimport AzureMonitorQueryEditor from './components/QueryEditor';\nimport Datasource from './datasource';\nimport { AzureMonitorQuery, AzureDataSourceJsonData } from './types';\n\nexport const plugin = new DataSourcePlugin<Datasource, AzureMonitorQuery, AzureDataSourceJsonData>(Datasource)\n .setConfigEditor(ConfigEditor)\n .setQueryEditor(AzureMonitorQueryEditor);\n","function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if(\"production\"!==process.env.NODE_ENV){var i=Y[n],o=i?\"function\"==typeof i?i.apply(null,t):i:\"unknown error nr: \"+n;throw Error(\"[Immer] \"+o)}throw Error(\"[Immer] minified error nr: \"+n+(t.length?\" \"+t.map((function(n){return\"'\"+n+\"'\"})).join(\",\"):\"\")+\". Find the full error at: https://bit.ly/3cXEKWf\")}function r(n){return!!n&&!!n[Q]}function t(n){return!!n&&(function(n){if(!n||\"object\"!=typeof n)return!1;var r=Object.getPrototypeOf(n);if(null===r)return!0;var t=Object.hasOwnProperty.call(r,\"constructor\")&&r.constructor;return t===Object||\"function\"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!n.constructor[L]||s(n)||v(n))}function e(t){return r(t)||n(23,t),t[Q].t}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&\"symbol\"==typeof e||r(e,n[e],n)})):n.forEach((function(t,e){return r(e,t,n)}))}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?(n.delete(r),n.add(t)):n[r]=t}function c(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]})}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)?n:(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0),n)}function h(){n(2)}function y(n){return null==n||\"object\"!=typeof n||Object.isFrozen(n)}function b(r){var t=tn[r];return t||n(18,r),t}function m(n,r){tn[n]||(tn[n]=r)}function _(){return\"production\"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b(\"Patches\"),n.u=[],n.s=[],n.v=r)}function O(n){g(n),n.p.forEach(S),n.p=null}function g(n){n===U&&(U=n.l)}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.O=!0}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.g||b(\"ES5\").S(e,r,o),o?(i[Q].P&&(O(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b(\"Patches\").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),O(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o;i(3===e.i?new Set(o):o,(function(r,i){return A(n,e,o,r,i,t)})),x(n,o,!1),t&&n.u&&b(\"Patches\").R(e,t,n.u,n.s)}return e.o}function A(e,i,o,a,c,s){if(\"production\"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var v=M(e,c,s&&i&&3!==i.i&&!u(i.D,a)?s.concat(a):void 0);if(f(o,a,v),!r(v))return;e.m=!1}if(t(c)&&!y(c)){if(!e.h.F&&e._<1)return;M(e,c),i&&i.A.l||x(e,c)}}function x(n,r,t){void 0===t&&(t=!1),n.h.F&&n.m&&d(r,t)}function z(n,r){var t=n[Q];return(t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t)}}function k(n){n.P||(n.P=!0,n.l&&k(n.l))}function E(n){n.o||(n.o=l(n.t))}function R(n,r,t){var e=s(r)?b(\"MapSet\").N(r,t):v(r)?b(\"MapSet\").T(r,t):n.g?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,D:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b(\"ES5\").J(r,t);return(t?t.A:_()).p.push(e),e}function D(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b(\"ES5\").K(u)))return u.t;u.I=!0,e=F(r,c),u.I=!1}else e=F(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f(e,r,n(t))})),3===c?new Set(e):e}(e)}function F(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}function N(){function t(n,r){var t=s[n];return t?t.enumerable=r:s[n]=t={configurable:!0,enumerable:r,get:function(){var r=this[Q];return\"production\"!==process.env.NODE_ENV&&f(r),en.get(r,n)},set:function(r){var t=this[Q];\"production\"!==process.env.NODE_ENV&&f(t),en.set(t,n,r)}},t}function e(n){for(var r=n.length-1;r>=0;r--){var t=n[r][Q];if(!t.P)switch(t.i){case 5:a(t)&&k(t);break;case 4:o(t)&&k(t)}}}function o(n){for(var r=n.t,t=n.k,e=nn(t),i=e.length-1;i>=0;i--){var o=e[i];if(o!==Q){var a=r[o];if(void 0===a&&!u(r,o))return!0;var f=t[o],s=f&&f[Q];if(s?s.t!==a:!c(f,a))return!0}}var v=!!r[Q];return e.length!==nn(r).length+(v?0:1)}function a(n){var r=n.k;if(r.length!==n.t.length)return!0;var t=Object.getOwnPropertyDescriptor(r,r.length-1);if(t&&!t.get)return!0;for(var e=0;e<r.length;e++)if(!r.hasOwnProperty(e))return!0;return!1}function f(r){r.O&&n(3,JSON.stringify(p(r)))}var s={};m(\"ES5\",{J:function(n,r){var e=Array.isArray(n),i=function(n,r){if(n){for(var e=Array(r.length),i=0;i<r.length;i++)Object.defineProperty(e,\"\"+i,t(i,!0));return e}var o=rn(r);delete o[Q];for(var u=nn(o),a=0;a<u.length;a++){var f=u[a];o[f]=t(f,n||!!o[f].enumerable)}return Object.create(Object.getPrototypeOf(r),o)}(e,n),o={i:e?5:4,A:r?r.A:_(),P:!1,I:!1,D:{},l:r,t:n,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,Q,{value:o,writable:!0}),i},S:function(n,t,o){o?r(t)&&t[Q].A===n&&e(n.p):(n.u&&function n(r){if(r&&\"object\"==typeof r){var t=r[Q];if(t){var e=t.t,o=t.k,f=t.D,c=t.i;if(4===c)i(o,(function(r){r!==Q&&(void 0!==e[r]||u(e,r)?f[r]||n(o[r]):(f[r]=!0,k(t)))})),i(e,(function(n){void 0!==o[n]||u(o,n)||(f[n]=!1,k(t))}));else if(5===c){if(a(t)&&(k(t),f.length=!0),o.length<e.length)for(var s=o.length;s<e.length;s++)f[s]=!1;else for(var v=e.length;v<o.length;v++)f[v]=!0;for(var p=Math.min(o.length,e.length),l=0;l<p;l++)o.hasOwnProperty(l)||(f[l]=!0),void 0===f[l]&&n(o[l])}}}}(n.p[0]),e(n.p))},K:function(n){return 4===n.i?o(n):a(n)}})}function T(){function e(n){if(!t(n))return n;if(Array.isArray(n))return n.map(e);if(s(n))return new Map(Array.from(n.entries()).map((function(n){return[n[0],e(n[1])]})));if(v(n))return new Set(Array.from(n).map(e));var r=Object.create(Object.getPrototypeOf(n));for(var i in n)r[i]=e(n[i]);return u(n,L)&&(r[L]=n[L]),r}function f(n){return r(n)?e(n):n}var c=\"add\";m(\"Patches\",{$:function(r,t){return t.forEach((function(t){for(var i=t.path,u=t.op,f=r,s=0;s<i.length-1;s++){var v=o(f),p=\"\"+i[s];0!==v&&1!==v||\"__proto__\"!==p&&\"constructor\"!==p||n(24),\"function\"==typeof f&&\"prototype\"===p&&n(24),\"object\"!=typeof(f=a(f,p))&&n(15,i.join(\"/\"))}var l=o(f),d=e(t.value),h=i[i.length-1];switch(u){case\"replace\":switch(l){case 2:return f.set(h,d);case 3:n(16);default:return f[h]=d}case c:switch(l){case 1:return\"-\"===h?f.push(d):f.splice(h,0,d);case 2:return f.set(h,d);case 3:return f.add(d);default:return f[h]=d}case\"remove\":switch(l){case 1:return f.splice(h,1);case 2:return f.delete(h);case 3:return f.delete(t.value);default:return delete f[h]}default:n(17,u)}})),r},R:function(n,r,t,e){switch(n.i){case 0:case 4:case 2:return function(n,r,t,e){var o=n.t,s=n.o;i(n.D,(function(n,i){var v=a(o,n),p=a(s,n),l=i?u(o,n)?\"replace\":c:\"remove\";if(v!==p||\"replace\"!==l){var d=r.concat(n);t.push(\"remove\"===l?{op:l,path:d}:{op:l,path:d,value:p}),e.push(l===c?{op:\"remove\",path:d}:\"remove\"===l?{op:c,path:d,value:f(v)}:{op:\"replace\",path:d,value:f(v)})}}))}(n,r,t,e);case 5:case 1:return function(n,r,t,e){var i=n.t,o=n.D,u=n.o;if(u.length<i.length){var a=[u,i];i=a[0],u=a[1];var s=[e,t];t=s[0],e=s[1]}for(var v=0;v<i.length;v++)if(o[v]&&u[v]!==i[v]){var p=r.concat([v]);t.push({op:\"replace\",path:p,value:f(u[v])}),e.push({op:\"replace\",path:p,value:f(i[v])})}for(var l=i.length;l<u.length;l++){var d=r.concat([l]);t.push({op:c,path:d,value:f(u[l])})}i.length<u.length&&e.push({op:\"replace\",path:r.concat([\"length\"]),value:i.length})}(n,r,t,e);case 3:return function(n,r,t,e){var i=n.t,o=n.o,u=0;i.forEach((function(n){if(!o.has(n)){var i=r.concat([u]);t.push({op:\"remove\",path:i,value:n}),e.unshift({op:c,path:i,value:n})}u++})),u=0,o.forEach((function(n){if(!i.has(n)){var o=r.concat([u]);t.push({op:c,path:o,value:n}),e.unshift({op:\"remove\",path:o,value:n})}u++}))}(n,r,t,e)}},M:function(n,r,t,e){t.push({op:\"replace\",path:[],value:r===H?void 0:r}),e.push({op:\"replace\",path:[],value:n})}})}function C(){function r(n,r){function t(){this.constructor=n}a(n,r),n.prototype=(t.prototype=r.prototype,new t)}function e(n){n.o||(n.D=new Map,n.o=new Map(n.t))}function o(n){n.o||(n.o=new Set,n.t.forEach((function(r){if(t(r)){var e=R(n.A.h,r,n);n.p.set(r,e),n.o.add(e)}else n.o.add(r)})))}function u(r){r.O&&n(3,JSON.stringify(p(r)))}var a=function(n,r){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var t in r)r.hasOwnProperty(t)&&(n[t]=r[t])})(n,r)},f=function(){function n(n,r){return this[Q]={i:2,l:r,A:r?r.A:_(),P:!1,I:!1,o:void 0,D:void 0,t:n,k:this,C:!1,O:!1},this}r(n,Map);var o=n.prototype;return Object.defineProperty(o,\"size\",{get:function(){return p(this[Q]).size}}),o.has=function(n){return p(this[Q]).has(n)},o.set=function(n,r){var t=this[Q];return u(t),p(t).has(n)&&p(t).get(n)===r||(e(t),k(t),t.D.set(n,!0),t.o.set(n,r),t.D.set(n,!0)),this},o.delete=function(n){if(!this.has(n))return!1;var r=this[Q];return u(r),e(r),k(r),r.t.has(n)?r.D.set(n,!1):r.D.delete(n),r.o.delete(n),!0},o.clear=function(){var n=this[Q];u(n),p(n).size&&(e(n),k(n),n.D=new Map,i(n.t,(function(r){n.D.set(r,!1)})),n.o.clear())},o.forEach=function(n,r){var t=this;p(this[Q]).forEach((function(e,i){n.call(r,t.get(i),i,t)}))},o.get=function(n){var r=this[Q];u(r);var i=p(r).get(n);if(r.I||!t(i))return i;if(i!==r.t.get(n))return i;var o=R(r.A.h,i,r);return e(r),r.o.set(n,o),o},o.keys=function(){return p(this[Q]).keys()},o.values=function(){var n,r=this,t=this.keys();return(n={})[V]=function(){return r.values()},n.next=function(){var n=t.next();return n.done?n:{done:!1,value:r.get(n.value)}},n},o.entries=function(){var n,r=this,t=this.keys();return(n={})[V]=function(){return r.entries()},n.next=function(){var n=t.next();if(n.done)return n;var e=r.get(n.value);return{done:!1,value:[n.value,e]}},n},o[V]=function(){return this.entries()},n}(),c=function(){function n(n,r){return this[Q]={i:3,l:r,A:r?r.A:_(),P:!1,I:!1,o:void 0,t:n,k:this,p:new Map,O:!1,C:!1},this}r(n,Set);var t=n.prototype;return Object.defineProperty(t,\"size\",{get:function(){return p(this[Q]).size}}),t.has=function(n){var r=this[Q];return u(r),r.o?!!r.o.has(n)||!(!r.p.has(n)||!r.o.has(r.p.get(n))):r.t.has(n)},t.add=function(n){var r=this[Q];return u(r),this.has(n)||(o(r),k(r),r.o.add(n)),this},t.delete=function(n){if(!this.has(n))return!1;var r=this[Q];return u(r),o(r),k(r),r.o.delete(n)||!!r.p.has(n)&&r.o.delete(r.p.get(n))},t.clear=function(){var n=this[Q];u(n),p(n).size&&(o(n),k(n),n.o.clear())},t.values=function(){var n=this[Q];return u(n),o(n),n.o.values()},t.entries=function(){var n=this[Q];return u(n),o(n),n.o.entries()},t.keys=function(){return this.values()},t[V]=function(){return this.values()},t.forEach=function(n,r){for(var t=this.values(),e=t.next();!e.done;)n.call(r,e.value,e.value,this),e=t.next()},n}();m(\"MapSet\",{N:function(n,r){return new f(n,r)},T:function(n,r){return new c(n,r)}})}function J(){N(),C(),T()}function K(n){return n}function $(n){return n}var G,U,W=\"undefined\"!=typeof Symbol&&\"symbol\"==typeof Symbol(\"x\"),X=\"undefined\"!=typeof Map,q=\"undefined\"!=typeof Set,B=\"undefined\"!=typeof Proxy&&void 0!==Proxy.revocable&&\"undefined\"!=typeof Reflect,H=W?Symbol.for(\"immer-nothing\"):((G={})[\"immer-nothing\"]=!0,G),L=W?Symbol.for(\"immer-draftable\"):\"__$immer_draftable\",Q=W?Symbol.for(\"immer-state\"):\"__$immer_state\",V=\"undefined\"!=typeof Symbol&&Symbol.iterator||\"@@iterator\",Y={0:\"Illegal state\",1:\"Immer drafts cannot have computed properties\",2:\"This object has been frozen and should not be mutated\",3:function(n){return\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \"+n},4:\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",5:\"Immer forbids circular references\",6:\"The first or second argument to `produce` must be a function\",7:\"The third argument to `produce` must be a function or undefined\",8:\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",9:\"First argument to `finishDraft` must be a draft returned by `createDraft`\",10:\"The given draft is already finalized\",11:\"Object.defineProperty() cannot be used on an Immer draft\",12:\"Object.setPrototypeOf() cannot be used on an Immer draft\",13:\"Immer only supports deleting array indices\",14:\"Immer only supports setting array indices and the 'length' property\",15:function(n){return\"Cannot apply patch, path doesn't resolve: \"+n},16:'Sets cannot have \"replace\" patches.',17:function(n){return\"Unsupported patch operation: \"+n},18:function(n){return\"The plugin for '\"+n+\"' has not been loaded into Immer. To enable the plugin, import and call `enable\"+n+\"()` when initializing your application.\"},20:\"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available\",21:function(n){return\"produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '\"+n+\"'\"},22:function(n){return\"'current' expects a draft, got: \"+n},23:function(n){return\"'original' expects a draft, got: \"+n},24:\"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"},Z=\"\"+Object.prototype.constructor,nn=\"undefined\"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t)})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?\"value\"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=R(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.D[r]=!1,!0;if(c(t,i)&&(void 0!==t||u(n.t,r)))return!0;E(n),k(n)}return n.o[r]===t&&\"number\"!=typeof t&&(void 0!==t||r in n.o)||(n.o[r]=t,n.D[r]=!0,!0)},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.D[r]=!1,E(n),k(n)):delete n.D[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||\"length\"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11)},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12)}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}})),on.deleteProperty=function(r,t){return\"production\"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return\"production\"!==process.env.NODE_ENV&&\"length\"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.g=B,this.F=!0,this.produce=function(r,i,o){if(\"function\"==typeof r&&\"function\"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return(t=i).call.apply(t,[r,n].concat(e))}))}}var f;if(\"function\"!=typeof i&&n(6),void 0!==o&&\"function\"!=typeof o&&n(7),t(r)){var c=w(e),s=R(e,r,void 0),v=!0;try{f=i(s),v=!1}finally{v?O(c):g(c)}return\"undefined\"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw O(c),n})):(j(c,o),P(f,c))}if(!r||\"object\"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.F&&d(f,!0),o){var p=[],l=[];b(\"Patches\").M(r,f,p,l),o(p,l)}return f}n(21,r)},this.produceWithPatches=function(n,r){if(\"function\"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r}));return\"undefined\"!=typeof Promise&&o instanceof Promise?o.then((function(n){return[n,t,i]})):[o,t,i]},\"boolean\"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),\"boolean\"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze)}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=D(e));var i=w(this),o=R(this,e,void 0);return o[Q].C=!0,g(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];\"production\"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.F=n},i.setUseProxies=function(r){r&&!B&&n(20),this.g=r},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&\"replace\"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b(\"Patches\").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce,cn=an.produceWithPatches.bind(an),sn=an.setAutoFreeze.bind(an),vn=an.setUseProxies.bind(an),pn=an.applyPatches.bind(an),ln=an.createDraft.bind(an),dn=an.finishDraft.bind(an);export default fn;export{un as Immer,pn as applyPatches,K as castDraft,$ as castImmutable,ln as createDraft,D as current,J as enableAllPlugins,N as enableES5,C as enableMapSet,T as enablePatches,dn as finishDraft,d as freeze,L as immerable,r as isDraft,t as isDraftable,H as nothing,e as original,fn as produce,cn as produceWithPatches,sn as setAutoFreeze,vn as setUseProxies};\n//# sourceMappingURL=immer.esm.js.map\n"],"names":["TimeGrainConverter","timeGrain","timeGrainUnit","includes","toUpperCase","interval","slice","length","unit","indexOf","createISO8601Duration","toMinutes","allowedTimeGrains","timeGrains","filter","o","closest","intervalMs","rangeUtil","i","duration","offset","substring","value","timeUnitToText","text","timeUnitToKbn","ResponseParser","result","textFieldName","valueFieldName","list","find","get","push","metricDefinition","type","toLocaleLowerCase","name","metricName","defaultAggTypes","metricData","v","primaryAggType","primaryAggregationType","supportedAggTypes","supportedAggregationTypes","supportedTimeGrains","label","parseTimeGrains","metricAvailabilities","dimensions","parseDimensions","forEach","avail","createTimeGrainFromISO8601Duration","metadataDimensions","map","dimension","localizedValue","data","properties","findOptions","options","values","set","reduce","accum","item","add","Set","option","has","toOption","routeNames","interpolateVariable","variable","multi","includeAll","allValue","val","join","AzureQueryType","AzureCloud","concealed","Symbol","getAuthType","jsonData","azureAuthType","tenantId","clientId","config","getDefaultAzureCloud","Public","None","undefined","China","USGovernment","Germany","Error","getAzurePortalUrl","azureCloud","getAzureCloud","cloudName","getSecret","secureJsonFields","clientSecret","secret","secureJsonData","Input","LegacyForms","authTypeOptions","AzureCredentialsForm","props","credentials","azureCloudOptions","onCredentialsChange","getSubscriptions","disabled","hasRequiredFields","authType","isCredentialsComplete","subscriptions","setSubscriptions","useState","loadSubscriptionsClicked","onLoadSubscriptions","useReducer","useEffect","updateSubscriptions","canceled","then","received","autoSelect","defaultSubscriptionId","onSubscriptionChange","opt","selected","updated","className","managedIdentityEnabled","InlineFormLabel","tooltip","Select","onChange","placeholder","event","target","Button","variant","onClick","size","children","azureClouds","MonitorConfig","updateOptions","useMemo","subscriptionId","getCredentials","updateCredentials","readOnly","ConfigEditor","PureComponent","constructor","super","getTemplateSrv","optionsFunc","this","onOptionsChange","setState","unsaved","async","state","getBackendSrv","put","id","updateDatasourcePluginOption","datasource","version","saveOptions","fetch","url","baseURL","method","toPromise","error","parseSubscriptionsForSelect","err","title","description","details","message","Promise","resolve","render","Alert","severity","style","whiteSpace","useLastError","errors","setErrors","addError","useCallback","errorSource","errorsCopy","index","findIndex","vSource","splice","unshift","recentError","messageFromElement","Field","labelWidth","inlineField","remainingProps","InlineField","EditorField","width","query","variableOptionGroup","onQueryChange","multiSelect","handleChange","change","newQuery","subscription","queryType","AzureMonitor","azureMonitor","resourceGroup","metricNamespace","resourceName","aggregation","dimensionFilters","onSubscriptionsChange","c","MultiSelect","isClearable","inputId","allowCustomValue","azureResourceGraph","CodeEditor","language","height","showMiniMap","onBlur","onSave","ERROR_SOURCE","setError","fetchedRef","useRef","current","azureMonitorDatasource","results","fetchedSubscriptions","catch","EditorRows","EditorRow","EditorFieldGroup","Space","theme","useTheme2","styles","getStyles","cx","wrapper","defaultProps","h","layout","stylesFactory","css","paddingRight","spacing","paddingBottom","display","ResourceRowType","EntryIcon","isOpen","entry","Subscription","Icon","ResourceGroup","Resource","VariableGroup","Variable","table","tableLayout","tableScroller","maxHeight","overflow","header","background","colors","secondary","row","borderBottom","border","weak","borderBottomColor","medium","disabledRow","opacity","cell","padding","textOverflow","collapseButton","margin","loadingCell","textAlign","spinner","marginBottom","nestedEntry","alignItems","entryContentItem","truncated","minWidth","resourceField","maxWidth","resourceFieldButton","nestedRowCheckbox","zIndex","selectionFooter","position","bottom","primary","paddingTop","loadingWrapper","color","resultLimit","fontStyle","modal","breakpoints","lg","NestedEntry","isSelected","isDisabled","isSelectable","level","scrollIntoView","onToggleCollapse","onSelectedChange","useStyles2","hasChildren","handleToggleCollapse","handleSelectedChanged","ev","checked","checkboxId","uri","document","getElementById","behavior","block","marginLeft","gridSize","IconButton","Checkbox","htmlFor","RESOURCE_URI_REGEX","parseResourceURI","resourceURI","matches","exec","groups","subscriptionID","resource","isGUIDish","input","match","findRow","rows","toLowerCase","addResources","targetParentId","newResources","produce","draftState","draftRow","NestedRow","selectedRows","requestNestedRows","onRowSelectedChange","selectableEntryTypes","rowStatus","setRowStatus","selectedRow","some","typeLabel","location","Object","keys","childRow","FadeTransition","visible","colSpan","LoadingPlaceholder","searchFn","searchFilter","setSearchFilter","debouncedSearch","debounce","cancel","prefix","searchPhrase","currentTarget","resourcePickerData","onApply","onCancel","isLoading","setIsLoading","setRows","setSelectedRows","internalSelectedURI","setInternalSelectedURI","errorMessage","setErrorMessage","isAdvancedOpen","setIsAdvancedOpen","shouldShowLimitFlag","setShouldShowLimitFlag","loadInitialData","resources","fetchInitialRows","messageFromError","useEffectOnce","found","parentRow","nestedRows","fetchAndAppendNestedRow","handleSelectionChanged","handleApply","handleSearch","searchWord","searchResults","search","Collapse","collapsible","onToggle","Label","Tooltip","content","href","rel","placement","interactive","parseResourceDetails","parsed","subscriptionName","resourceGroupName","ResourceLabel","resourceComponents","setResourceComponents","getResourceURIDisplayProperties","FormattedResource","startsWith","setResource","resourceUri","pickerIsOpen","setPickerIsOpen","handleOpenPicker","closePicker","Modal","onDismiss","trapFocus","setKustoQuery","kustoQuery","azureLogAnalytics","FORMAT_OPTIONS","formatAs","resultFormat","setFormatAs","Deferred","reject","promise","freeze","monacoPromiseRef","promises","azureLogAnalyticsDatasource","getKustoSchema","all","schema","monaco","editor","languages","kusto","getKustoWorker","model","getModel","worker","setSchema","handleEditorMount","onEditorDidMount","useMigrations","migrationError","setMigrationError","workspace","getResourceURIFromWorkspace","migrateWorkspaceQueryToResourceQuery","hideFormatAs","setMetricNamespace","splitUri","split","accountNameIndex","baseUri","setTimeGrain","setDimensionFilters","aggregationOptions","setAggregation","dimensionOptions","dimensionLabels","setDimensionLabels","labelsObj","series","labels","flat","refId","flatMap","fields","entries","prevLabels","newLabels","currentLabels","useDimensionLabels","dimensionOperators","validDimensionOptions","t","dimensionFilter","onFieldChange","fieldName","getValidFilterOptions","selectedFilter","Array","from","getValidMultiSelectOptions","selectedFilters","labelOptions","EditorList","items","changed","properData","x","operator","filters","renderItem","onDelete","selectedOperator","selectedDimension","HorizontalGroup","menuShouldPortal","concat","e","AccessoryButton","icon","setValue","alias","HTMLInputElement","handleBlur","setLegendAlias","metricNames","setMetricName","metricNamespaces","optionValues","m","p","timeGrainOptions","autoInterval","TimegrainConverter","top","setTop","useAsyncState","asyncFn","dependencies","Math","random","finalValue","defaultMetricMetadata","aggOptions","formatOptions","rawResults","selectedValue","metricsMetadata","metricMetadata","setMetricMetadata","getMetricMetadata","metadata","aggregations","newAggregation","newTimeGrain","allowedTimeGrainsMs","useMetricMetadata","getMetricNamespaces","useMetricNamespaces","getMetricNames","useMetricNames","QueryHeader","queryTypes","LogAnalytics","AzureResourceGraph","EditorHeader","InlineSelect","UrlBuilder","templateSrv","metricDefinitionProcessed","replace","metricDefinitionArray","resourceNameProcessed","resourceNameArray","urlArray","shift","endsWith","parentResource","baseUrl","apiVersion","buildResourceUri","encodeURIComponent","OLD_DEFAULT_DROPDOWN_VALUE","migrateQuery","workingQuery","setMetricsTimeGrain","migrateTimeGrains","migrateLogAnalyticsToFromTimes","migrateToDefaultNamespace","migrateDimensionToDimensionFilter","migrateResourceUri","migrateDimensionFilterToArray","oldDimension","existingFilters","appendDimensionFilter","azureMonitorQuery","React","newFilters","staticProps","hasFilter","oldFilter","datasourceMigrations","DEFAULT_QUERY","onChangeQuery","preparedQuery","migratedQuery","defaults","deepEqual","prepareQuery","EditorForQueryType","JSON","stringify","baseQuery","onRunQuery","baseOnRunQuery","usePreparedQuery","getVariables","LogAnalyticsQuerystringBuilder","rawQueryString","defaultTimeField","generate","queryString","macroRegexp","p1","p2","getMultiContains","escape","getTimeFilter","getFrom","getUntil","rawQuery","uriString","range","dateTime","startOf","toISOString","rangeRaw","to","now","Date","until","timeFieldArg","timeField","inputs","firstCommaIndex","field","templateVar","trim","parseQueryResult","columns","tables","parseTimeSeriesResult","parseTableResult","timeIndex","metricIndex","valueIndex","epoch","dateTimeToEpoch","bucket","findOrCreateBucket","datapoints","meta","executedQueryString","col","parseToVariables","queryResult","variables","flattenDeep","transformToAnnotations","textIndex","tagsIndex","annotation","time","floor","toString","tags","dataTarget","dateTimeValue","valueOf","METADATA_FUNCTION_PARAMS","transformMetadataFunction","sourceSchema","functions","fn","params","parameters","arg","defaultValue","cslDefaultValue","body","inputParameters","AzureLogAnalyticsDatasource","DataSourceWithBackend","instanceSettings","cache","Map","resourcePath","azureMonitorPath","cloud","azurePortalUrl","isConfigured","validateDatasource","filterQuery","hide","path","getResource","response","getWorkspaceList","workspaceListUrl","interpolatedUri","nameOrIdOrSomething","templateVariables","database","majorVersion","minorVersion","clusterType","cluster","connectionString","databases","globalParameters","transformMetadataToKustoSchema","getMetadata","applyTemplateVariables","scopedVars","firstWorkspace","request","pipe","mergeMap","res","processResponse","df","encodedQuery","custom","buildDeepLink","links","targetBlank","customMeta","base64Enc","workspaceId","getWorkspaceDetails","customerId","getDeprecatedDefaultWorkSpace","logAnalyticsDefaultWorkspace","buildQuery","querystring","getRef","getDefaultOrFirstSubscription","getWorkspaces","annotationQuery","queries","doQueries","validationError","resourceOrWorkspace","getFirstWorkspace","status","getErrorMessage","statusText","code","isValidConfigField","locationMetadata","displayName","supportsLogs","logsSupportedLocationsKusto","locationDisplayNames","acc","resourceTypeDisplayNames","supportedMetricNamespaces","defaultDropdownValue","hasValue","AzureMonitorDatasource","timeSrv","getTimeSrv","hasResourceUri","hasLegacyQuery","f","parseSubscriptions","getResourceGroups","listByResourceGroupApiVersion","parseResponseValues","getMetricDefinitions","shouldHardcodeBlobStorage","getResourceNames","skipToken","validMetricDefinition","parseResourceNames","nextLink","nextToken","URL","searchParams","nextPage","buildAzureMonitorGetMetricNamespacesUrl","apiPreviewVersion","replaceTemplateVariables","storageNamespaces","namespace","buildAzureMonitorGetMetricNamesUrl","parseMetadata","key","AzureResourceGraphDatasource","variableNames","subscriptionVar","_","sub","logsSupportedResourceTypesKusto","supportedMetricNamespacesKusto","ResourcePickerData","searchType","searchQuery","filterByType","makeResourceGraphRequest","parsedUri","currentSelection","parsedURI","resourceGroupURI","resourceGroups","getResourceGroupsBySubscriptionId","getResourcesForResourceGroup","$skipToken","allFetched","resourceResponse","r","resourceGroupId","subscriptionURI","maxRetries","reqOptions","postResource","migrateAnnotation","oldQuery","oldWorkspace","grafanaTemplateVariableFnMatches","resourceGroupsWithSub","metricDefinitions","metricDefinitionsWithSub","resourceNames","resourceNamesWithSub","metricNamespaceWithSub","metricNamesWithSub","appInsightsMetricNameQuery","appInsightsGroupByQuery","workspacesQuery","workspacesQueryWithSub","migrateStringQueriesToObjectQueries","isGrafanaTemplateVariableFnQuery","matchesForQuery","GrafanaTemplateVariableFn","grafanaTemplateVariableFn","kind","createGrafanaTemplateVariableQuery","defaultWorkspaceId","createLogAnalyticsTemplateVariableQuery","AZURE_QUERY_VARIABLE_TYPE_OPTIONS","GrafanaTemplateVariableFnInput","updateQuery","inputVal","setInputVal","updatedQuery","defaultQuery","setQuery","selectableValue","queryChange","VariableSupport","CustomVariableSupport","VariableEditor","bind","queryObj","targets","templateVariablesResults","callGrafanaTemplateVariableFn","toDataFrame","lastValueFrom","promisedResults","replaceVariable","metric","Datasource","DataSourceApi","prepareAnnotation","azureResourceGraphDatasource","pseudoDatasource","ds","byType","baseTarget","hasQueryForType","queryForType","cloneDeep","requestId","observables","req","forkJoin","frame","LoadingState","of","targetContainsTemplate","containsTemplate","subQuery","testDatasource","upperFirst","replaceTemplateVariable","getAzureLogAnalyticsWorkspaces","interpolateVariablesInQueries","isTemplateVariable","plugin","DataSourcePlugin","setConfigEditor","setQueryEditor","AzureMonitorQueryEditor","n","arguments","Q","getPrototypeOf","hasOwnProperty","call","Function","Z","isArray","L","s","nn","u","prototype","a","delete","X","q","l","rn","writable","configurable","enumerable","create","d","y","clear","isFrozen","b","tn","U","j","O","g","S","w","P","M","H","A","I","k","R","D","F","z","getOwnPropertyDescriptor","E","N","T","C","en","on","Proxy","revocable","revoke","proxy","J","K","G","W","B","Reflect","for","iterator","ownKeys","getOwnPropertySymbols","getOwnPropertyNames","getOwnPropertyDescriptors","deleteProperty","defineProperty","setPrototypeOf","apply","un","produceWithPatches","useProxies","setUseProxies","autoFreeze","setAutoFreeze","createDraft","finishDraft","applyPatches","op","$","an"],"sourceRoot":""}
|