@ -197,6 +197,8 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
if ( ! this . target . subscription && this . subscriptions . length > 0 ) {
this . target . subscription = this . subscriptions [ 0 ] . value ;
}
return this . subscriptions ;
} ) ;
}
@ -204,6 +206,18 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
if ( this . target . queryType === 'Azure Log Analytics' ) {
return this . getWorkspaces ( ) ;
}
if ( this . target . queryType === 'Azure Monitor' ) {
this . target . azureMonitor . resourceGroup = this . defaultDropdownValue ;
this . target . azureMonitor . metricDefinition = this . defaultDropdownValue ;
this . target . azureMonitor . resourceName = this . defaultDropdownValue ;
this . target . azureMonitor . metricName = this . defaultDropdownValue ;
this . target . azureMonitor . aggregation = '' ;
this . target . azureMonitor . timeGrains = [ ] ;
this . target . azureMonitor . timeGrain = '' ;
this . target . azureMonitor . dimensions = [ ] ;
this . target . azureMonitor . dimension = '' ;
}
}
/* Azure Monitor Section */
@ -279,6 +293,12 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
}
onResourceGroupChange() {
this . target . azureMonitor . metricDefinition = this . defaultDropdownValue ;
this . target . azureMonitor . resourceName = this . defaultDropdownValue ;
this . target . azureMonitor . metricName = this . defaultDropdownValue ;
this . target . azureMonitor . aggregation = '' ;
this . target . azureMonitor . timeGrains = [ ] ;
this . target . azureMonitor . timeGrain = '' ;
this . target . azureMonitor . dimensions = [ ] ;
this . target . azureMonitor . dimension = '' ;
}
@ -286,11 +306,18 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
onMetricDefinitionChange() {
this . target . azureMonitor . resourceName = this . defaultDropdownValue ;
this . target . azureMonitor . metricName = this . defaultDropdownValue ;
this . target . azureMonitor . aggregation = '' ;
this . target . azureMonitor . timeGrains = [ ] ;
this . target . azureMonitor . timeGrain = '' ;
this . target . azureMonitor . dimensions = [ ] ;
this . target . azureMonitor . dimension = '' ;
}
onResourceNameChange() {
this . target . azureMonitor . metricName = this . defaultDropdownValue ;
this . target . azureMonitor . aggregation = '' ;
this . target . azureMonitor . timeGrains = [ ] ;
this . target . azureMonitor . timeGrain = '' ;
this . target . azureMonitor . dimensions = [ ] ;
this . target . azureMonitor . dimension = '' ;
}
@ -312,6 +339,7 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
this . target . azureMonitor . aggOptions = metadata . supportedAggTypes || [ metadata . primaryAggType ] ;
this . target . azureMonitor . aggregation = metadata . primaryAggType ;
this . target . azureMonitor . timeGrains = [ { text : 'auto' , value : 'auto' } ] . concat ( metadata . supportedTimeGrains ) ;
this . target . azureMonitor . timeGrain = 'auto' ;
this . target . azureMonitor . dimensions = metadata . dimensions ;
if ( metadata . dimensions . length > 0 ) {