Skip to content

Commit

Permalink
fix(ClustersMenu): the page should not be broken with '[' filter [YTF…
Browse files Browse the repository at this point in the history
…RONT-4272]
  • Loading branch information
ma-efremoff committed Jul 22, 2024
1 parent 5b50d45 commit 7eb5c7c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/ui/src/ui/containers/ClustersMenu/ClustersMenuBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,16 @@ class ClustersMenuBody extends React.Component<Props> {

render() {
const {viewMode, clusterFilter, clusters} = this.props;
const regexp = new RegExp(clusterFilter, 'i');
let regexp: RegExp | undefined;
try {
regexp = new RegExp(clusterFilter, 'i');
} catch {}

const filterByField = (field?: string) => {
return typeof field === 'string' && field.search(regexp) > -1;
return (
typeof field === 'string' &&
(regexp ? field.search(regexp) > -1 : field.indexOf(clusterFilter) > -1)
);
};

const filteredClusters = _.filter(clusters, ({id, version, environment}) => {
Expand Down

0 comments on commit 7eb5c7c

Please # to comment.