Kindsys: Rename mudball to common schemas, allow multiple input cue files (#61703)

* kindsys: Rename mudball to common schemas

* Update all core plugin imports

* Add missed table types

* Remove invalid JSON comment

* Remove coremodel dir from codeowners
This commit is contained in:
sam boyer
2023-01-18 17:40:22 +00:00
committed by GitHub
parent ef6d73e575
commit 492bdbd585
24 changed files with 192 additions and 263 deletions
@@ -0,0 +1,591 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
//
// Generated by:
// kinds/gen.go
// Using jennies:
// CommonSchemaJenny
//
// Run 'make gen-cue' from repository root to regenerate.
/**
* TODO docs
*/
export enum AxisPlacement {
Auto = 'auto',
Bottom = 'bottom',
Hidden = 'hidden',
Left = 'left',
Right = 'right',
Top = 'top',
}
/**
* TODO docs
*/
export enum AxisColorMode {
Series = 'series',
Text = 'text',
}
/**
* TODO docs
*/
export enum VisibilityMode {
Always = 'always',
Auto = 'auto',
Never = 'never',
}
/**
* TODO docs
*/
export enum GraphDrawStyle {
Bars = 'bars',
Line = 'line',
Points = 'points',
}
/**
* TODO docs
*/
export enum GraphTransform {
Constant = 'constant',
NegativeY = 'negative-Y',
}
/**
* TODO docs
*/
export enum LineInterpolation {
Linear = 'linear',
Smooth = 'smooth',
StepAfter = 'stepAfter',
StepBefore = 'stepBefore',
}
/**
* TODO docs
*/
export enum ScaleDistribution {
Linear = 'linear',
Log = 'log',
Ordinal = 'ordinal',
Symlog = 'symlog',
}
/**
* TODO docs
*/
export enum GraphGradientMode {
Hue = 'hue',
None = 'none',
Opacity = 'opacity',
Scheme = 'scheme',
}
/**
* TODO docs
*/
export enum StackingMode {
None = 'none',
Normal = 'normal',
Percent = 'percent',
}
/**
* TODO docs
*/
export enum BarAlignment {
After = 1,
Before = -1,
Center = 0,
}
/**
* TODO docs
*/
export enum ScaleOrientation {
Horizontal = 0,
Vertical = 1,
}
/**
* TODO docs
*/
export enum ScaleDirection {
Down = -1,
Left = -1,
Right = 1,
Up = 1,
}
/**
* TODO docs
*/
export interface LineStyle {
dash?: Array<number>;
fill?: ('solid' | 'dash' | 'dot' | 'square');
}
export const defaultLineStyle: Partial<LineStyle> = {
dash: [],
};
/**
* TODO docs
*/
export interface LineConfig {
lineColor?: string;
lineInterpolation?: LineInterpolation;
lineStyle?: LineStyle;
lineWidth?: number;
/**
* Indicate if null values should be treated as gaps or connected.
* When the value is a number, it represents the maximum delta in the
* X axis that should be considered connected. For timeseries, this is milliseconds
*/
spanNulls?: (boolean | number);
}
/**
* TODO docs
*/
export interface BarConfig {
barAlignment?: BarAlignment;
barMaxWidth?: number;
barWidthFactor?: number;
}
/**
* TODO docs
*/
export interface FillConfig {
fillBelowTo?: string;
fillColor?: string;
fillOpacity?: number;
}
/**
* TODO docs
*/
export interface PointsConfig {
pointColor?: string;
pointSize?: number;
pointSymbol?: string;
showPoints?: VisibilityMode;
}
/**
* TODO docs
*/
export interface ScaleDistributionConfig {
linearThreshold?: number;
log?: number;
type: ScaleDistribution;
}
/**
* TODO docs
*/
export interface AxisConfig {
axisCenteredZero?: boolean;
axisColorMode?: AxisColorMode;
axisGridShow?: boolean;
axisLabel?: string;
axisPlacement?: AxisPlacement;
axisSoftMax?: number;
axisSoftMin?: number;
axisWidth?: number;
scaleDistribution?: ScaleDistributionConfig;
}
/**
* TODO docs
*/
export interface HideSeriesConfig {
legend: boolean;
tooltip: boolean;
viz: boolean;
}
/**
* TODO docs
*/
export interface StackingConfig {
group?: string;
mode?: StackingMode;
}
/**
* TODO docs
*/
export interface StackableFieldConfig {
stacking?: StackingConfig;
}
/**
* TODO docs
*/
export interface HideableFieldConfig {
hideFrom?: HideSeriesConfig;
}
/**
* TODO docs
*/
export enum GraphTresholdsStyleMode {
Area = 'area',
Dashed = 'dashed',
DashedAndArea = 'dashed+area',
Line = 'line',
LineAndArea = 'line+area',
Off = 'off',
Series = 'series',
}
/**
* TODO docs
*/
export interface GraphThresholdsStyleConfig {
mode: GraphTresholdsStyleMode;
}
/**
* TODO docs
*/
export type LegendPlacement = ('bottom' | 'right');
/**
* TODO docs
* Note: "hidden" needs to remain as an option for plugins compatibility
*/
export enum LegendDisplayMode {
Hidden = 'hidden',
List = 'list',
Table = 'table',
}
/**
* TODO docs
*/
export interface SingleStatBaseOptions extends OptionsWithTextFormatting {
orientation: VizOrientation;
reduceOptions: ReduceDataOptions;
}
/**
* TODO docs
*/
export interface ReduceDataOptions {
/**
* When !values, pick one value for the whole field
*/
calcs: Array<string>;
/**
* Which fields to show. By default this is only numeric fields
*/
fields?: string;
/**
* if showing all values limit
*/
limit?: number;
/**
* If true show each row value
*/
values?: boolean;
}
export const defaultReduceDataOptions: Partial<ReduceDataOptions> = {
calcs: [],
};
/**
* TODO docs
*/
export enum VizOrientation {
Auto = 'auto',
Horizontal = 'horizontal',
Vertical = 'vertical',
}
/**
* TODO docs
*/
export interface OptionsWithTooltip {
tooltip: VizTooltipOptions;
}
/**
* TODO docs
*/
export interface OptionsWithLegend {
legend: VizLegendOptions;
}
/**
* TODO docs
*/
export interface OptionsWithTimezones {
timezone?: Array<TimeZone>;
}
export const defaultOptionsWithTimezones: Partial<OptionsWithTimezones> = {
timezone: [],
};
/**
* TODO docs
*/
export interface OptionsWithTextFormatting {
text?: VizTextDisplayOptions;
}
/**
* TODO docs
*/
export enum BigValueColorMode {
Background = 'background',
None = 'none',
Value = 'value',
}
/**
* TODO docs
*/
export enum BigValueGraphMode {
Area = 'area',
Line = 'line',
None = 'none',
}
/**
* TODO docs
*/
export enum BigValueJustifyMode {
Auto = 'auto',
Center = 'center',
}
/**
* TODO docs
*/
export enum BigValueTextMode {
Auto = 'auto',
Name = 'name',
None = 'none',
Value = 'value',
ValueAndName = 'value_and_name',
}
/**
* TODO -- should not be table specific!
* TODO docs
*/
export type FieldTextAlignment = ('auto' | 'left' | 'right' | 'center');
/**
* TODO docs
*/
export interface VizTextDisplayOptions {
/**
* Explicit title text size
*/
titleSize?: number;
/**
* Explicit value text size
*/
valueSize?: number;
}
/**
* TODO docs
*/
export enum TooltipDisplayMode {
Multi = 'multi',
None = 'none',
Single = 'single',
}
/**
* TODO docs
*/
export enum SortOrder {
Ascending = 'asc',
Descending = 'desc',
None = 'none',
}
/**
* TODO docs
*/
export interface GraphFieldConfig extends LineConfig, FillConfig, PointsConfig, AxisConfig, BarConfig, StackableFieldConfig, HideableFieldConfig {
drawStyle?: GraphDrawStyle;
gradientMode?: GraphGradientMode;
thresholdsStyle?: GraphThresholdsStyleConfig;
transform?: GraphTransform;
}
/**
* TODO docs
*/
export interface VizLegendOptions {
asTable?: boolean;
calcs: Array<string>;
displayMode: LegendDisplayMode;
isVisible?: boolean;
placement: LegendPlacement;
showLegend: boolean;
sortBy?: string;
sortDesc?: boolean;
width?: number;
}
export const defaultVizLegendOptions: Partial<VizLegendOptions> = {
calcs: [],
};
/**
* Enum expressing the possible display modes
* for the bar gauge component of Grafana UI
*/
export enum BarGaugeDisplayMode {
Basic = 'basic',
Gradient = 'gradient',
Lcd = 'lcd',
}
/**
* Internally, this is the "type" of cell that's being displayed
* in the table such as colored text, JSON, gauge, etc.
* The color-background-solid, gradient-gauge, and lcd-gauge
* modes are deprecated in favor of new cell subOptions
*/
export enum TableCellDisplayMode {
Auto = 'auto',
BasicGauge = 'basic',
ColorBackground = 'color-background',
ColorBackgroundSolid = 'color-background-solid',
ColorText = 'color-text',
Gauge = 'gauge',
GradientGauge = 'gradient-gauge',
Image = 'image',
JSONView = 'json-view',
LcdGauge = 'lcd-gauge',
}
/**
* Display mode to the "Colored Background" display
* mode for table cells. Either displays a solid color (basic mode)
* or a gradient.
*/
export enum TableCellBackgroundDisplayMode {
Basic = 'basic',
Gradient = 'gradient',
}
/**
* TODO docs
*/
export interface TableSortByFieldState {
desc?: boolean;
displayName: string;
}
/**
* Auto mode table cell options
*/
export interface TableAutoCellOptions {
type: TableCellDisplayMode.Auto;
}
/**
* Colored text cell options
*/
export interface TableColorTextCellOptions {
type: TableCellDisplayMode.ColorText;
}
/**
* Json view cell options
*/
export interface TableJsonViewCellOptions {
type: TableCellDisplayMode.JSONView;
}
/**
* Json view cell options
*/
export interface TableImageCellOptions {
type: TableCellDisplayMode.Image;
}
/**
* Gauge cell options
*/
export interface TableBarGaugeCellOptions {
mode?: BarGaugeDisplayMode;
type: TableCellDisplayMode.Gauge;
}
/**
* Colored background cell options
*/
export interface TableColoredBackgroundCellOptions {
mode?: TableCellBackgroundDisplayMode;
type: TableCellDisplayMode.ColorBackground;
}
/**
* Table cell options. Each cell has a display mode
* and other potential options for that display.
*/
export type TableCellOptions = (TableAutoCellOptions | TableBarGaugeCellOptions | TableColoredBackgroundCellOptions | TableColorTextCellOptions | TableImageCellOptions | TableJsonViewCellOptions);
/**
* Use UTC/GMT timezone
*/
export type TimeZoneUtc = 'utc';
/**
* Use the timezone defined by end user web browser
*/
export type TimeZoneBrowser = 'browser';
/**
* TODO docs
*/
export interface VizTooltipOptions {
mode: TooltipDisplayMode;
sort: SortOrder;
}
/**
* Field options for each field within a table (e.g 10, "The String", 64.20, etc.)
* Generally defines alignment, filtering capabilties, display options, etc.
*/
export interface TableFieldOptions {
align: FieldTextAlignment;
cellOptions: TableCellOptions;
/**
* This field is deprecated in favor of using cellOptions
*/
displayMode?: TableCellDisplayMode;
filterable?: boolean;
hidden?: boolean;
inspect: boolean;
minWidth?: number;
width?: number;
}
export const defaultTableFieldOptions: Partial<TableFieldOptions> = {
align: 'auto',
inspect: false,
};
/**
* A specific timezone from https://en.wikipedia.org/wiki/Tz_database
*/
export type TimeZone = (TimeZoneUtc | TimeZoneBrowser | string);
export const defaultTimeZone: TimeZone = 'browser';
@@ -0,0 +1,248 @@
package common
// TODO break this up into individual files. Current limitation on this is codegen logic, imports, dependencies
// TODO docs
AxisPlacement: "auto" | "top" | "right" | "bottom" | "left" | "hidden" @cuetsy(kind="enum")
// TODO docs
AxisColorMode: "text" | "series" @cuetsy(kind="enum")
// TODO docs
VisibilityMode: "auto" | "never" | "always" @cuetsy(kind="enum")
// TODO docs
GraphDrawStyle: "line" | "bars" | "points" @cuetsy(kind="enum")
// TODO docs
GraphTransform: "constant" | "negative-Y" @cuetsy(kind="enum",memberNames="Constant|NegativeY")
// TODO docs
LineInterpolation: "linear" | "smooth" | "stepBefore" | "stepAfter" @cuetsy(kind="enum")
// TODO docs
ScaleDistribution: "linear" | "log" | "ordinal" | "symlog" @cuetsy(kind="enum")
// TODO docs
GraphGradientMode: "none" | "opacity" | "hue" | "scheme" @cuetsy(kind="enum")
// TODO docs
StackingMode: "none" | "normal" | "percent" @cuetsy(kind="enum")
// TODO docs
BarAlignment: -1 | 0 | 1 @cuetsy(kind="enum",memberNames="Before|Center|After")
// TODO docs
ScaleOrientation: 0 | 1 @cuetsy(kind="enum",memberNames="Horizontal|Vertical")
// TODO docs
ScaleDirection: 1 | 1 | -1 | -1 @cuetsy(kind="enum",memberNames="Up|Right|Down|Left")
// TODO docs
LineStyle: {
fill?: "solid" | "dash" | "dot" | "square"
dash?: [...number]
} @cuetsy(kind="interface")
// TODO docs
LineConfig: {
lineColor?: string
lineWidth?: number
lineInterpolation?: LineInterpolation
lineStyle?: LineStyle
// Indicate if null values should be treated as gaps or connected.
// When the value is a number, it represents the maximum delta in the
// X axis that should be considered connected. For timeseries, this is milliseconds
spanNulls?: bool | number
} @cuetsy(kind="interface")
// TODO docs
BarConfig: {
barAlignment?: BarAlignment
barWidthFactor?: number
barMaxWidth?: number
} @cuetsy(kind="interface")
// TODO docs
FillConfig: {
fillColor?: string
fillOpacity?: number
fillBelowTo?: string
} @cuetsy(kind="interface")
// TODO docs
PointsConfig: {
showPoints?: VisibilityMode
pointSize?: number
pointColor?: string
pointSymbol?: string
} @cuetsy(kind="interface")
// TODO docs
ScaleDistributionConfig: {
type: ScaleDistribution
log?: number
linearThreshold?: number
} @cuetsy(kind="interface")
// TODO docs
AxisConfig: {
axisPlacement?: AxisPlacement
axisColorMode?: AxisColorMode
axisLabel?: string
axisWidth?: number
axisSoftMin?: number
axisSoftMax?: number
axisGridShow?: bool
scaleDistribution?: ScaleDistributionConfig
axisCenteredZero?: bool
} @cuetsy(kind="interface")
// TODO docs
HideSeriesConfig: {
tooltip: bool
legend: bool
viz: bool
} @cuetsy(kind="interface")
// TODO docs
StackingConfig: {
mode?: StackingMode
group?: string
} @cuetsy(kind="interface")
// TODO docs
StackableFieldConfig: {
stacking?: StackingConfig
} @cuetsy(kind="interface")
// TODO docs
HideableFieldConfig: {
hideFrom?: HideSeriesConfig
} @cuetsy(kind="interface")
// TODO docs
GraphTresholdsStyleMode: "off" | "line" | "dashed" | "area" | "line+area" | "dashed+area" | "series" @cuetsy(kind="enum",memberNames="Off|Line|Dashed|Area|LineAndArea|DashedAndArea|Series")
// TODO docs
GraphThresholdsStyleConfig: {
mode: GraphTresholdsStyleMode
} @cuetsy(kind="interface")
// TODO docs
LegendPlacement: "bottom" | "right" @cuetsy(kind="type")
// TODO docs
// Note: "hidden" needs to remain as an option for plugins compatibility
LegendDisplayMode: "list" | "table" | "hidden" @cuetsy(kind="enum")
// TODO docs
SingleStatBaseOptions: {
OptionsWithTextFormatting
reduceOptions: ReduceDataOptions
orientation: VizOrientation
} @cuetsy(kind="interface")
// TODO docs
ReduceDataOptions: {
// If true show each row value
values?: bool
// if showing all values limit
limit?: number
// When !values, pick one value for the whole field
calcs: [...string]
// Which fields to show. By default this is only numeric fields
fields?: string
} @cuetsy(kind="interface")
// TODO docs
VizOrientation: "auto" | "vertical" | "horizontal" @cuetsy(kind="enum")
// TODO docs
OptionsWithTooltip: {
tooltip: VizTooltipOptions
} @cuetsy(kind="interface")
// TODO docs
OptionsWithLegend: {
legend: VizLegendOptions
} @cuetsy(kind="interface")
// TODO docs
OptionsWithTimezones: {
timezone?: [...TimeZone]
} @cuetsy(kind="interface")
// TODO docs
OptionsWithTextFormatting: {
text?: VizTextDisplayOptions
} @cuetsy(kind="interface")
// TODO docs
BigValueColorMode: "value" | "background" | "none" @cuetsy(kind="enum")
// TODO docs
BigValueGraphMode: "none" | "line" | "area" @cuetsy(kind="enum")
// TODO docs
BigValueJustifyMode: "auto" | "center" @cuetsy(kind="enum")
// TODO docs
BigValueTextMode: "auto" | "value" | "value_and_name" | "name" | "none" @cuetsy(kind="enum",memberNames="Auto|Value|ValueAndName|Name|None")
// TODO -- should not be table specific!
// TODO docs
FieldTextAlignment: "auto" | "left" | "right" | "center" @cuetsy(kind="type")
// TODO docs
VizTextDisplayOptions: {
// Explicit title text size
titleSize?: number
// Explicit value text size
valueSize?: number
} @cuetsy(kind="interface")
// TODO docs
TooltipDisplayMode: "single" | "multi" | "none" @cuetsy(kind="enum")
// TODO docs
SortOrder: "asc" | "desc" | "none" @cuetsy(kind="enum",memberNames="Ascending|Descending|None")
// TODO docs
GraphFieldConfig: {
LineConfig
FillConfig
PointsConfig
AxisConfig
BarConfig
StackableFieldConfig
HideableFieldConfig
drawStyle?: GraphDrawStyle
gradientMode?: GraphGradientMode
thresholdsStyle?: GraphThresholdsStyleConfig
transform?: GraphTransform
} @cuetsy(kind="interface")
// TODO docs
VizLegendOptions: {
displayMode: LegendDisplayMode
placement: LegendPlacement
showLegend: bool
asTable?: bool
isVisible?: bool
sortBy?: string
sortDesc?: bool
width?: number
calcs: [...string]
} @cuetsy(kind="interface")
// Enum expressing the possible display modes
// for the bar gauge component of Grafana UI
BarGaugeDisplayMode: "basic" | "lcd" | "gradient" @cuetsy(kind="enum")
// TODO docs
VizTooltipOptions: {
mode: TooltipDisplayMode
sort: SortOrder
} @cuetsy(kind="interface")
@@ -0,0 +1,69 @@
package common
// Internally, this is the "type" of cell that's being displayed
// in the table such as colored text, JSON, gauge, etc.
// The color-background-solid, gradient-gauge, and lcd-gauge
// modes are deprecated in favor of new cell subOptions
TableCellDisplayMode: "auto" | "color-text" | "color-background" | "color-background-solid" | "gradient-gauge" | "lcd-gauge" | "json-view" | "basic" | "image" | "gauge" @cuetsy(kind="enum",memberNames="Auto|ColorText|ColorBackground|ColorBackgroundSolid|GradientGauge|LcdGauge|JSONView|BasicGauge|Image|Gauge")
// Display mode to the "Colored Background" display
// mode for table cells. Either displays a solid color (basic mode)
// or a gradient.
TableCellBackgroundDisplayMode: "basic" | "gradient" @cuetsy(kind="enum",memberNames="Basic|Gradient")
// TODO docs
TableSortByFieldState: {
displayName: string
desc?: bool
} @cuetsy(kind="interface")
// Auto mode table cell options
TableAutoCellOptions: {
type: TableCellDisplayMode & "auto"
} @cuetsy(kind="interface")
// Colored text cell options
TableColorTextCellOptions: {
type: TableCellDisplayMode & "color-text"
} @cuetsy(kind="interface")
// Json view cell options
TableJsonViewCellOptions: {
type: TableCellDisplayMode & "json-view"
} @cuetsy(kind="interface")
// Json view cell options
TableImageCellOptions: {
type: TableCellDisplayMode & "image"
} @cuetsy(kind="interface")
// Gauge cell options
TableBarGaugeCellOptions: {
type: TableCellDisplayMode & "gauge"
mode?: BarGaugeDisplayMode
} @cuetsy(kind="interface")
// Colored background cell options
TableColoredBackgroundCellOptions: {
type: TableCellDisplayMode & "color-background"
mode?: TableCellBackgroundDisplayMode
} @cuetsy(kind="interface")
// Table cell options. Each cell has a display mode
// and other potential options for that display.
TableCellOptions: TableAutoCellOptions | TableBarGaugeCellOptions | TableColoredBackgroundCellOptions | TableColorTextCellOptions | TableImageCellOptions | TableJsonViewCellOptions @cuetsy(kind="type")
// Field options for each field within a table (e.g 10, "The String", 64.20, etc.)
// Generally defines alignment, filtering capabilties, display options, etc.
TableFieldOptions: {
width?: number
minWidth?: number
align: FieldTextAlignment | *"auto"
// This field is deprecated in favor of using cellOptions
displayMode?: TableCellDisplayMode
cellOptions: TableCellOptions
hidden?: bool // ?? default is missing or false ??
inspect: bool | *false
filterable?: bool
} @cuetsy(kind="interface")
@@ -0,0 +1,10 @@
package common
// Use UTC/GMT timezone
TimeZoneUtc: "utc" @cuetsy(kind="type")
// Use the timezone defined by end user web browser
TimeZoneBrowser: "browser" @cuetsy(kind="type")
// A specific timezone from https://en.wikipedia.org/wiki/Tz_database
TimeZone: TimeZoneUtc | TimeZoneBrowser | string | *"browser" @cuetsy(kind="type")