mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Display core plugins when showing all in the catalog (#78447)
This commit is contained in:
parent
91a0624be6
commit
5a19813771
@ -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 () => {
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user