diff --git a/plugins/tags-resources/src/components/TagsFilter.svelte b/plugins/tags-resources/src/components/TagsFilter.svelte
index 538a86ef7a..1f47fdb803 100644
--- a/plugins/tags-resources/src/components/TagsFilter.svelte
+++ b/plugins/tags-resources/src/components/TagsFilter.svelte
@@ -211,3 +211,10 @@
}}
/>
+
+
diff --git a/plugins/view-assets/lang/en.json b/plugins/view-assets/lang/en.json
index 7422af8f49..6adedec38e 100644
--- a/plugins/view-assets/lang/en.json
+++ b/plugins/view-assets/lang/en.json
@@ -39,6 +39,8 @@
"FilterIsNot": "is not",
"FilterIsEither": "{value, plural, =1 {is} other {is either of}}",
"FilterStatesCount": "{value, plural, =1 {1 state} other {# states}}",
+ "FilterUpdated": "Filter was updated",
+ "FilterRemoved": "{count, plural, =1 {# non-existing value was} other {# non-existing values were}} removed from the filter",
"Before": "Before",
"After": "After",
"Apply": "Apply",
diff --git a/plugins/view-assets/lang/ru.json b/plugins/view-assets/lang/ru.json
index d7eb92d4a4..db825b9c3a 100644
--- a/plugins/view-assets/lang/ru.json
+++ b/plugins/view-assets/lang/ru.json
@@ -37,6 +37,8 @@
"FilterIsNot": "не равен",
"FilterIsEither": "{value, plural, =1 {равен} other {один из}}",
"FilterStatesCount": "{value, plural, =1 {1 состоянию} other {# состояний}}",
+ "FilterUpdated": "Фильтр был обновлен",
+ "FilterRemoved": "Несуществующие значения были удалены из фильтра: {removed}",
"Before": "До",
"After": "После",
"Apply": "Применить",
diff --git a/plugins/view-resources/src/components/filter/FilterRemovedNotification.svelte b/plugins/view-resources/src/components/filter/FilterRemovedNotification.svelte
new file mode 100644
index 0000000000..5b0e46fa55
--- /dev/null
+++ b/plugins/view-resources/src/components/filter/FilterRemovedNotification.svelte
@@ -0,0 +1,63 @@
+
+
+
+
+
+ {title}
+
+
+ {params.description}
+
+
+
+
+
+
+
+
diff --git a/plugins/view-resources/src/components/filter/ObjectFilter.svelte b/plugins/view-resources/src/components/filter/ObjectFilter.svelte
index 61765fcb30..08d0234a5f 100644
--- a/plugins/view-resources/src/components/filter/ObjectFilter.svelte
+++ b/plugins/view-resources/src/components/filter/ObjectFilter.svelte
@@ -18,11 +18,20 @@
import presentation, { getClient } from '@hcengineering/presentation'
import type { State } from '@hcengineering/task'
import task from '@hcengineering/task'
- import ui, { Button, CheckBox, Label, Loading, resizeObserver, deviceOptionsStore } from '@hcengineering/ui'
+ import ui, {
+ Button,
+ CheckBox,
+ Label,
+ Loading,
+ resizeObserver,
+ deviceOptionsStore,
+ addNotification
+ } from '@hcengineering/ui'
import { Filter } from '@hcengineering/view'
import { createEventDispatcher, onMount } from 'svelte'
import view from '../../plugin'
import { buildConfigLookup, getPresenter } from '../../utils'
+ import FilterRemovedNotification from './FilterRemovedNotification.svelte'
export let filter: Filter
export let space: Ref | undefined = undefined
@@ -92,6 +101,15 @@
const options = clazz.sortingKey !== undefined ? { sort: { [clazz.sortingKey]: SortingOrder.Ascending } } : {}
objectsPromise = client.findAll(targetClass, resultQuery, options)
values = await objectsPromise
+ if (values.length !== targets.size) {
+ const notExisting = [...targets.keys()].filter((k) => !values.includes(k))
+ const oldSize = filter.value.length
+ filter.value = filter.value.filter((p) => !notExisting.includes(p))
+ 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)
}
diff --git a/plugins/view-resources/src/components/filter/ValueFilter.svelte b/plugins/view-resources/src/components/filter/ValueFilter.svelte
index ef79514d54..d9a07ae761 100644
--- a/plugins/view-resources/src/components/filter/ValueFilter.svelte
+++ b/plugins/view-resources/src/components/filter/ValueFilter.svelte
@@ -79,6 +79,9 @@
values.set(value, (values.get(value) ?? 0) + 1)
realValues.set(value, (realValues.get(value) ?? new Set()).add(realValue))
}
+ for (const object of filter.value.map((p) => p[0])) {
+ if (!values.has(object)) values.set(object, 0)
+ }
values = values
objectsPromise = undefined
}
diff --git a/plugins/view-resources/src/plugin.ts b/plugins/view-resources/src/plugin.ts
index 2bd37a7e46..63b1b8d1f4 100644
--- a/plugins/view-resources/src/plugin.ts
+++ b/plugins/view-resources/src/plugin.ts
@@ -42,6 +42,8 @@ export default mergeIds(viewId, view, {
FilterIsNot: '' as IntlString,
FilterIsEither: '' as IntlString,
FilterStatesCount: '' as IntlString,
+ FilterRemoved: '' as IntlString,
+ FilterUpdated: '' as IntlString,
Before: '' as IntlString,
After: '' as IntlString,
Apply: '' as IntlString,