Dashboards: Fix saving repeat rows in schemav2 (#101432)
fix saving repeat rows
This commit is contained in:
+9
-4
@@ -32,8 +32,13 @@ import { RowRepeaterBehavior } from '../../scene/layout-default/RowRepeaterBehav
|
||||
import { RowActions } from '../../scene/layout-default/row-actions/RowActions';
|
||||
import { setDashboardPanelContext } from '../../scene/setDashboardPanelContext';
|
||||
import { DashboardLayoutManager, LayoutManagerSerializer } from '../../scene/types/DashboardLayoutManager';
|
||||
import { isClonedKey } from '../../utils/clone';
|
||||
import { calculateGridItemDimensions, getVizPanelKeyForPanelId, isLibraryPanel } from '../../utils/utils';
|
||||
import { getOriginalKey, isClonedKey } from '../../utils/clone';
|
||||
import {
|
||||
calculateGridItemDimensions,
|
||||
getPanelIdForVizPanel,
|
||||
getVizPanelKeyForPanelId,
|
||||
isLibraryPanel,
|
||||
} from '../../utils/utils';
|
||||
import { GRID_ROW_HEIGHT } from '../const';
|
||||
|
||||
import { buildVizPanel } from './utils';
|
||||
@@ -143,7 +148,7 @@ function gridItemToGridLayoutItemKind(gridItem: DashboardGridItem, yOverride?: n
|
||||
const repeatVar = gridItem_.state.variableName;
|
||||
|
||||
// FIXME: which name should we use for the element reference, key or something else ?
|
||||
const elementName = gridItem_.state.body.state.key ?? 'DefaultName';
|
||||
const elementName = getVizPanelKeyForPanelId(getPanelIdForVizPanel(gridItem_.state.body));
|
||||
elementGridItem = {
|
||||
kind: 'GridLayoutItem',
|
||||
spec: {
|
||||
@@ -266,7 +271,7 @@ function createSceneGridLayoutForItems(layout: GridLayoutKind, elements: Record<
|
||||
}
|
||||
} else if (element.kind === 'GridLayoutRow') {
|
||||
const children = element.spec.elements.map((gridElement) => {
|
||||
const panel = elements[gridElement.spec.element.name];
|
||||
const panel = elements[getOriginalKey(gridElement.spec.element.name)];
|
||||
if (panel.kind === 'Panel') {
|
||||
return buildGridItem(gridElement.spec, panel, element.spec.y + GRID_ROW_HEIGHT + gridElement.spec.y);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user