mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-19 14:55:31 +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 {один из}}",
|
"FilterIsEither": "{value, plural, =1 {равен} other {один из}}",
|
||||||
"FilterStatesCount": "{value, plural, =1 {1 состоянию} other {# состояний}}",
|
"FilterStatesCount": "{value, plural, =1 {1 состоянию} other {# состояний}}",
|
||||||
"FilterUpdated": "Фильтр был обновлен",
|
"FilterUpdated": "Фильтр был обновлен",
|
||||||
"FilterRemoved": "Несуществующие значения были удалены из фильтра: {removed}",
|
"FilterRemoved": "Несуществующие значения были удалены из фильтра: {count}",
|
||||||
"Before": "До",
|
"Before": "До",
|
||||||
"After": "После",
|
"After": "После",
|
||||||
"Apply": "Применить",
|
"Apply": "Применить",
|
||||||
|
@ -100,18 +100,20 @@
|
|||||||
const options = clazz.sortingKey !== undefined ? { sort: { [clazz.sortingKey]: SortingOrder.Ascending } } : {}
|
const options = clazz.sortingKey !== undefined ? { sort: { [clazz.sortingKey]: SortingOrder.Ascending } } : {}
|
||||||
objectsPromise = client.findAll(targetClass, resultQuery, options)
|
objectsPromise = client.findAll(targetClass, resultQuery, options)
|
||||||
values = await objectsPromise
|
values = await objectsPromise
|
||||||
|
if (targets.has(undefined)) {
|
||||||
|
values.unshift(undefined)
|
||||||
|
}
|
||||||
if (values.length !== targets.size) {
|
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
|
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)
|
onChange(filter)
|
||||||
addNotification(await translate(view.string.FilterUpdated, {}), filter.key.label, FilterRemovedNotification, {
|
addNotification(await translate(view.string.FilterUpdated, {}), filter.key.label, FilterRemovedNotification, {
|
||||||
description: await translate(view.string.FilterRemoved, { count: oldSize - (filter.value.length ?? 0) })
|
description: await translate(view.string.FilterRemoved, { count: oldSize - (filter.value.length ?? 0) })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (targets.has(undefined)) {
|
|
||||||
values.unshift(undefined)
|
|
||||||
}
|
|
||||||
if (isStatus) {
|
if (isStatus) {
|
||||||
values = groupValues(values as Status[])
|
values = groupValues(values as Status[])
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user