mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +00:00
Fix filter remove (#2888)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
5cf989b314
commit
febbb0cd08
@ -38,7 +38,7 @@
|
||||
"FilterIsEither": "{value, plural, =1 {равен} other {один из}}",
|
||||
"FilterStatesCount": "{value, plural, =1 {1 состоянию} other {# состояний}}",
|
||||
"FilterUpdated": "Фильтр был обновлен",
|
||||
"FilterRemoved": "Несуществующие значения были удалены из фильтра: {removed}",
|
||||
"FilterRemoved": "Несуществующие значения были удалены из фильтра: {count}",
|
||||
"Before": "До",
|
||||
"After": "После",
|
||||
"Apply": "Применить",
|
||||
|
@ -100,18 +100,20 @@
|
||||
const options = clazz.sortingKey !== undefined ? { sort: { [clazz.sortingKey]: SortingOrder.Ascending } } : {}
|
||||
objectsPromise = client.findAll(targetClass, resultQuery, options)
|
||||
values = await objectsPromise
|
||||
if (targets.has(undefined)) {
|
||||
values.unshift(undefined)
|
||||
}
|
||||
if (values.length !== targets.size) {
|
||||
const notExisting = [...targets.keys()].filter((k) => !values.includes(k))
|
||||
for (const value of values) {
|
||||
targets.delete(value?._id)
|
||||
}
|
||||
const oldSize = filter.value.length
|
||||
filter.value = filter.value.filter((p) => !notExisting.includes(p))
|
||||
filter.value = filter.value.filter((p) => !targets.has(p._id))
|
||||
onChange(filter)
|
||||
addNotification(await translate(view.string.FilterUpdated, {}), filter.key.label, FilterRemovedNotification, {
|
||||
description: await translate(view.string.FilterRemoved, { count: oldSize - (filter.value.length ?? 0) })
|
||||
})
|
||||
}
|
||||
if (targets.has(undefined)) {
|
||||
values.unshift(undefined)
|
||||
}
|
||||
if (isStatus) {
|
||||
values = groupValues(values as Status[])
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user