mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Scenes: Fix panel repeats (#83707)
This commit is contained in:
@@ -138,7 +138,7 @@ export class PanelEditor extends SceneObjectBase<PanelEditorState> {
|
|||||||
width: repeatDirection === 'h' ? 24 : gridItem.state.width,
|
width: repeatDirection === 'h' ? 24 : gridItem.state.width,
|
||||||
height: gridItem.state.height,
|
height: gridItem.state.height,
|
||||||
itemHeight: gridItem.state.height,
|
itemHeight: gridItem.state.height,
|
||||||
source: panelManager.state.panel.clone(),
|
source: panelManager.getPanelCloneWithData(),
|
||||||
variableName: panelManager.state.repeat!,
|
variableName: panelManager.state.repeat!,
|
||||||
repeatedPanels: [],
|
repeatedPanels: [],
|
||||||
repeatDirection: panelManager.state.repeatDirection,
|
repeatDirection: panelManager.state.repeatDirection,
|
||||||
@@ -157,7 +157,7 @@ export class PanelEditor extends SceneObjectBase<PanelEditorState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const panelManager = this.state.vizManager;
|
const panelManager = this.state.vizManager;
|
||||||
const panelClone = panelManager.state.panel.clone();
|
const panelClone = panelManager.getPanelCloneWithData();
|
||||||
const gridItem = new SceneGridItem({
|
const gridItem = new SceneGridItem({
|
||||||
key: panelRepeater.state.key,
|
key: panelRepeater.state.key,
|
||||||
x: panelRepeater.state.x,
|
x: panelRepeater.state.x,
|
||||||
@@ -189,7 +189,7 @@ export class PanelEditor extends SceneObjectBase<PanelEditorState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
panelRepeater.setState({
|
panelRepeater.setState({
|
||||||
source: panelManager.state.panel.clone(),
|
source: panelManager.getPanelCloneWithData(),
|
||||||
repeatDirection: panelManager.state.repeatDirection,
|
repeatDirection: panelManager.state.repeatDirection,
|
||||||
variableName: panelManager.state.repeat,
|
variableName: panelManager.state.repeat,
|
||||||
maxPerRow: panelManager.state.maxPerRow,
|
maxPerRow: panelManager.state.maxPerRow,
|
||||||
|
|||||||
@@ -367,6 +367,10 @@ export class VizPanelManager extends SceneObjectBase<VizPanelManagerState> {
|
|||||||
return { error: 'Unsupported panel parent' };
|
return { error: 'Unsupported panel parent' };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getPanelCloneWithData(): VizPanel {
|
||||||
|
return this.state.panel.clone({ $data: this.state.$data?.clone() });
|
||||||
|
}
|
||||||
|
|
||||||
public static Component = ({ model }: SceneComponentProps<VizPanelManager>) => {
|
public static Component = ({ model }: SceneComponentProps<VizPanelManager>) => {
|
||||||
const { panel, tableView } = model.useState();
|
const { panel, tableView } = model.useState();
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
|||||||
Reference in New Issue
Block a user