Files
azuredatastudio/src/sql/workbench/parts/dashboard/common/dashboardWidget.ts
Anthony Dresser 8bdcc3267a Code Layering dashboard (#4883)
* move dashboard to workbench

* revert xlf file changes

* 💄

* 💄

* add back removed functions
2019-04-09 00:26:57 -07:00

73 lines
1.9 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 { InjectionToken, OnDestroy } from '@angular/core';
import { NgGridItemConfig } from 'angular2-grid';
import { Action } from 'vs/base/common/actions';
import { Disposable } from 'vs/base/common/lifecycle';
import { IDashboardTab } from 'sql/platform/dashboard/common/dashboardRegistry';
export interface IDashboardWidget {
actions: Array<Action>;
actionsContext?: any;
refresh?: () => void;
layout?: () => void;
}
export const WIDGET_CONFIG = new InjectionToken<WidgetConfig>('widget_config');
export interface WidgetConfig {
id?: string; // used to track the widget lifespan operations
name?: string;
icon?: string;
context: string;
provider: string | Array<string>;
edition: number | Array<number>;
when?: string;
gridItemConfig?: NgGridItemConfig;
widget: Object;
background_color?: string;
border?: string;
fontSize?: string;
fontWeight?: string;
padding?: string;
}
export interface TabConfig extends IDashboardTab {
context: string;
originalConfig: Array<WidgetConfig>;
editable: boolean;
canClose: boolean;
actions?: Array<Action>;
iconClass?: string;
}
export type IUserFriendlyIcon = string | { light: string; dark: string; };
export interface NavSectionConfig {
id: string;
title: string;
iconClass?: string;
icon?: IUserFriendlyIcon;
container: object;
}
export interface TabSettingConfig {
tabId: string;
isPinned: boolean;
}
export abstract class DashboardWidget extends Disposable implements OnDestroy {
protected _config: WidgetConfig;
get actions(): Array<Action> {
return [];
}
ngOnDestroy() {
this.dispose();
}
}