[v10.0.x] Schema: Fix dimension schemas (#67943)
Schema: Fix dimension schemas (#67935)
(cherry picked from commit 854d497f94)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
co-authored by
Ryan McKinley
parent
5b2175f958
commit
d53599bdce
@@ -52,19 +52,39 @@ export interface DataQuery {
|
||||
}
|
||||
|
||||
export interface BaseDimensionConfig {
|
||||
/**
|
||||
* fixed: T -- will be added by each element
|
||||
*/
|
||||
field?: string;
|
||||
fixed: (string | number);
|
||||
}
|
||||
|
||||
export enum ScaleDimensionMode {
|
||||
Linear = 'linear',
|
||||
Quad = 'quad',
|
||||
}
|
||||
|
||||
export interface ScaleDimensionConfig extends BaseDimensionConfig {
|
||||
fixed?: number;
|
||||
max: number;
|
||||
min: number;
|
||||
mode?: ScaleDimensionMode; // | *"linear"
|
||||
}
|
||||
|
||||
/**
|
||||
* This is actually an empty interface used mainly for naming?
|
||||
*/
|
||||
export interface ColorDimensionConfig extends BaseDimensionConfig {}
|
||||
export interface ColorDimensionConfig extends BaseDimensionConfig {
|
||||
fixed?: string; // color value
|
||||
}
|
||||
|
||||
export enum ScalarDimensionMode {
|
||||
Clamped = 'clamped',
|
||||
Mod = 'mod',
|
||||
}
|
||||
|
||||
export interface ScalarDimensionConfig extends BaseDimensionConfig {
|
||||
fixed?: number;
|
||||
max: number;
|
||||
min: number;
|
||||
mode?: ScalarDimensionMode;
|
||||
}
|
||||
|
||||
export enum TextDimensionMode {
|
||||
Field = 'field',
|
||||
@@ -72,6 +92,17 @@ export enum TextDimensionMode {
|
||||
Template = 'template',
|
||||
}
|
||||
|
||||
export interface TextDimensionConfig extends BaseDimensionConfig {
|
||||
fixed?: string;
|
||||
mode: TextDimensionMode;
|
||||
}
|
||||
|
||||
export enum ResourceDimensionMode {
|
||||
Field = 'field',
|
||||
Fixed = 'fixed',
|
||||
Mapping = 'mapping',
|
||||
}
|
||||
|
||||
export interface MapLayerOptions {
|
||||
/**
|
||||
* Custom options depending on the type
|
||||
@@ -785,8 +816,12 @@ export interface DataSourceRef {
|
||||
uid?: string;
|
||||
}
|
||||
|
||||
export interface TextDimensionConfig extends BaseDimensionConfig {
|
||||
mode: TextDimensionMode;
|
||||
/**
|
||||
* Links to a resource (image/svg path)
|
||||
*/
|
||||
export interface ResourceDimensionConfig extends BaseDimensionConfig {
|
||||
fixed?: string;
|
||||
mode: ResourceDimensionMode;
|
||||
}
|
||||
|
||||
export interface FrameGeometrySource {
|
||||
|
||||
@@ -2,19 +2,32 @@ package common
|
||||
|
||||
BaseDimensionConfig: {
|
||||
field?: string
|
||||
fixed: string | number
|
||||
// fixed: T -- will be added by each element
|
||||
}@cuetsy(kind="interface")
|
||||
|
||||
ScaleDimensionMode: "linear" | "quad" @cuetsy(kind="enum")
|
||||
|
||||
ScaleDimensionConfig: {
|
||||
BaseDimensionConfig
|
||||
min: int32
|
||||
max: int32
|
||||
min: number
|
||||
max: number
|
||||
fixed?: number
|
||||
mode?: ScaleDimensionMode // | *"linear"
|
||||
}@cuetsy(kind="interface")
|
||||
|
||||
// This is actually an empty interface used mainly for naming?
|
||||
ColorDimensionConfig: {
|
||||
BaseDimensionConfig
|
||||
_empty: _
|
||||
fixed?: string // color value
|
||||
}@cuetsy(kind="interface")
|
||||
|
||||
ScalarDimensionMode: "mod" | "clamped" @cuetsy(kind="enum")
|
||||
|
||||
ScalarDimensionConfig: {
|
||||
BaseDimensionConfig
|
||||
min: number
|
||||
max: number
|
||||
fixed?: number
|
||||
mode?: ScalarDimensionMode
|
||||
}@cuetsy(kind="interface")
|
||||
|
||||
TextDimensionMode: "fixed" | "field" | "template" @cuetsy(kind="enum")
|
||||
@@ -22,4 +35,15 @@ TextDimensionMode: "fixed" | "field" | "template" @cuetsy(kind="enum")
|
||||
TextDimensionConfig: {
|
||||
BaseDimensionConfig
|
||||
mode: TextDimensionMode
|
||||
fixed?: string
|
||||
}@cuetsy(kind="interface")
|
||||
|
||||
ResourceDimensionMode: "fixed" | "field" | "mapping" @cuetsy(kind="enum")
|
||||
|
||||
// Links to a resource (image/svg path)
|
||||
ResourceDimensionConfig: {
|
||||
BaseDimensionConfig
|
||||
mode: ResourceDimensionMode
|
||||
fixed?: string
|
||||
}@cuetsy(kind="interface")
|
||||
|
||||
|
||||
@@ -23,10 +23,18 @@ export interface BaseDimensionConfig<T = string | number> extends Omit<raw.BaseD
|
||||
|
||||
export interface ScaleDimensionConfig extends BaseDimensionConfig<number>, Omit<raw.ScaleDimensionConfig, 'fixed'> {}
|
||||
|
||||
export interface ScalarDimensionConfig extends BaseDimensionConfig<number>, Omit<raw.ScalarDimensionConfig, 'fixed'> {}
|
||||
|
||||
export interface TextDimensionConfig extends BaseDimensionConfig<string>, Omit<raw.TextDimensionConfig, 'fixed'> {}
|
||||
|
||||
export interface ColorDimensionConfig extends BaseDimensionConfig<string>, Omit<raw.ColorDimensionConfig, 'fixed'> {}
|
||||
|
||||
export interface ColorDimensionConfig extends BaseDimensionConfig<string>, Omit<raw.ColorDimensionConfig, 'fixed'> {}
|
||||
|
||||
export interface ResourceDimensionConfig
|
||||
extends BaseDimensionConfig<string>,
|
||||
Omit<raw.ResourceDimensionConfig, 'fixed'> {}
|
||||
|
||||
export * from '../common/common.gen';
|
||||
|
||||
// TODO remove when https://github.com/grafana/cuetsy/issues/74 is fixed
|
||||
|
||||
Reference in New Issue
Block a user