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

@@ -15,6 +15,7 @@ import { WidgetConfig, WIDGET_CONFIG, IDashboardWidget } from 'sql/parts/dashboa
import { Extensions, IInsightRegistry } from 'sql/platform/dashboard/common/insightRegistry';
import { error } from 'sql/base/common/log';
import { RefreshWidgetAction, ToggleMoreWidgetAction, DeleteWidgetAction, CollapseWidgetAction } from 'sql/parts/dashboard/common/actions';
import { AngularDisposable } from 'sql/base/common/lifecycle';
/* Widgets */
import { PropertiesWidgetComponent } from 'sql/parts/dashboard/widgets/properties/propertiesWidget.component';
@@ -47,7 +48,7 @@ const componentMap: { [x: string]: Type<IDashboardWidget> } = {
selector: 'dashboard-widget-wrapper',
templateUrl: decodeURI(require.toUrl('sql/parts/dashboard/contents/dashboardWidgetWrapper.component.html'))
})
export class DashboardWidgetWrapper implements OnInit, OnDestroy {
export class DashboardWidgetWrapper extends AngularDisposable implements OnInit {
@Input() private _config: WidgetConfig;
@Input() private collapsable = false;
@@ -73,7 +74,6 @@ export class DashboardWidgetWrapper implements OnInit, OnDestroy {
return generateUuid();
}
private _themeDispose: IDisposable;
private _actions: Array<Action>;
private _component: IDashboardWidget;
private _actionbar: ActionBar;
@@ -88,13 +88,15 @@ export class DashboardWidgetWrapper implements OnInit, OnDestroy {
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrap: DashboardServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeref: ChangeDetectorRef,
@Inject(forwardRef(() => Injector)) private _injector: Injector
) { }
) {
super();
}
ngOnInit() {
let self = this;
self._themeDispose = self._bootstrap.themeService.onDidColorThemeChange((event: IColorTheme) => {
this._register(self._bootstrap.themeService.onDidColorThemeChange((event: IColorTheme) => {
self.updateTheme(event);
});
}));
}
ngAfterViewInit() {
@@ -113,10 +115,6 @@ export class DashboardWidgetWrapper implements OnInit, OnDestroy {
this.layout();
}
ngOnDestroy() {
this._themeDispose.dispose();
}
public refresh(): void {
if (this._component && this._component.refresh) {
this._component.refresh();