Schema: convert dashboards from v1beta1 to v2beta1 (#109037)
- Implement full conversion pipeline from v1beta1 → v2beta1 - Ensure frontend–backend parity for all dashboard serialization paths - Add automatic data loss detection for conversions (panels, queries, annotations, links, variables) - Extract atomic conversion functions for v0 → v1beta1 → v2alpha1 → v2beta1 - Introduce conversion metrics and detailed logging for loss tracking - Normalize datasource resolution, defaults, and annotation processing - Improve panel layout serialization and y-coordinate normalization - Fix inconsistencies in nested panels and collapsed row behavior - Refine variable handling: - Filter refId from variable query specs - Default variable refresh to 'never' (matches frontend) - Fix constant and interval variable handling for missing queries - Unify schema defaults (enable, hide, iconColor, editable, liveNow) - Fix pluginId usage (UID vs type) and datasource references - Fix metrics.go bug swallowing errors (return nil → return err) - Add tests for version-specific conversion error handling - Add data loss detection tests using source/target version comparison - Clean up lint issues, legacy code, and redundant files - Update OpenAPI snapshots and migrated dashboards - Improve backend migrator to reuse datasource provider and match frontend logic Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com> Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com> Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
This commit is contained in:
co-authored by
Haris Rozajac
Oscar Kilhed
Stephanie Hingtgen
parent
09942c08db
commit
e463781077
@@ -259,6 +259,8 @@ export interface FieldConfigSource {
|
||||
defaults: FieldConfig;
|
||||
// Overrides are the options applied to specific fields overriding the defaults.
|
||||
overrides: {
|
||||
// Describes config override rules created when interacting with Grafana.
|
||||
__systemRef?: string;
|
||||
matcher: MatcherConfig;
|
||||
properties: DynamicConfigValue[];
|
||||
}[];
|
||||
@@ -457,7 +459,8 @@ export type ThresholdsMode = "absolute" | "percentage";
|
||||
export const defaultThresholdsMode = (): ThresholdsMode => ("absolute");
|
||||
|
||||
export interface Threshold {
|
||||
value: number;
|
||||
// Value null means -Infinity
|
||||
value: number | null;
|
||||
color: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ export interface PanelQuerySpec {
|
||||
|
||||
export const defaultPanelQuerySpec = (): PanelQuerySpec => ({
|
||||
query: defaultDataQueryKind(),
|
||||
refId: "",
|
||||
refId: "A",
|
||||
hidden: false,
|
||||
});
|
||||
|
||||
@@ -266,6 +266,8 @@ export interface FieldConfigSource {
|
||||
defaults: FieldConfig;
|
||||
// Overrides are the options applied to specific fields overriding the defaults.
|
||||
overrides: {
|
||||
// Describes config override rules created when interacting with Grafana.
|
||||
__systemRef?: string;
|
||||
matcher: MatcherConfig;
|
||||
properties: DynamicConfigValue[];
|
||||
}[];
|
||||
@@ -464,7 +466,8 @@ export type ThresholdsMode = "absolute" | "percentage";
|
||||
export const defaultThresholdsMode = (): ThresholdsMode => ("absolute");
|
||||
|
||||
export interface Threshold {
|
||||
value: number;
|
||||
// Value null means -Infinity
|
||||
value: number | null;
|
||||
color: string;
|
||||
}
|
||||
|
||||
@@ -1282,7 +1285,7 @@ export interface IntervalVariableSpec {
|
||||
auto: boolean;
|
||||
auto_min: string;
|
||||
auto_count: number;
|
||||
refresh: VariableRefresh;
|
||||
refresh: "onTimeRangeChanged";
|
||||
label?: string;
|
||||
hide: VariableHide;
|
||||
skipUrlSync: boolean;
|
||||
@@ -1297,7 +1300,7 @@ export const defaultIntervalVariableSpec = (): IntervalVariableSpec => ({
|
||||
auto: false,
|
||||
auto_min: "",
|
||||
auto_count: 0,
|
||||
refresh: "never",
|
||||
refresh: "onTimeRangeChanged",
|
||||
hide: "dontHide",
|
||||
skipUrlSync: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user