bump kvsearch to v0.5.0 that support generic type. It removes unnecessary cast in the process (#10296)

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
This commit is contained in:
Augustin Husson 2022-02-21 15:37:28 +01:00 committed by GitHub
parent e239e3ee8b
commit 779a9118db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 23 deletions

View file

@ -1599,9 +1599,9 @@
"integrity": "sha512-Z1+ADKY0fxdBE28REraWhUCNy+Bp5UmpK3Tc/5wdCDpY+6fXh8l2csMtbPGaqEBsyGLxJz9wUYGCf+CW9unyvQ==" "integrity": "sha512-Z1+ADKY0fxdBE28REraWhUCNy+Bp5UmpK3Tc/5wdCDpY+6fXh8l2csMtbPGaqEBsyGLxJz9wUYGCf+CW9unyvQ=="
}, },
"node_modules/@nexucis/kvsearch": { "node_modules/@nexucis/kvsearch": {
"version": "0.4.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/@nexucis/kvsearch/-/kvsearch-0.4.0.tgz", "resolved": "https://registry.npmjs.org/@nexucis/kvsearch/-/kvsearch-0.5.0.tgz",
"integrity": "sha512-5kWxzjLhCucArZshf0bCcmU61aGFgrm98iG6/LEeKejOuoTq1M7sumcjGQ5FR0xMKQWmwC9mr7OvWgAmolxWSg==", "integrity": "sha512-7TtH+Ug7o7Cjm8HogsXCgq8JNihINE0zZj7JMJXF5PxhF7MhwC9yHe6Gm4+ckt6seOXOFf+g/cZ6hWtVMiR3cQ==",
"dependencies": { "dependencies": {
"@nexucis/fuzzy": "^0.3.0" "@nexucis/fuzzy": "^0.3.0"
} }
@ -7270,7 +7270,7 @@
"@fortawesome/free-solid-svg-icons": "^5.7.2", "@fortawesome/free-solid-svg-icons": "^5.7.2",
"@fortawesome/react-fontawesome": "^0.1.16", "@fortawesome/react-fontawesome": "^0.1.16",
"@nexucis/fuzzy": "^0.3.0", "@nexucis/fuzzy": "^0.3.0",
"@nexucis/kvsearch": "^0.4.0", "@nexucis/kvsearch": "^0.5.0",
"bootstrap": "^4.6.1", "bootstrap": "^4.6.1",
"codemirror-promql": "0.19.0", "codemirror-promql": "0.19.0",
"css.escape": "^1.5.1", "css.escape": "^1.5.1",
@ -27696,9 +27696,9 @@
"integrity": "sha512-Z1+ADKY0fxdBE28REraWhUCNy+Bp5UmpK3Tc/5wdCDpY+6fXh8l2csMtbPGaqEBsyGLxJz9wUYGCf+CW9unyvQ==" "integrity": "sha512-Z1+ADKY0fxdBE28REraWhUCNy+Bp5UmpK3Tc/5wdCDpY+6fXh8l2csMtbPGaqEBsyGLxJz9wUYGCf+CW9unyvQ=="
}, },
"@nexucis/kvsearch": { "@nexucis/kvsearch": {
"version": "0.4.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/@nexucis/kvsearch/-/kvsearch-0.4.0.tgz", "resolved": "https://registry.npmjs.org/@nexucis/kvsearch/-/kvsearch-0.5.0.tgz",
"integrity": "sha512-5kWxzjLhCucArZshf0bCcmU61aGFgrm98iG6/LEeKejOuoTq1M7sumcjGQ5FR0xMKQWmwC9mr7OvWgAmolxWSg==", "integrity": "sha512-7TtH+Ug7o7Cjm8HogsXCgq8JNihINE0zZj7JMJXF5PxhF7MhwC9yHe6Gm4+ckt6seOXOFf+g/cZ6hWtVMiR3cQ==",
"requires": { "requires": {
"@nexucis/fuzzy": "^0.3.0" "@nexucis/fuzzy": "^0.3.0"
} }
@ -29722,7 +29722,7 @@
"@fortawesome/free-solid-svg-icons": "^5.7.2", "@fortawesome/free-solid-svg-icons": "^5.7.2",
"@fortawesome/react-fontawesome": "^0.1.16", "@fortawesome/react-fontawesome": "^0.1.16",
"@nexucis/fuzzy": "^0.3.0", "@nexucis/fuzzy": "^0.3.0",
"@nexucis/kvsearch": "^0.4.0", "@nexucis/kvsearch": "^0.5.0",
"@testing-library/react-hooks": "^7.0.1", "@testing-library/react-hooks": "^7.0.1",
"@types/enzyme": "^3.10.10", "@types/enzyme": "^3.10.10",
"@types/flot": "0.0.32", "@types/flot": "0.0.32",

View file

@ -20,7 +20,7 @@
"@fortawesome/free-solid-svg-icons": "^5.7.2", "@fortawesome/free-solid-svg-icons": "^5.7.2",
"@fortawesome/react-fontawesome": "^0.1.16", "@fortawesome/react-fontawesome": "^0.1.16",
"@nexucis/fuzzy": "^0.3.0", "@nexucis/fuzzy": "^0.3.0",
"@nexucis/kvsearch": "^0.4.0", "@nexucis/kvsearch": "^0.5.0",
"bootstrap": "^4.6.1", "bootstrap": "^4.6.1",
"codemirror-promql": "0.19.0", "codemirror-promql": "0.19.0",
"css.escape": "^1.5.1", "css.escape": "^1.5.1",

View file

@ -38,7 +38,7 @@ interface RuleGroup {
interval: number; interval: number;
} }
const kvSearchRule = new KVSearch({ const kvSearchRule = new KVSearch<Rule>({
shouldSort: true, shouldSort: true,
indexedKeys: ['name', 'labels', ['labels', /.*/]], indexedKeys: ['name', 'labels', ['labels', /.*/]],
}); });
@ -90,7 +90,7 @@ const AlertsContent: FC<AlertsProps> = ({ groups = [], statsCount }) => {
file: group.file, file: group.file,
name: group.name, name: group.name,
interval: group.interval, interval: group.interval,
rules: ruleFilterList.map((value) => value.original as unknown as Rule), rules: ruleFilterList.map((value) => value.original),
}); });
} }
} }

