Add close method to ModelView dashboards (#14812)

* Add close method to ModelView dashboards

* fix closing

* remove accessors

* Update errors
This commit is contained in:
Charles Gagnon
2021-03-22 10:17:16 -07:00
committed by GitHub
parent 98ba49304e
commit 72295d46c2
24 changed files with 95 additions and 51 deletions

View File

@@ -7,7 +7,7 @@ import * as azdata from 'azdata';
export abstract class Dashboard {
private dashboard!: azdata.window.ModelViewDashboard;
protected dashboard!: azdata.window.ModelViewDashboard;
constructor(protected title: string, protected readonly name: string) { }
@@ -16,6 +16,10 @@ export abstract class Dashboard {
await this.dashboard.open();
}
public async closeDashboard(): Promise<void> {
await this.dashboard.close();
}
protected createDashboard(): azdata.window.ModelViewDashboard {
const dashboard = azdata.window.createModelViewDashboard(this.title, this.name);
dashboard.registerTabs(async modelView => {

View File

@@ -11,7 +11,7 @@ export abstract class DashboardPage extends InitializingComponent {
protected disposables: vscode.Disposable[] = [];
constructor(protected modelView: azdata.ModelView) {
constructor(protected modelView: azdata.ModelView, protected dashboard: azdata.window.ModelViewDashboard) {
super();
this.disposables.push(modelView.onClosed(() => {
// Clean up best we can