From 5a198137712e0673cbbf80c81a8b6f4c88e6ef25 Mon Sep 17 00:00:00 2001 From: Andres Martinez Gotor Date: Wed, 22 Nov 2023 09:04:54 +0100 Subject: [PATCH] Chore: Display core plugins when showing all in the catalog (#78447) --- .../features/plugins/admin/pages/Browse.test.tsx | 6 +++--- public/app/features/plugins/admin/pages/Browse.tsx | 1 - .../features/plugins/admin/state/selectors.test.ts | 14 -------------- .../app/features/plugins/admin/state/selectors.ts | 7 ------- 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/public/app/features/plugins/admin/pages/Browse.test.tsx b/public/app/features/plugins/admin/pages/Browse.test.tsx index 554556330d8..a10d57508ab 100644 --- a/public/app/features/plugins/admin/pages/Browse.test.tsx +++ b/public/app/features/plugins/admin/pages/Browse.test.tsx @@ -61,7 +61,7 @@ describe('Browse list of plugins', () => { expect(queryByText('Plugin 4')).toBeNull(); }); - it('should list all plugins (except core plugins) when filtering by all', async () => { + it('should list all plugins (including core plugins) when filtering by all', async () => { const { queryByText } = renderBrowse('/plugins?filterBy=all&filterByType=all', [ getCatalogPluginMock({ id: 'plugin-1', name: 'Plugin 1', isInstalled: true }), getCatalogPluginMock({ id: 'plugin-2', name: 'Plugin 2', isInstalled: false }), @@ -73,8 +73,8 @@ describe('Browse list of plugins', () => { expect(queryByText('Plugin 2')).toBeInTheDocument(); expect(queryByText('Plugin 3')).toBeInTheDocument(); - // Core plugins should not be listed - expect(queryByText('Plugin 4')).not.toBeInTheDocument(); + // Core plugins should still be listed + expect(queryByText('Plugin 4')).toBeInTheDocument(); }); it('should list installed plugins (including core plugins) when filtering by installed', async () => { diff --git a/public/app/features/plugins/admin/pages/Browse.tsx b/public/app/features/plugins/admin/pages/Browse.tsx index 3db73e36650..7208cc7d8dc 100644 --- a/public/app/features/plugins/admin/pages/Browse.tsx +++ b/public/app/features/plugins/admin/pages/Browse.tsx @@ -36,7 +36,6 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem keyword, type: filterByType !== 'all' ? filterByType : undefined, isInstalled: filterBy === 'installed' ? true : undefined, - isCore: filterBy === 'installed' ? undefined : false, // We only would like to show core plugins when the user filters to installed plugins }, sortBy ); diff --git a/public/app/features/plugins/admin/state/selectors.test.ts b/public/app/features/plugins/admin/state/selectors.test.ts index 84441ca42af..d10f0611412 100644 --- a/public/app/features/plugins/admin/state/selectors.test.ts +++ b/public/app/features/plugins/admin/state/selectors.test.ts @@ -67,20 +67,6 @@ describe('Plugins Selectors', () => { expect(results.map(({ name }) => name)).toEqual(['Plugin 3', 'Plugin 4']); }); - it('should be possible to search for core plugins', () => { - const results = selectPlugins({ isCore: true })(store.getState()); - - expect(results).toHaveLength(2); - expect(results.map(({ name }) => name)).toEqual(['Plugin 1', 'Plugin 2']); - }); - - it('should be possible to exclude core plugins from the search', () => { - const results = selectPlugins({ isCore: false })(store.getState()); - - expect(results).toHaveLength(3); - expect(results.map(({ name }) => name)).toEqual(['Plugin 3', 'Plugin 4', 'Plugin 5']); - }); - it('should be possible to only search for installed plugins', () => { const results = selectPlugins({ isInstalled: true })(store.getState()); diff --git a/public/app/features/plugins/admin/state/selectors.ts b/public/app/features/plugins/admin/state/selectors.ts index e3b2cefbfb4..2bf3f32de31 100644 --- a/public/app/features/plugins/admin/state/selectors.ts +++ b/public/app/features/plugins/admin/state/selectors.ts @@ -22,9 +22,6 @@ export type PluginFilters = { // (Optional, only applied if set) type?: PluginType; - // (Optional, only applied if set) - isCore?: boolean; - // (Optional, only applied if set) isInstalled?: boolean; @@ -51,10 +48,6 @@ export const selectPlugins = (filters: PluginFilters) => return false; } - if (filters.isCore !== undefined && plugin.isCore !== filters.isCore) { - return false; - } - if (filters.isEnterprise !== undefined && plugin.isEnterprise !== filters.isEnterprise) { return false; }