mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 09:26:43 -06:00
LibraryPanels: Fixes crash in libray panels list when panel plugin is not found (#35907)
This commit is contained in:
parent
503c3b8f66
commit
941936cf97
@ -1,12 +1,12 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { GrafanaTheme2, PanelPluginMeta } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { config } from '@grafana/runtime';
|
|
||||||
import { Icon, Link, useStyles2 } from '@grafana/ui';
|
import { Icon, Link, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { LibraryElementDTO } from '../../types';
|
import { LibraryElementDTO } from '../../types';
|
||||||
import { PanelTypeCard } from 'app/features/dashboard/components/VizTypePicker/PanelTypeCard';
|
import { PanelTypeCard } from 'app/features/dashboard/components/VizTypePicker/PanelTypeCard';
|
||||||
import { DeleteLibraryPanelModal } from '../DeleteLibraryPanelModal/DeleteLibraryPanelModal';
|
import { DeleteLibraryPanelModal } from '../DeleteLibraryPanelModal/DeleteLibraryPanelModal';
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
|
import { getPanelPluginNotFound } from 'app/features/dashboard/dashgrid/PanelPluginError';
|
||||||
|
|
||||||
export interface LibraryPanelCardProps {
|
export interface LibraryPanelCardProps {
|
||||||
libraryPanel: LibraryElementDTO;
|
libraryPanel: LibraryElementDTO;
|
||||||
@ -28,7 +28,7 @@ export const LibraryPanelCard: React.FC<LibraryPanelCardProps & { children?: JSX
|
|||||||
setShowDeletionModal(false);
|
setShowDeletionModal(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const panelPlugin = config.panels[libraryPanel.model.type] ?? ({} as PanelPluginMeta);
|
const panelPlugin = config.panels[libraryPanel.model.type] ?? getPanelPluginNotFound(libraryPanel.model.type).meta;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user