From 9494c2cd4f227363f4f17074e69350eef6b86251 Mon Sep 17 00:00:00 2001 From: Jack Westbrook Date: Fri, 30 Jul 2021 13:23:33 +0200 Subject: [PATCH] Plugins: Add filter for plugin type and update search, filter and sort ui (#37301) * feat(catalog): introduce additive filters for plugin type, installed status and search * feat(catalog): prefer FilterInput over custom styled search field * feat(catalog): update Browse page to use new search, filter features * refactor(catalog): keep filters with usePluginsByFilter hook * test(catalog): update tests to reflect new filtering and searching * refactor(catalog): rearrange filterByType radio buttons Co-authored-by: Ryan McKinley * feat(catalog): ntroduce css for responsive filter layout * refactor(catalog): introduce pluginfilter type and give filter methods better names * fix(catalog): default q param to empty string so FiterInput doesn't show clear button on load Co-authored-by: Ryan McKinley --- .../components/FilterInput/FilterInput.tsx | 4 +- .../admin/components/HorizontalGroup.tsx | 23 ++-- .../plugins/admin/components/SearchField.tsx | 29 +--- public/app/features/plugins/admin/helpers.ts | 35 ++--- .../plugins/admin/hooks/usePlugins.tsx | 36 ++--- .../plugins/admin/pages/Browse.test.tsx | 122 ++++++++++++++--- .../features/plugins/admin/pages/Browse.tsx | 124 +++++++++++------- public/app/features/plugins/admin/types.ts | 20 +++ 8 files changed, 248 insertions(+), 145 deletions(-) diff --git a/public/app/core/components/FilterInput/FilterInput.tsx b/public/app/core/components/FilterInput/FilterInput.tsx index 097f75e81f4..b155da7dd9e 100644 --- a/public/app/core/components/FilterInput/FilterInput.tsx +++ b/public/app/core/components/FilterInput/FilterInput.tsx @@ -7,10 +7,11 @@ export interface Props { placeholder?: string; width?: number; onChange: (value: string) => void; + onKeyDown?: (event: React.KeyboardEvent) => void; autoFocus?: boolean; } -export const FilterInput: FC = ({ value, placeholder, width, onChange, autoFocus }) => { +export const FilterInput: FC = ({ value, placeholder, width, onChange, onKeyDown, autoFocus }) => { const suffix = value !== '' ? (