Dashboard Minor code cleanup (#894)

* minor code clean up for dashboard

* formatting
This commit is contained in:
Anthony Dresser
2018-03-13 13:21:21 -07:00
committed by GitHub
parent 64f61b2954
commit 383d74ceb4
8 changed files with 56 additions and 78 deletions

View File

@@ -12,11 +12,12 @@ import { DashboardServiceInterface } from './services/dashboardServiceInterface.
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import * as Utils from 'sql/parts/connection/common/utils';
import { RefreshWidgetAction, EditDashboardAction } from 'sql/parts/dashboard/common/actions';
import { DashboardPage } from 'sql/parts/dashboard/common/dashboardPage.component';
import { AngularDisposable } from 'sql/base/common/lifecycle';
import { IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IDisposable } from 'vs/base/common/lifecycle';
import * as themeColors from 'vs/workbench/common/theme';
import { DashboardPage } from 'sql/parts/dashboard/common/dashboardPage.component';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
export const DASHBOARD_SELECTOR: string = 'dashboard-component';
@@ -25,8 +26,7 @@ export const DASHBOARD_SELECTOR: string = 'dashboard-component';
selector: DASHBOARD_SELECTOR,
templateUrl: decodeURI(require.toUrl('./dashboard.component.html'))
})
export class DashboardComponent implements OnInit, OnDestroy {
private _subs: Array<IDisposable> = new Array();
export class DashboardComponent extends AngularDisposable implements OnInit {
private _currentPage: DashboardPage;
@ViewChild('header', { read: ElementRef }) private header: ElementRef;
@@ -39,10 +39,12 @@ export class DashboardComponent implements OnInit, OnDestroy {
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrapService: DashboardServiceInterface,
@Inject(forwardRef(() => Router)) private _router: Router,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef
) { }
) {
super();
}
ngOnInit() {
this._subs.push(this._bootstrapService.themeService.onDidColorThemeChange(this.updateTheme, this));
this._register(this._bootstrapService.themeService.onDidColorThemeChange(this.updateTheme, this));
this.updateTheme(this._bootstrapService.themeService.getColorTheme());
let profile: IConnectionProfile = this._bootstrapService.getOriginalConnectionProfile();
this.actionbar = new ActionBar(this.actionbarContainer.nativeElement);
@@ -61,12 +63,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
}
}
ngOnDestroy() {
this._subs.forEach((value) => {
value.dispose();
});
}
private updateTheme(theme: IColorTheme): void {
let headerEl = <HTMLElement>this.header.nativeElement;
headerEl.style.borderBottomColor = theme.getColor(themeColors.SIDE_BAR_BACKGROUND, true).toString();