mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
Revert "Plugins: Display "renderer" and "secretsmanager" plugin types under plugin catalog "Application" filter (#55597)" (#55686)
This reverts commit e981848026
.
This commit is contained in:
parent
4e65f131d9
commit
fedc1cdb11
@ -145,8 +145,6 @@ describe('Browse list of plugins', () => {
|
||||
getCatalogPluginMock({ id: 'plugin-1', name: 'Plugin 1', type: PluginType.app }),
|
||||
getCatalogPluginMock({ id: 'plugin-2', name: 'Plugin 2', type: PluginType.datasource }),
|
||||
getCatalogPluginMock({ id: 'plugin-3', name: 'Plugin 3', type: PluginType.panel }),
|
||||
getCatalogPluginMock({ id: 'plugin-4', name: 'Plugin 4', type: PluginType.secretsmanager }),
|
||||
getCatalogPluginMock({ id: 'plugin-5', name: 'Plugin 5', type: PluginType.renderer }),
|
||||
]);
|
||||
|
||||
await waitFor(() => expect(queryByText('Plugin 2')).toBeInTheDocument());
|
||||
@ -154,8 +152,6 @@ describe('Browse list of plugins', () => {
|
||||
// Other plugin types shouldn't be shown
|
||||
expect(queryByText('Plugin 1')).not.toBeInTheDocument();
|
||||
expect(queryByText('Plugin 3')).not.toBeInTheDocument();
|
||||
expect(queryByText('Plugin 4')).not.toBeInTheDocument();
|
||||
expect(queryByText('Plugin 5')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should list only panel plugins when filtering by panel', async () => {
|
||||
@ -163,8 +159,6 @@ describe('Browse list of plugins', () => {
|
||||
getCatalogPluginMock({ id: 'plugin-1', name: 'Plugin 1', type: PluginType.app }),
|
||||
getCatalogPluginMock({ id: 'plugin-2', name: 'Plugin 2', type: PluginType.datasource }),
|
||||
getCatalogPluginMock({ id: 'plugin-3', name: 'Plugin 3', type: PluginType.panel }),
|
||||
getCatalogPluginMock({ id: 'plugin-4', name: 'Plugin 4', type: PluginType.secretsmanager }),
|
||||
getCatalogPluginMock({ id: 'plugin-5', name: 'Plugin 5', type: PluginType.renderer }),
|
||||
]);
|
||||
|
||||
await waitFor(() => expect(queryByText('Plugin 3')).toBeInTheDocument());
|
||||
@ -172,8 +166,6 @@ describe('Browse list of plugins', () => {
|
||||
// Other plugin types shouldn't be shown
|
||||
expect(queryByText('Plugin 1')).not.toBeInTheDocument();
|
||||
expect(queryByText('Plugin 2')).not.toBeInTheDocument();
|
||||
expect(queryByText('Plugin 4')).not.toBeInTheDocument();
|
||||
expect(queryByText('Plugin 5')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should list only app plugins when filtering by app', async () => {
|
||||
@ -189,16 +181,6 @@ describe('Browse list of plugins', () => {
|
||||
expect(queryByText('Plugin 2')).not.toBeInTheDocument();
|
||||
expect(queryByText('Plugin 3')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should also list secretsmanager and renderer plugins when filtering by app', async () => {
|
||||
const { queryByText } = renderBrowse('/plugins?filterBy=all&filterByType=app', [
|
||||
getCatalogPluginMock({ id: 'plugin-1', name: 'Plugin 1', type: PluginType.secretsmanager }),
|
||||
getCatalogPluginMock({ id: 'plugin-2', name: 'Plugin 2', type: PluginType.renderer }),
|
||||
]);
|
||||
|
||||
await waitFor(() => expect(queryByText('Plugin 1')).toBeInTheDocument());
|
||||
await waitFor(() => expect(queryByText('Plugin 2')).toBeInTheDocument());
|
||||
});
|
||||
});
|
||||
|
||||
describe('when searching', () => {
|
||||
|
@ -16,7 +16,7 @@ import { SearchField } from '../components/SearchField';
|
||||
import { Sorters } from '../helpers';
|
||||
import { useHistory } from '../hooks/useHistory';
|
||||
import { useGetAllWithFilters, useIsRemotePluginsAvailable, useDisplayMode } from '../state/hooks';
|
||||
import { PluginListDisplayMode, PluginTypeFilterOption } from '../types';
|
||||
import { PluginListDisplayMode } from '../types';
|
||||
|
||||
export default function Browse({ route }: GrafanaRouteComponentProps): ReactElement | null {
|
||||
const location = useLocation();
|
||||
@ -28,7 +28,7 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem
|
||||
const remotePluginsAvailable = useIsRemotePluginsAvailable();
|
||||
const query = (locationSearch.q as string) || '';
|
||||
const filterBy = (locationSearch.filterBy as string) || 'installed';
|
||||
const filterByType: PluginTypeFilterOption = (locationSearch.filterByType as PluginTypeFilterOption) || 'all';
|
||||
const filterByType = (locationSearch.filterByType as string) || 'all';
|
||||
const sortBy = (locationSearch.sortBy as Sorters) || Sorters.nameAsc;
|
||||
const { isLoading, error, plugins } = useGetAllWithFilters({
|
||||
query,
|
||||
@ -49,7 +49,7 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem
|
||||
history.push({ query: { filterBy: value } });
|
||||
};
|
||||
|
||||
const onFilterByTypeChange = (value: PluginTypeFilterOption) => {
|
||||
const onFilterByTypeChange = (value: string) => {
|
||||
history.push({ query: { filterByType: value } });
|
||||
};
|
||||
|
||||
@ -71,7 +71,7 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem
|
||||
<HorizontalGroup wrap className={styles.actionBar}>
|
||||
{/* Filter by type */}
|
||||
<div>
|
||||
<RadioButtonGroup<PluginTypeFilterOption>
|
||||
<RadioButtonGroup
|
||||
value={filterByType}
|
||||
onChange={onFilterByTypeChange}
|
||||
options={[
|
||||
|
@ -4,7 +4,7 @@ import { PluginError } from '@grafana/data';
|
||||
import { useDispatch, useSelector } from 'app/types';
|
||||
|
||||
import { sortPlugins, Sorters } from '../helpers';
|
||||
import { CatalogPlugin, PluginListDisplayMode, PluginTypeFilterOption } from '../types';
|
||||
import { CatalogPlugin, PluginListDisplayMode } from '../types';
|
||||
|
||||
import { fetchAll, fetchDetails, fetchRemotePlugins, install, uninstall } from './actions';
|
||||
import { setDisplayMode } from './reducer';
|
||||
@ -22,7 +22,7 @@ import {
|
||||
type Filters = {
|
||||
query?: string; // Note: this will be an escaped regex string as it comes from `FilterInput`
|
||||
filterBy?: string;
|
||||
filterByType?: PluginTypeFilterOption;
|
||||
filterByType?: string;
|
||||
sortBy?: Sorters;
|
||||
};
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
|
||||
import { PluginError, PluginErrorCode, PluginType, unEscapeStringFromRegex } from '@grafana/data';
|
||||
import { PluginError, PluginErrorCode, unEscapeStringFromRegex } from '@grafana/data';
|
||||
|
||||
import { RequestStatus, PluginCatalogStoreState, PluginTypeFilterOption } from '../types';
|
||||
import { RequestStatus, PluginCatalogStoreState } from '../types';
|
||||
|
||||
import { pluginsAdapter } from './reducer';
|
||||
|
||||
@ -19,20 +19,11 @@ const selectInstalled = (filterBy: string) =>
|
||||
plugins.filter((plugin) => (filterBy === 'installed' ? plugin.isInstalled : !plugin.isCore))
|
||||
);
|
||||
|
||||
const findByInstallAndType = (filterBy: string, filterByType: PluginTypeFilterOption) =>
|
||||
const findByInstallAndType = (filterBy: string, filterByType: string) =>
|
||||
createSelector(selectInstalled(filterBy), (plugins) =>
|
||||
plugins.filter(
|
||||
(plugin) =>
|
||||
filterByType === 'all' ||
|
||||
plugin.type === filterByType ||
|
||||
(filterByType === 'app' && isAppPluginType(plugin.type))
|
||||
)
|
||||
plugins.filter((plugin) => filterByType === 'all' || plugin.type === filterByType)
|
||||
);
|
||||
|
||||
const isAppPluginType = (type: PluginType | undefined) => {
|
||||
return type === PluginType.renderer || type === PluginType.secretsmanager || type === PluginType.app;
|
||||
};
|
||||
|
||||
const findByKeyword = (searchBy: string) =>
|
||||
createSelector(selectAll, (plugins) => {
|
||||
if (searchBy === '') {
|
||||
@ -53,7 +44,7 @@ const findByKeyword = (searchBy: string) =>
|
||||
});
|
||||
});
|
||||
|
||||
export const find = (searchBy: string, filterBy: string, filterByType: PluginTypeFilterOption) =>
|
||||
export const find = (searchBy: string, filterBy: string, filterByType: string) =>
|
||||
createSelector(
|
||||
findByInstallAndType(filterBy, filterByType),
|
||||
findByKeyword(searchBy),
|
||||
|
@ -12,7 +12,6 @@ import { IconName } from '@grafana/ui';
|
||||
import { StoreState, PluginsState } from 'app/types';
|
||||
|
||||
export type PluginTypeCode = 'app' | 'panel' | 'datasource';
|
||||
export type PluginTypeFilterOption = PluginTypeCode | 'all';
|
||||
|
||||
export enum PluginListDisplayMode {
|
||||
Grid = 'grid',
|
||||
|
Loading…
Reference in New Issue
Block a user