diff --git a/public/app/features/library-panels/components/LibraryPanelsView/LibraryPanelsView.tsx b/public/app/features/library-panels/components/LibraryPanelsView/LibraryPanelsView.tsx index 2aca3ffafc8..5a344fa03c8 100644 --- a/public/app/features/library-panels/components/LibraryPanelsView/LibraryPanelsView.tsx +++ b/public/app/features/library-panels/components/LibraryPanelsView/LibraryPanelsView.tsx @@ -13,6 +13,7 @@ interface LibraryPanelViewProps { onClickCard?: (panel: LibraryPanelDTO) => void; formatDate?: (dateString: DateTimeInput, format?: string) => string; showSecondaryActions?: boolean; + currentPanelId?: string; } export const LibraryPanelsView: React.FC = ({ @@ -22,6 +23,7 @@ export const LibraryPanelsView: React.FC = ({ onClickCard, formatDate, showSecondaryActions, + currentPanelId: currentPanel, }) => { const styles = useStyles(getPanelViewStyles); const [searchString, setSearchString] = useState(''); @@ -38,10 +40,14 @@ export const LibraryPanelsView: React.FC = ({ const [filteredItems, setFilteredItems] = useState(libraryPanels); useDebounce( () => { - setFilteredItems(libraryPanels?.filter((v) => v.name.toLowerCase().includes(searchString.toLowerCase()))); + setFilteredItems( + libraryPanels?.filter( + (v) => v.name.toLowerCase().includes(searchString.toLowerCase()) && v.uid !== currentPanel + ) + ); }, 300, - [searchString, libraryPanels] + [searchString, libraryPanels, currentPanel] ); const onDeletePanel = async (uid: string) => { diff --git a/public/app/features/library-panels/components/PanelLibraryOptionsGroup/PanelLibraryOptionsGroup.tsx b/public/app/features/library-panels/components/PanelLibraryOptionsGroup/PanelLibraryOptionsGroup.tsx index 7b6f25c213f..97b55eff9e8 100644 --- a/public/app/features/library-panels/components/PanelLibraryOptionsGroup/PanelLibraryOptionsGroup.tsx +++ b/public/app/features/library-panels/components/PanelLibraryOptionsGroup/PanelLibraryOptionsGroup.tsx @@ -59,6 +59,7 @@ export const PanelLibraryOptionsGroup: React.FC = ({ panel, dashboard }) > dashboard.formatDate(dateString, 'L')} + currentPanelId={panel.libraryPanel?.uid} showSecondaryActions > {(panel) => (