Dashboards: Fixes repeating by row and no refresh (#46565)

This commit is contained in:
Torkel Ödegaard 2022-03-16 07:57:12 +01:00 committed by GitHub
parent 468def0c00
commit 31d141b267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -587,6 +587,14 @@ describe('given dashboard with row and panel repeat', () => {
expect(panelTypes).toEqual(['row', 'graph', 'graph', 'row', 'graph', 'graph']);
});
it('Row repeat should create new panel keys every repeat cycle', () => {
// This is the first repeated panel inside the second repeated row
// Since we create a new panel model every time (and new panel events bus) we need to create a new key here to trigger a re-mount & re-subscribe
const key1 = dashboard.panels[3].key;
dashboard.processRepeats();
expect(key1).not.toEqual(dashboard.panels[3].key);
});
it('should clean up old repeated panels', () => {
dashboardJSON.panels = [
{

View File

@ -799,7 +799,6 @@ export class DashboardModel implements TimeModel {
updateRepeatedPanelIds(panel: PanelModel, repeatedByRow?: boolean) {
panel.repeatPanelId = panel.id;
panel.id = this.getNextPanelId();
panel.key = `${panel.id}`;
panel.repeatIteration = this.iteration;
if (repeatedByRow) {
panel.repeatedByRow = true;