-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v11.0.x] DashboardScene: Fixes issue referring to library panel in d…
…ashboard data source (#87173) DashboardScene: Fixes issue referring to library panel in dashboard data source (#87125) * DashboardScene: Fixes issue using a library panel as source for dashboard data source * Added test (cherry picked from commit 4034a26) Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
- Loading branch information
1 parent
a8cd6d9
commit 7c1cc61
Showing
3 changed files
with
28 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
public/app/features/dashboard-scene/utils/PanelModelCompatibilityWrapper.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { VizPanel } from '@grafana/scenes'; | ||
|
||
import { LibraryVizPanel } from '../scene/LibraryVizPanel'; | ||
|
||
import { PanelModelCompatibilityWrapper } from './PanelModelCompatibilityWrapper'; | ||
|
||
describe('PanelModelCompatibilityWrapper', () => { | ||
it('Can get legacy id', () => { | ||
const vizPanel = new VizPanel({ pluginId: 'test', title: 'test', description: 'test', key: 'panel-24' }); | ||
const panelModel = new PanelModelCompatibilityWrapper(vizPanel); | ||
expect(panelModel.id).toBe(24); | ||
}); | ||
|
||
it('Can get legacy id for lib panel', () => { | ||
const libPanel = new LibraryVizPanel({ | ||
uid: 'a', | ||
name: 'aa', | ||
title: 'a', | ||
panelKey: 'panel-24', | ||
panel: new VizPanel({ pluginId: 'test', title: 'test', description: 'test', key: 'panel-24' }), | ||
}); | ||
|
||
const panelModel = new PanelModelCompatibilityWrapper(libPanel.state.panel!); | ||
expect(panelModel.id).toBe(24); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters