diff --git a/web/ui/package-lock.json b/web/ui/package-lock.json index 644a32d252..9d47a6a43d 100644 --- a/web/ui/package-lock.json +++ b/web/ui/package-lock.json @@ -1599,9 +1599,9 @@ "integrity": "sha512-Z1+ADKY0fxdBE28REraWhUCNy+Bp5UmpK3Tc/5wdCDpY+6fXh8l2csMtbPGaqEBsyGLxJz9wUYGCf+CW9unyvQ==" }, "node_modules/@nexucis/kvsearch": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@nexucis/kvsearch/-/kvsearch-0.4.0.tgz", - "integrity": "sha512-5kWxzjLhCucArZshf0bCcmU61aGFgrm98iG6/LEeKejOuoTq1M7sumcjGQ5FR0xMKQWmwC9mr7OvWgAmolxWSg==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@nexucis/kvsearch/-/kvsearch-0.5.0.tgz", + "integrity": "sha512-7TtH+Ug7o7Cjm8HogsXCgq8JNihINE0zZj7JMJXF5PxhF7MhwC9yHe6Gm4+ckt6seOXOFf+g/cZ6hWtVMiR3cQ==", "dependencies": { "@nexucis/fuzzy": "^0.3.0" } @@ -7270,7 +7270,7 @@ "@fortawesome/free-solid-svg-icons": "^5.7.2", "@fortawesome/react-fontawesome": "^0.1.16", "@nexucis/fuzzy": "^0.3.0", - "@nexucis/kvsearch": "^0.4.0", + "@nexucis/kvsearch": "^0.5.0", "bootstrap": "^4.6.1", "codemirror-promql": "0.19.0", "css.escape": "^1.5.1", @@ -27696,9 +27696,9 @@ "integrity": "sha512-Z1+ADKY0fxdBE28REraWhUCNy+Bp5UmpK3Tc/5wdCDpY+6fXh8l2csMtbPGaqEBsyGLxJz9wUYGCf+CW9unyvQ==" }, "@nexucis/kvsearch": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@nexucis/kvsearch/-/kvsearch-0.4.0.tgz", - "integrity": "sha512-5kWxzjLhCucArZshf0bCcmU61aGFgrm98iG6/LEeKejOuoTq1M7sumcjGQ5FR0xMKQWmwC9mr7OvWgAmolxWSg==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@nexucis/kvsearch/-/kvsearch-0.5.0.tgz", + "integrity": "sha512-7TtH+Ug7o7Cjm8HogsXCgq8JNihINE0zZj7JMJXF5PxhF7MhwC9yHe6Gm4+ckt6seOXOFf+g/cZ6hWtVMiR3cQ==", "requires": { "@nexucis/fuzzy": "^0.3.0" } @@ -29722,7 +29722,7 @@ "@fortawesome/free-solid-svg-icons": "^5.7.2", "@fortawesome/react-fontawesome": "^0.1.16", "@nexucis/fuzzy": "^0.3.0", - "@nexucis/kvsearch": "^0.4.0", + "@nexucis/kvsearch": "^0.5.0", "@testing-library/react-hooks": "^7.0.1", "@types/enzyme": "^3.10.10", "@types/flot": "0.0.32", diff --git a/web/ui/react-app/package.json b/web/ui/react-app/package.json index 497ec4ae7d..bf1ca22c14 100644 --- a/web/ui/react-app/package.json +++ b/web/ui/react-app/package.json @@ -20,7 +20,7 @@ "@fortawesome/free-solid-svg-icons": "^5.7.2", "@fortawesome/react-fontawesome": "^0.1.16", "@nexucis/fuzzy": "^0.3.0", - "@nexucis/kvsearch": "^0.4.0", + "@nexucis/kvsearch": "^0.5.0", "bootstrap": "^4.6.1", "codemirror-promql": "0.19.0", "css.escape": "^1.5.1", diff --git a/web/ui/react-app/src/pages/alerts/AlertContents.tsx b/web/ui/react-app/src/pages/alerts/AlertContents.tsx index 64d0c8f675..affc39df9d 100644 --- a/web/ui/react-app/src/pages/alerts/AlertContents.tsx +++ b/web/ui/react-app/src/pages/alerts/AlertContents.tsx @@ -38,7 +38,7 @@ interface RuleGroup { interval: number; } -const kvSearchRule = new KVSearch({ +const kvSearchRule = new KVSearch({ shouldSort: true, indexedKeys: ['name', 'labels', ['labels', /.*/]], }); @@ -90,7 +90,7 @@ const AlertsContent: FC = ({ groups = [], statsCount }) => { file: group.file, name: group.name, interval: group.interval, - rules: ruleFilterList.map((value) => value.original as unknown as Rule), + rules: ruleFilterList.map((value) => value.original), }); } } diff --git a/web/ui/react-app/src/pages/serviceDiscovery/Services.tsx b/web/ui/react-app/src/pages/serviceDiscovery/Services.tsx index 66fe93061a..ea7fd9462c 100644 --- a/web/ui/react-app/src/pages/serviceDiscovery/Services.tsx +++ b/web/ui/react-app/src/pages/serviceDiscovery/Services.tsx @@ -22,7 +22,7 @@ export interface TargetLabels { isDropped: boolean; } -const kvSearch = new KVSearch({ +const kvSearch = new KVSearch({ shouldSort: true, indexedKeys: ['labels', 'discoveredLabels', ['discoveredLabels', /.*/], ['labels', /.*/]], }); @@ -97,11 +97,7 @@ export const ServiceDiscoveryContent: FC = ({ activeTargets, dropped const handleSearchChange = (e: ChangeEvent) => { if (e.target.value !== '') { const result = kvSearch.filter(e.target.value.trim(), activeTargets); - setActiveTargetList( - result.map((value) => { - return value.original as unknown as Target; - }) - ); + setActiveTargetList(result.map((value) => value.original)); } else { setActiveTargetList(activeTargets); } diff --git a/web/ui/react-app/src/pages/targets/ScrapePoolList.tsx b/web/ui/react-app/src/pages/targets/ScrapePoolList.tsx index 16640dc14e..d401f772c9 100644 --- a/web/ui/react-app/src/pages/targets/ScrapePoolList.tsx +++ b/web/ui/react-app/src/pages/targets/ScrapePoolList.tsx @@ -17,7 +17,7 @@ interface ScrapePoolListProps { activeTargets: Target[]; } -const kvSearch = new KVSearch({ +const kvSearch = new KVSearch({ shouldSort: true, indexedKeys: ['labels', 'scrapePool', ['labels', /.*/]], }); @@ -75,11 +75,7 @@ const ScrapePoolListContent: FC = ({ activeTargets }) => { const handleSearchChange = (e: ChangeEvent) => { if (e.target.value !== '') { const result = kvSearch.filter(e.target.value.trim(), activeTargets); - setTargetList( - result.map((value) => { - return value.original as unknown as Target; - }) - ); + setTargetList(result.map((value) => value.original)); } else { setTargetList(activeTargets); }