models.gen.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. import { TableCellDisplayMode, TableSortByFieldState } from '@grafana/ui';
  6. import { TableFieldOptions } from '@grafana/schema';
  7. // Only the latest schema version is translated to TypeScript, on the premise
  8. // that either the dashboard loading process, or (eventually) CUE-defined
  9. // migrations ensure that bulk of the frontend application only ever
  10. // need directly consider the most recent version of the schema.
  11. export const modelVersion = Object.freeze([1, 0]);
  12. export interface PanelOptions {
  13. frameIndex: number;
  14. showHeader: boolean;
  15. showTypeIcons?: boolean;
  16. sortBy?: TableSortByFieldState[];
  17. footer?: TableFooterCalc; // TODO: should be array (options builder is limited)
  18. }
  19. export interface TableFooterCalc {
  20. show: boolean;
  21. reducer: string[]; // actually 1 value
  22. fields?: string[];
  23. enablePagination?: boolean;
  24. }
  25. export const defaultPanelOptions: PanelOptions = {
  26. frameIndex: 0,
  27. showHeader: true,
  28. showTypeIcons: false,
  29. footer: {
  30. show: false,
  31. reducer: [],
  32. },
  33. };
  34. export const defaultPanelFieldConfig: TableFieldOptions = {
  35. displayMode: TableCellDisplayMode.Auto,
  36. align: 'auto',
  37. inspect: false,
  38. };