View file

@ -22,7 +22,7 @@ export interface TargetLabels {
isDropped: boolean; isDropped: boolean;
} }
const kvSearch = new KVSearch({ const kvSearch = new KVSearch<Target>({
shouldSort: true, shouldSort: true,
indexedKeys: ['labels', 'discoveredLabels', ['discoveredLabels', /.*/], ['labels', /.*/]], indexedKeys: ['labels', 'discoveredLabels', ['discoveredLabels', /.*/], ['labels', /.*/]],
}); });
@ -97,11 +97,7 @@ export const ServiceDiscoveryContent: FC<ServiceMap> = ({ activeTargets, dropped
const handleSearchChange = (e: ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => { const handleSearchChange = (e: ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => {
if (e.target.value !== '') { if (e.target.value !== '') {
const result = kvSearch.filter(e.target.value.trim(), activeTargets); const result = kvSearch.filter(e.target.value.trim(), activeTargets);
setActiveTargetList( setActiveTargetList(result.map((value) => value.original));
result.map((value) => {
return value.original as unknown as Target;
})
);
} else { } else {
setActiveTargetList(activeTargets); setActiveTargetList(activeTargets);
} }

View file

@ -17,7 +17,7 @@ interface ScrapePoolListProps {
activeTargets: Target[]; activeTargets: Target[];
} }
const kvSearch = new KVSearch({ const kvSearch = new KVSearch<Target>({
shouldSort: true, shouldSort: true,
indexedKeys: ['labels', 'scrapePool', ['labels', /.*/]], indexedKeys: ['labels', 'scrapePool', ['labels', /.*/]],
}); });
@ -75,11 +75,7 @@ const ScrapePoolListContent: FC<ScrapePoolListProps> = ({ activeTargets }) => {
const handleSearchChange = (e: ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => { const handleSearchChange = (e: ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => {
if (e.target.value !== '') { if (e.target.value !== '') {
const result = kvSearch.filter(e.target.value.trim(), activeTargets); const result = kvSearch.filter(e.target.value.trim(), activeTargets);
setTargetList( setTargetList(result.map((value) => value.original));
result.map((value) => {
return value.original as unknown as Target;
})
);
} else { } else {
setTargetList(activeTargets); setTargetList(activeTargets);
} }