From 42d624cce535ac7b3c4dbf45edfba7d901f872c2 Mon Sep 17 00:00:00 2001 From: Oscar Kilhed Date: Wed, 26 Mar 2025 17:42:04 +0100 Subject: [PATCH] [release-11.6.1] Dashboards: Limit panel title length (#102920) Dashboards: Limit panel title length (#102911) Limit panel title length (cherry picked from commit 44c471d10ca1d7c7035f648d3278aacbc1c99507) --- .../dashboard-scene/serialization/layoutSerializers/utils.ts | 2 +- .../dashboard-scene/serialization/transformSaveModelToScene.ts | 2 +- public/app/features/dashboard/dashgrid/DashboardGrid.tsx | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard-scene/serialization/layoutSerializers/utils.ts b/public/app/features/dashboard-scene/serialization/layoutSerializers/utils.ts index 70adca4f5f6..a4d40081cf0 100644 --- a/public/app/features/dashboard-scene/serialization/layoutSerializers/utils.ts +++ b/public/app/features/dashboard-scene/serialization/layoutSerializers/utils.ts @@ -47,7 +47,7 @@ export function buildVizPanel(panel: PanelKind): VizPanel { const vizPanelState: VizPanelState = { key: getVizPanelKeyForPanelId(panel.spec.id), - title: panel.spec.title, + title: panel.spec.title?.substring(0, 5000), description: panel.spec.description, pluginId: panel.spec.vizConfig.kind, options: panel.spec.vizConfig.spec.options, diff --git a/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.ts b/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.ts index cd65a502b7c..91fb171d197 100644 --- a/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.ts +++ b/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.ts @@ -324,7 +324,7 @@ export function buildGridItemForPanel(panel: PanelModel): DashboardGridItem { const vizPanelState: VizPanelState = { key: getVizPanelKeyForPanelId(panel.id), - title: panel.title, + title: panel.title?.substring(0, 5000), description: panel.description, pluginId: panel.type ?? 'timeseries', options: panel.options ?? {}, diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx index 397dfc30c33..a8cd9720e22 100644 --- a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx @@ -111,6 +111,7 @@ export class DashboardGrid extends PureComponent { if (!panel.key) { panel.key = `panel-${panel.id}-${Date.now()}`; } + panel.title = panel.title?.substring(0, 5000); this.panelMap[panel.key] = panel; if (!panel.gridPos) {