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>
pull/10276/head^2
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=="
},
"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",

View File

@ -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",

View File

@ -38,7 +38,7 @@ interface RuleGroup {
interval: number;
}
const kvSearchRule = new KVSearch({
const kvSearchRule = new KVSearch<Rule>({
shouldSort: true,
indexedKeys: ['name', 'labels', ['labels', /.*/]],
});
@ -90,7 +90,7 @@ const AlertsContent: FC<AlertsProps> = ({ 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),
});
}
}

View File

@ -22,7 +22,7 @@ export interface TargetLabels {
isDropped: boolean;
}
const kvSearch = new KVSearch({
const kvSearch = new KVSearch<Target>({
shouldSort: true,
indexedKeys: ['labels', 'discoveredLabels', ['discoveredLabels', /.*/], ['labels', /.*/]],
});
@ -97,11 +97,7 @@ export const ServiceDiscoveryContent: FC<ServiceMap> = ({ activeTargets, dropped
const handleSearchChange = (e: ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => {
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);
}

View File

@ -17,7 +17,7 @@ interface ScrapePoolListProps {
activeTargets: Target[];
}
const kvSearch = new KVSearch({
const kvSearch = new KVSearch<Target>({
shouldSort: true,
indexedKeys: ['labels', 'scrapePool', ['labels', /.*/]],
});
@ -75,11 +75,7 @@ const ScrapePoolListContent: FC<ScrapePoolListProps> = ({ activeTargets }) => {
const handleSearchChange = (e: ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => {
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);
}