From a9751729e4386fe303a1183dc4151d5bf79fce2c Mon Sep 17 00:00:00 2001 From: David Harris Date: Wed, 1 May 2024 11:56:18 +0100 Subject: [PATCH] update plugin install filter to show all by default --- .../features/plugins/admin/pages/Browse.test.tsx | 16 +++++++++------- .../app/features/plugins/admin/pages/Browse.tsx | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/public/app/features/plugins/admin/pages/Browse.test.tsx b/public/app/features/plugins/admin/pages/Browse.test.tsx index a22f98e6c2c..fbd66165247 100644 --- a/public/app/features/plugins/admin/pages/Browse.test.tsx +++ b/public/app/features/plugins/admin/pages/Browse.test.tsx @@ -45,20 +45,22 @@ const renderBrowse = ( describe('Browse list of plugins', () => { describe('when filtering', () => { - it('should list installed plugins by default', async () => { + it('should list all plugins (including core plugins) by default', async () => { const { queryByText } = renderBrowse('/plugins', [ getCatalogPluginMock({ id: 'plugin-1', name: 'Plugin 1', isInstalled: true }), getCatalogPluginMock({ id: 'plugin-2', name: 'Plugin 2', isInstalled: true }), - getCatalogPluginMock({ id: 'plugin-3', name: 'Plugin 3', isInstalled: true }), - getCatalogPluginMock({ id: 'plugin-4', name: 'Plugin 4', isInstalled: false }), + getCatalogPluginMock({ id: 'plugin-3', name: 'Plugin 3', isInstalled: false }), + getCatalogPluginMock({ id: 'plugin-4', name: 'Plugin 4', isInstalled: true, isCore: true }), ]); await waitFor(() => expect(queryByText('Plugin 1')).toBeInTheDocument()); - expect(queryByText('Plugin 1')).toBeInTheDocument(); - expect(queryByText('Plugin 2')).toBeInTheDocument(); + expect(queryByText('Plugin 2')).toBeInTheDocument(); + + // Plugins which are not installed should still be listed expect(queryByText('Plugin 3')).toBeInTheDocument(); - - expect(queryByText('Plugin 4')).toBeNull(); + + // Core plugins should still be listed + expect(queryByText('Plugin 4')).toBeInTheDocument(); }); it('should list all plugins (including core plugins) when filtering by all', async () => { diff --git a/public/app/features/plugins/admin/pages/Browse.tsx b/public/app/features/plugins/admin/pages/Browse.tsx index 195ec0e7b58..9f822c861c1 100644 --- a/public/app/features/plugins/admin/pages/Browse.tsx +++ b/public/app/features/plugins/admin/pages/Browse.tsx @@ -28,7 +28,7 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem const history = useHistory(); const remotePluginsAvailable = useIsRemotePluginsAvailable(); const keyword = locationSearch.q?.toString() || ''; - const filterBy = locationSearch.filterBy?.toString() || 'installed'; + const filterBy = locationSearch.filterBy?.toString() || 'all'; const filterByType = (locationSearch.filterByType as PluginType | 'all') || 'all'; const sortBy = (locationSearch.sortBy as Sorters) || Sorters.nameAsc; const { isLoading, error, plugins } = useGetAll(