mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Azure Monitor: Use default from datasource if not saved on dashboard/query (#20899)
* use default from datasource if not saved on dash/query * find datasource default workspace in returned workspace list * don't need the find * fix dropdown
This commit is contained in:
@@ -537,9 +537,18 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
|
||||
.getWorkspaces(this.target.subscription)
|
||||
.then((list: any[]) => {
|
||||
this.workspaces = list;
|
||||
|
||||
if (list.length > 0 && !this.target.azureLogAnalytics.workspace) {
|
||||
this.target.azureLogAnalytics.workspace = list[0].value;
|
||||
if (this.datasource.azureLogAnalyticsDatasource.defaultOrFirstWorkspace) {
|
||||
this.target.azureLogAnalytics.workspace = this.datasource.azureLogAnalyticsDatasource.defaultOrFirstWorkspace;
|
||||
}
|
||||
|
||||
if (!this.target.azureLogAnalytics.workspace) {
|
||||
this.target.azureLogAnalytics.workspace = list[0].value;
|
||||
}
|
||||
}
|
||||
|
||||
return this.workspaces;
|
||||
})
|
||||
.catch(this.handleQueryCtrlError.bind(this));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user