UNPKG

1.37 kBTypeScriptView Raw
1import { IMetric } from './metric-types';
2/**
3 * The width of the grid we're filling
4 */
5export declare const GRID_WIDTH = 24;
6/**
7 * A single dashboard widget
8 */
9export interface IWidget {
10 /**
11 * The amount of horizontal grid units the widget will take up
12 */
13 readonly width: number;
14 /**
15 * The amount of vertical grid units the widget will take up
16 */
17 readonly height: number;
18 /**
19 * Any warnings that are produced as a result of putting together this widget
20 */
21 readonly warnings?: string[];
22 /**
23 * Place the widget at a given position
24 */
25 position(x: number, y: number): void;
26 /**
27 * Return the widget JSON for use in the dashboard
28 */
29 toJson(): any[];
30}
31/**
32 * A real CloudWatch widget that has its own fixed size and remembers its position
33 *
34 * This is in contrast to other widgets which exist for layout purposes.
35 */
36export declare abstract class ConcreteWidget implements IWidget {
37 readonly width: number;
38 readonly height: number;
39 protected x?: number;
40 protected y?: number;
41 readonly warnings: string[] | undefined;
42 constructor(width: number, height: number);
43 position(x: number, y: number): void;
44 abstract toJson(): any[];
45 /**
46 * Copy the warnings from the given metric
47 */
48 protected copyMetricWarnings(...ms: IMetric[]): void;
49}