mirror of
https://github.com/grafana/grafana.git
synced 2026-02-18 18:20:52 -05:00
Chore: Remove deprecated config.panels in LibraryPanelCard (#118363)
* Chore: Remove deprecated config.panels in LibraryPanelCard * Fix mock in the test
This commit is contained in:
parent
8a01d18618
commit
57f815cd06
3 changed files with 17 additions and 17 deletions
|
|
@ -2610,11 +2610,6 @@
|
|||
"count": 2
|
||||
}
|
||||
},
|
||||
"public/app/features/library-panels/components/LibraryPanelCard/LibraryPanelCard.tsx": {
|
||||
"no-restricted-syntax": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/features/live/centrifuge/LiveDataStream.ts": {
|
||||
"@typescript-eslint/consistent-type-assertions": {
|
||||
"count": 1
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import Skeleton from 'react-loading-skeleton';
|
|||
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { Trans } from '@grafana/i18n';
|
||||
import { config } from '@grafana/runtime';
|
||||
import { usePanelPluginMeta } from '@grafana/runtime/internal';
|
||||
import { Icon, Link, useStyles2 } from '@grafana/ui';
|
||||
import { SkeletonComponent, attachSkeleton } from '@grafana/ui/unstable';
|
||||
import { getPanelPluginNotFound } from 'app/features/panel/components/PanelPluginError';
|
||||
|
|
@ -30,7 +30,8 @@ const LibraryPanelCardComponent = ({ libraryPanel, onClick, onDelete, showSecond
|
|||
setShowDeletionModal(false);
|
||||
};
|
||||
|
||||
const panelPlugin = config.panels[libraryPanel.model.type] ?? getPanelPluginNotFound(libraryPanel.model.type).meta;
|
||||
const { value: panelPluginMeta } = usePanelPluginMeta(libraryPanel.model.type);
|
||||
const panelPlugin = panelPluginMeta ?? getPanelPluginNotFound(libraryPanel.model.type).meta;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -35,17 +35,21 @@ const timeseries: PanelPluginMeta = {
|
|||
sort: 1,
|
||||
};
|
||||
|
||||
jest.mock('@grafana/runtime', () => ({
|
||||
...jest.requireActual('@grafana/runtime'),
|
||||
config: {
|
||||
...jest.requireActual('@grafana/runtime').config,
|
||||
panels: {
|
||||
timeseries: {
|
||||
info: { logos: { small: '' } },
|
||||
name: 'Time Series',
|
||||
},
|
||||
jest.mock('@grafana/runtime/internal', () => ({
|
||||
...jest.requireActual('@grafana/runtime/internal'),
|
||||
usePanelPluginMeta: jest.fn((type: string) => ({
|
||||
value: {
|
||||
id: type,
|
||||
name: type === 'timeseries' ? 'Time Series' : 'Graph',
|
||||
info: { logos: { small: '', large: '' } },
|
||||
baseUrl: '',
|
||||
type: 'panel',
|
||||
module: '',
|
||||
sort: 0,
|
||||
},
|
||||
},
|
||||
loading: false,
|
||||
error: undefined,
|
||||
})),
|
||||
}));
|
||||
|
||||
const getLibraryPanelsSpy = jest.spyOn(api, 'getLibraryPanels');
|
||||
|
|
|
|||
Loading…
Reference in a new issue