1//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2// NOTE: This file will be auto generated from models.cue
3// It is currenty hand written but will serve as the target for cuetsy
4//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
6import { TableCellDisplayMode, TableSortByFieldState } from '@grafana/ui';
7import { TableFieldOptions } from '@grafana/schema';
8
9// Only the latest schema version is translated to TypeScript, on the premise
10// that either the dashboard loading process, or (eventually) CUE-defined
11// migrations ensure that bulk of the frontend application only ever
12// need directly consider the most recent version of the schema.
13export const modelVersion = Object.freeze([1, 0]);
14
15export interface PanelOptions {
16  frameIndex: number;
17  showHeader: boolean;
18  showTypeIcons?: boolean;
19  sortBy?: TableSortByFieldState[];
20  footer?: TableFooterCalc; // TODO: should be array (options builder is limited)
21}
22
23export interface TableFooterCalc {
24  show: boolean;
25  reducer: string[]; // actually 1 value
26  fields?: string[];
27}
28
29export const defaultPanelOptions: PanelOptions = {
30  frameIndex: 0,
31  showHeader: true,
32  showTypeIcons: false,
33  footer: {
34    show: false,
35    reducer: [],
36  },
37};
38
39export const defaultPanelFieldConfig: TableFieldOptions = {
40  displayMode: TableCellDisplayMode.Auto,
41  align: 'auto',
42};
43