From 82d8d44977d8149d8a8e4f2c30ec50b2b8a633e5 Mon Sep 17 00:00:00 2001 From: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com> Date: Tue, 13 Jan 2026 11:44:36 -0700 Subject: [PATCH] Dashboard Conversion: Remove duplicated data loss function (#116214) remove duplicated dataloss function --- .../conversion/v2alpha1_to_v1beta1.go | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/apps/dashboard/pkg/migration/conversion/v2alpha1_to_v1beta1.go b/apps/dashboard/pkg/migration/conversion/v2alpha1_to_v1beta1.go index 18d9ae90814..857af7ca866 100644 --- a/apps/dashboard/pkg/migration/conversion/v2alpha1_to_v1beta1.go +++ b/apps/dashboard/pkg/migration/conversion/v2alpha1_to_v1beta1.go @@ -71,11 +71,6 @@ func convertDashboardSpec_V2alpha1_to_V1beta1(in *dashv2alpha1.DashboardSpec) (m if err != nil { return nil, fmt.Errorf("failed to convert panels: %w", err) } - // Count total panels including those in collapsed rows - totalPanelsConverted := countTotalPanels(panels) - if totalPanelsConverted < len(in.Elements) { - return nil, fmt.Errorf("some panels were not converted from v2alpha1 to v1beta1") - } if len(panels) > 0 { dashboard["panels"] = panels @@ -198,29 +193,6 @@ func convertLinksToV1(links []dashv2alpha1.DashboardDashboardLink) []map[string] return result } -// countTotalPanels counts all panels including those nested in collapsed row panels. -func countTotalPanels(panels []interface{}) int { - count := 0 - for _, p := range panels { - panel, ok := p.(map[string]interface{}) - if !ok { - count++ - continue - } - - // Check if this is a row panel with nested panels - if panelType, ok := panel["type"].(string); ok && panelType == "row" { - if nestedPanels, ok := panel["panels"].([]interface{}); ok { - count += len(nestedPanels) - } - // Don't count the row itself as a panel element - } else { - count++ - } - } - return count -} - // convertPanelsFromElementsAndLayout converts V2 layout structures to V1 panel arrays. // V1 only supports a flat array of panels with row panels for grouping. // This function dispatches to the appropriate converter based on layout type: