Rename debouncedSearch -> search in buildAlertsPageData

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2024-08-28 15:03:16 +02:00
parent d3b6b0f288
commit 4ce71af1b9

View file

@ -68,7 +68,7 @@ const kvSearch = new KVSearch<AlertingRule>({
const buildAlertsPageData = ( const buildAlertsPageData = (
data: AlertingRulesResult, data: AlertingRulesResult,
debouncedSearch: string, search: string,
stateFilter: (string | null)[] stateFilter: (string | null)[]
) => { ) => {
const pageData: AlertsPageData = { const pageData: AlertsPageData = {
@ -109,11 +109,9 @@ const buildAlertsPageData = (
} }
const filteredRules: AlertingRule[] = ( const filteredRules: AlertingRule[] = (
debouncedSearch === "" search === ""
? group.rules ? group.rules
: kvSearch : kvSearch.filter(search, group.rules).map((value) => value.original)
.filter(debouncedSearch, group.rules)
.map((value) => value.original)
).filter((r) => stateFilter.length === 0 || stateFilter.includes(r.state)); ).filter((r) => stateFilter.length === 0 || stateFilter.includes(r.state));
pageData.groups.push({ pageData.groups.push({