RED-5228: fix filters auto expand
This commit is contained in:
parent
1b7a55a892
commit
461a4fbf52
@ -96,8 +96,10 @@ export class AnnotationProcessingService {
|
||||
},
|
||||
skipTranslation: true,
|
||||
};
|
||||
filterMap.set(a.filterKey, childFilter);
|
||||
parentFilter.children.push(new Filter(childFilter));
|
||||
|
||||
const newChildFilter = new Filter(childFilter);
|
||||
filterMap.set(a.filterKey, newChildFilter);
|
||||
parentFilter.children.push(newChildFilter);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -5,20 +5,24 @@ export function handleFilterDelta(oldFilters: INestedFilter[], newFilters: INest
|
||||
const newFiltersDelta = {};
|
||||
for (const newFilter of newFilters) {
|
||||
const oldFilter = oldFilters.find(f => f.id === newFilter.id);
|
||||
if (!oldFilter || oldFilter.matches !== newFilter.matches) {
|
||||
newFiltersDelta[newFilter.id] = {};
|
||||
newFilter.children.forEach(filter => (newFiltersDelta[newFilter.id][filter.id] = {}));
|
||||
}
|
||||
|
||||
if (!oldFilter) {
|
||||
for (const childFilter of newFilter.children) {
|
||||
const oldFilterChild = oldFilter?.children.find(f => f.id === childFilter.id);
|
||||
if (!oldFilterChild || oldFilterChild.matches !== childFilter.matches) {
|
||||
if (!newFiltersDelta[newFilter.id]) {
|
||||
newFiltersDelta[newFilter.id] = {};
|
||||
}
|
||||
newFiltersDelta[newFilter.id][childFilter.id] = {};
|
||||
newFiltersDelta[newFilter.id] = {};
|
||||
newFilter.children.forEach(filter => (newFiltersDelta[newFilter.id][filter.id] = {}));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (oldFilter.matches < newFilter.matches) {
|
||||
newFiltersDelta[newFilter.id] = {};
|
||||
}
|
||||
|
||||
for (const childFilter of newFilter.children) {
|
||||
const oldFilterChild = oldFilter.children.find(f => f.id === childFilter.id);
|
||||
if (!oldFilterChild || oldFilterChild.matches < childFilter.matches) {
|
||||
if (!newFiltersDelta[newFilter.id]) {
|
||||
newFiltersDelta[newFilter.id] = {};
|
||||
}
|
||||
newFiltersDelta[newFilter.id][childFilter.id] = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39,9 +43,8 @@ export function handleFilterDelta(oldFilters: INestedFilter[], newFilters: INest
|
||||
}
|
||||
}
|
||||
}
|
||||
allFilters.forEach(filter => {
|
||||
handleCheckedValue(filter);
|
||||
});
|
||||
|
||||
allFilters.forEach(handleCheckedValue);
|
||||
}
|
||||
|
||||
export const annotationFilterChecker = (file: File, filter: INestedFilter, currentUserId: string) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user