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:
Shavonn Brown
2019-12-13 11:03:08 -05:00
committed by GitHub
parent c14398edc8
commit f65da93d72
3 changed files with 16 additions and 3 deletions

View File

@@ -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));
};