diff --git a/CHANGELOG.md b/CHANGELOG.md index e377ef32b..fbbc160e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan - [#238](https://github.com/kobsio/kobs/pull/238): [core] Refactor frontend code for plugins (change options handling, use `setDetails` instead of `showDetails` and rename plugins options in panels to `pluginOptions`). - [#240](https://github.com/kobsio/kobs/pull/240): [core] Switch from `github.com/sirupsen/logrus` to `go.uber.org/zap` for logging and enrich log lines via `context.Context`. - [#241](https://github.com/kobsio/kobs/pull/241): [core] :warning: _Breaking change:_ :warning: Rework authentication / authorization middleware and adjust the Custom Resource Definition for Users and Teams. +- [#236](https://github.com/kobsio/kobs/pull/236): [core] Improve filtering in select components for various plugins. ## [v0.7.0](https://github.com/kobsio/kobs/releases/tag/v0.7.0) (2021-11-19) diff --git a/plugins/applications/src/components/page/ApplicationsToolbarItemClusters.tsx b/plugins/applications/src/components/page/ApplicationsToolbarItemClusters.tsx index 93a5a20fa..0f454f2fb 100644 --- a/plugins/applications/src/components/page/ApplicationsToolbarItemClusters.tsx +++ b/plugins/applications/src/components/page/ApplicationsToolbarItemClusters.tsx @@ -25,9 +25,14 @@ const ToolbarItemClusters: React.FunctionComponent = onClear={(): void => selectCluster('')} selections={selectedClusters} isOpen={showOptions} + onFilter={(e: React.ChangeEvent | null, value: string): React.ReactElement[] => + clusters + .filter((c) => !value || c.includes(value)) + .map((cluster: string) => ) + } > - {clusters.map((cluster, index) => ( - + {clusters.map((cluster) => ( + ))} ); diff --git a/plugins/applications/src/components/page/ApplicationsToolbarItemNamespaces.tsx b/plugins/applications/src/components/page/ApplicationsToolbarItemNamespaces.tsx index 058986c3a..80c0d61a0 100644 --- a/plugins/applications/src/components/page/ApplicationsToolbarItemNamespaces.tsx +++ b/plugins/applications/src/components/page/ApplicationsToolbarItemNamespaces.tsx @@ -43,9 +43,14 @@ const ToolbarItemNamespaces: React.FunctionComponent selectNamespace('')} selections={selectedNamespaces} isOpen={showOptions} + onFilter={(e: React.ChangeEvent | null, value: string): React.ReactElement[] => + namespaces + .filter((ns) => !value || ns.includes(value)) + .map((namespace: string) => ) + } > - {namespaces.map((namespace, index) => ( - + {namespaces.map((namespace) => ( + ))} ); diff --git a/plugins/flux/src/components/page/PageToolbarItemClusters.tsx b/plugins/flux/src/components/page/PageToolbarItemClusters.tsx index 167e5b0f6..a8ff49120 100644 --- a/plugins/flux/src/components/page/PageToolbarItemClusters.tsx +++ b/plugins/flux/src/components/page/PageToolbarItemClusters.tsx @@ -25,6 +25,11 @@ const ToolbarItemClusters: React.FunctionComponent = onClear={(): void => selectCluster('')} selections={selectedCluster} isOpen={showOptions} + onFilter={(e: React.ChangeEvent | null, value: string): React.ReactElement[] => + clusters + .filter((c) => !value || c.includes(value)) + .map((cluster: string) => ) + } > {clusters.map((cluster, index) => ( diff --git a/plugins/kiali/src/components/page/PageToolbarNamespaces.tsx b/plugins/kiali/src/components/page/PageToolbarNamespaces.tsx index d293738e1..13add7dec 100644 --- a/plugins/kiali/src/components/page/PageToolbarNamespaces.tsx +++ b/plugins/kiali/src/components/page/PageToolbarNamespaces.tsx @@ -54,11 +54,18 @@ const PageToolbarNamespaces: React.FunctionComponent selectNamespace('')} selections={namespaces} isOpen={show} + onFilter={(e: React.ChangeEvent | null, value: string): React.ReactElement[] => + data + ? data + .filter((ns) => !value || ns.includes(value)) + .map((namespace: string) => ) + : [] + } > {isError ? [] : data - ? data.map((namespace, index) => ) + ? data.map((namespace) => ) : []} ); diff --git a/plugins/resources/src/components/page/PageToolbarItemClusters.tsx b/plugins/resources/src/components/page/PageToolbarItemClusters.tsx index 93a5a20fa..0f454f2fb 100644 --- a/plugins/resources/src/components/page/PageToolbarItemClusters.tsx +++ b/plugins/resources/src/components/page/PageToolbarItemClusters.tsx @@ -25,9 +25,14 @@ const ToolbarItemClusters: React.FunctionComponent = onClear={(): void => selectCluster('')} selections={selectedClusters} isOpen={showOptions} + onFilter={(e: React.ChangeEvent | null, value: string): React.ReactElement[] => + clusters + .filter((c) => !value || c.includes(value)) + .map((cluster: string) => ) + } > - {clusters.map((cluster, index) => ( - + {clusters.map((cluster) => ( + ))} ); diff --git a/plugins/resources/src/components/page/PageToolbarItemNamespaces.tsx b/plugins/resources/src/components/page/PageToolbarItemNamespaces.tsx index 058986c3a..80c0d61a0 100644 --- a/plugins/resources/src/components/page/PageToolbarItemNamespaces.tsx +++ b/plugins/resources/src/components/page/PageToolbarItemNamespaces.tsx @@ -43,9 +43,14 @@ const ToolbarItemNamespaces: React.FunctionComponent selectNamespace('')} selections={selectedNamespaces} isOpen={showOptions} + onFilter={(e: React.ChangeEvent | null, value: string): React.ReactElement[] => + namespaces + .filter((ns) => !value || ns.includes(value)) + .map((namespace: string) => ) + } > - {namespaces.map((namespace, index) => ( - + {namespaces.map((namespace) => ( + ))} ); diff --git a/plugins/resources/src/components/page/PageToolbarItemResources.tsx b/plugins/resources/src/components/page/PageToolbarItemResources.tsx index 64d37cf1b..6c39ec45b 100644 --- a/plugins/resources/src/components/page/PageToolbarItemResources.tsx +++ b/plugins/resources/src/components/page/PageToolbarItemResources.tsx @@ -27,6 +27,19 @@ const ToolbarItemResources: React.FunctionComponent onClear={(): void => selectResource('')} selections={selectedResources} isOpen={showOptions} + onFilter={(e: React.ChangeEvent | null, value: string): React.ReactElement[] => + Object.keys(resources) + .filter((key) => !value || key.includes(value)) + .map((key) => ( + + {resources[key].title} + + )) + } > {Object.keys(resources).map((key) => (