mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-15 01:25:36 -05:00
* working on formatting * fixed basic lint errors; starting moving things to their appropriate location * formatting * update tslint to match the version of vscode we have * remove unused code * work in progress fixing layering * formatting * moved connection management service to platform * formatting * add missing file * moving more servies * formatting * moving more services * formatting * wip * moving more services * formatting * revert back tslint rules * move css file * add missing svgs
76 lines
2.2 KiB
TypeScript
76 lines
2.2 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import 'vs/css!./dashboardWidgetContainer';
|
|
|
|
import { Component, Inject, Input, forwardRef, ViewChild, OnDestroy, ChangeDetectorRef, AfterContentInit } from '@angular/core';
|
|
|
|
import { TabConfig, WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
|
import { DashboardTab } from 'sql/parts/dashboard/common/interfaces';
|
|
import { WidgetContent } from 'sql/parts/dashboard/contents/widgetContent.component';
|
|
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
|
|
|
import { Event, Emitter } from 'vs/base/common/event';
|
|
|
|
@Component({
|
|
selector: 'dashboard-widget-container',
|
|
providers: [{ provide: TabChild, useExisting: forwardRef(() => DashboardWidgetContainer) }],
|
|
template: `
|
|
<widget-content [widgets]="widgets" [originalConfig]="tab.originalConfig" [context]="tab.context">
|
|
</widget-content>
|
|
`
|
|
})
|
|
export class DashboardWidgetContainer extends DashboardTab implements OnDestroy, AfterContentInit {
|
|
@Input() protected tab: TabConfig;
|
|
protected widgets: WidgetConfig[];
|
|
private _onResize = new Emitter<void>();
|
|
public readonly onResize: Event<void> = this._onResize.event;
|
|
|
|
@ViewChild(WidgetContent) protected _widgetContent: WidgetContent;
|
|
|
|
constructor(
|
|
@Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef
|
|
) {
|
|
super();
|
|
}
|
|
|
|
ngOnInit() {
|
|
if (this.tab.container) {
|
|
this.widgets = Object.values(this.tab.container)[0];
|
|
this._cd.detectChanges();
|
|
}
|
|
}
|
|
|
|
ngAfterContentInit(): void {
|
|
this._register(this._widgetContent.onResize(() => {
|
|
this._onResize.fire();
|
|
}));
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
this.dispose();
|
|
}
|
|
|
|
public get id(): string {
|
|
return this.tab.id;
|
|
}
|
|
|
|
public get editable(): boolean {
|
|
return this.tab.editable;
|
|
}
|
|
|
|
public layout() {
|
|
this._widgetContent.layout();
|
|
}
|
|
|
|
public refresh(): void {
|
|
this._widgetContent.refresh();
|
|
}
|
|
|
|
public enableEdit(): void {
|
|
this._widgetContent.enableEdit();
|
|
}
|
|
}
|