RED-6412, add detech changes, simplify methods, remove additional pipes.
This commit is contained in:
parent
75e54429fe
commit
fdae158755
@ -12,6 +12,7 @@ import {
|
||||
IconButtonTypes,
|
||||
INestedFilter,
|
||||
IqserEventTarget,
|
||||
log,
|
||||
shareDistinctLast,
|
||||
shareLast,
|
||||
} from '@iqser/common-ui';
|
||||
@ -158,15 +159,13 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnDestroy
|
||||
this.fileDataService.all$,
|
||||
primary$,
|
||||
secondary$,
|
||||
this.multiSelectService.active$.pipe(distinctUntilChanged()),
|
||||
this.listingService.selected$,
|
||||
this.multiSelectService.active$,
|
||||
]).pipe(
|
||||
delay(0),
|
||||
map(
|
||||
([annotations, primary, secondary, multiSelectInactive]) =>
|
||||
[this._filterAnnotations(annotations, primary, secondary), multiSelectInactive] as const,
|
||||
),
|
||||
this._mapListItemsFromAnnotationWrapperArray(),
|
||||
map(([annotations, primary, secondary]) => this._filterAnnotations(annotations, primary, secondary)),
|
||||
map(annotations => this._mapListItemsFromAnnotationWrapperArray(annotations)),
|
||||
tap(() => this._changeDetectorRef.detectChanges()),
|
||||
);
|
||||
}
|
||||
|
||||
@ -469,23 +468,19 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnDestroy
|
||||
}
|
||||
}
|
||||
|
||||
private _mapListItemsFromAnnotationWrapperArray() {
|
||||
return pipe(
|
||||
map(([annotations, multiSelectActive]) => {
|
||||
const listItemsMap = new Map<number, ListItem<AnnotationWrapper>[]>();
|
||||
if (!annotations) {
|
||||
return listItemsMap;
|
||||
}
|
||||
[...annotations.keys()].forEach(key => {
|
||||
const newValue = annotations.get(key).map(annotation => ({
|
||||
item: annotation,
|
||||
isSelected: this.listingService.isSelected(annotation),
|
||||
multiSelectActive,
|
||||
}));
|
||||
listItemsMap.set(key, newValue);
|
||||
});
|
||||
return listItemsMap;
|
||||
}),
|
||||
);
|
||||
private _mapListItemsFromAnnotationWrapperArray(annotations: Map<number, AnnotationWrapper[]>) {
|
||||
const listItemsMap = new Map<number, ListItem<AnnotationWrapper>[]>();
|
||||
if (!annotations) {
|
||||
return listItemsMap;
|
||||
}
|
||||
[...annotations.keys()].forEach(key => {
|
||||
const newValue = annotations.get(key).map(annotation => ({
|
||||
item: annotation,
|
||||
isSelected: this.listingService.isSelected(annotation),
|
||||
multiSelectActive: this.multiSelectService.isActive,
|
||||
}));
|
||||
listItemsMap.set(key, newValue);
|
||||
});
|
||||
return listItemsMap;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user