RED-3459: only pages without annotations filters
This commit is contained in:
parent
7d0deebff4
commit
1b8bcaa1e4
@ -16,8 +16,8 @@
|
||||
(click)="multiSelectService.activate()"
|
||||
*ngIf="(multiSelectService.enabled$ | async) && (multiSelectInactive$ | async)"
|
||||
class="all-caps-label primary pointer"
|
||||
translate="file-preview.tabs.annotations.select"
|
||||
iqserHelpMode="bulk_select_annotations"
|
||||
translate="file-preview.tabs.annotations.select"
|
||||
></div>
|
||||
|
||||
<iqser-popup-filter
|
||||
@ -153,18 +153,18 @@
|
||||
[class.active-panel]="!pagesPanelActive"
|
||||
[hidden]="excludedPagesService.shown$ | async"
|
||||
class="annotations"
|
||||
id="annotations-list"
|
||||
iqserHasScrollbar
|
||||
tabindex="1"
|
||||
id="annotations-list"
|
||||
>
|
||||
<ng-container *ngIf="activeViewerPage && !displayedAnnotations.get(activeViewerPage)?.length">
|
||||
<iqser-empty-state
|
||||
[horizontalPadding]="24"
|
||||
[text]="'file-preview.no-data.title' | translate"
|
||||
[text]="(displayedPages.length ? noDataI18NKey : resetFiltersI18NKey) | translate"
|
||||
[verticalPadding]="40"
|
||||
icon="iqser:document"
|
||||
>
|
||||
<ng-container *ngIf="currentPageIsExcluded">
|
||||
<ng-container *ngIf="currentPageIsExcluded && displayedPages.length">
|
||||
{{ 'file-preview.tabs.annotations.page-is' | translate }}
|
||||
<a
|
||||
(click)="excludedPagesService.toggle()"
|
||||
@ -173,6 +173,12 @@
|
||||
></a
|
||||
>.
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="displayedPages.length === 0">
|
||||
{{ 'file-preview.tabs.annotations.wrong-filters' | translate }}
|
||||
<a (click)="filterService.reset()" class="with-underline" translate="file-preview.tabs.annotations.reset"></a>
|
||||
{{ 'file-preview.tabs.annotations.the-filters' | translate }}
|
||||
</ng-container>
|
||||
</iqser-empty-state>
|
||||
|
||||
<div *ngIf="displayedPages.length" class="no-annotations-buttons-container mt-32">
|
||||
|
||||
@ -34,6 +34,7 @@ import { MultiSelectService } from '../../services/multi-select.service';
|
||||
import { DocumentInfoService } from '../../services/document-info.service';
|
||||
import { SkippedService } from '../../services/skipped.service';
|
||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
|
||||
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
|
||||
const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
@ -47,6 +48,8 @@ const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
export class FileWorkloadComponent {
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly noDataI18NKey = _('file-preview.no-data.title');
|
||||
readonly resetFiltersI18NKey = _('file-preview.reset-filters');
|
||||
|
||||
displayedAnnotations = new Map<number, AnnotationWrapper[]>();
|
||||
@Input() selectedAnnotations: AnnotationWrapper[];
|
||||
@ -72,14 +75,14 @@ export class FileWorkloadComponent {
|
||||
@ViewChild('quickNavigation') private readonly _quickNavigationElement: ElementRef;
|
||||
|
||||
constructor(
|
||||
readonly excludedPagesService: ExcludedPagesService,
|
||||
readonly multiSelectService: MultiSelectService,
|
||||
readonly documentInfoService: DocumentInfoService,
|
||||
readonly filterService: FilterService,
|
||||
readonly skippedService: SkippedService,
|
||||
readonly state: FilePreviewStateService,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
readonly multiSelectService: MultiSelectService,
|
||||
readonly documentInfoService: DocumentInfoService,
|
||||
readonly excludedPagesService: ExcludedPagesService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _filterService: FilterService,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _annotationProcessingService: AnnotationProcessingService,
|
||||
) {
|
||||
this.displayedAnnotations$ = this._displayedAnnotations$;
|
||||
@ -138,14 +141,18 @@ export class FileWorkloadComponent {
|
||||
}
|
||||
|
||||
private get _displayedAnnotations$(): Observable<Map<number, AnnotationWrapper[]>> {
|
||||
const primary$ = this._filterService.getFilterModels$('primaryFilters');
|
||||
const secondary$ = this._filterService.getFilterModels$('secondaryFilters');
|
||||
const primary$ = this.filterService.getFilterModels$('primaryFilters');
|
||||
const secondary$ = this.filterService.getFilterModels$('secondaryFilters');
|
||||
|
||||
return combineLatest([this._annotations$.asObservable(), primary$, secondary$]).pipe(
|
||||
map(([annotations, primary, secondary]) => this._filterAnnotations(annotations, primary, secondary)),
|
||||
);
|
||||
}
|
||||
|
||||
get #allPages() {
|
||||
return Array.from({ length: this.file?.numberOfPages }, (x, i) => i + 1);
|
||||
}
|
||||
|
||||
private static _scrollToFirstElement(elements: HTMLElement[], mode: 'always' | 'if-needed' = 'if-needed') {
|
||||
if (elements.length > 0) {
|
||||
scrollIntoView(elements[0], {
|
||||
@ -335,11 +342,26 @@ export class FileWorkloadComponent {
|
||||
secondary: INestedFilter[] = [],
|
||||
): Map<number, AnnotationWrapper[]> {
|
||||
if (!primary || primary.length === 0) {
|
||||
this.displayedPages = Array.from({ length: this.file?.numberOfPages }, (x, i) => i + 1);
|
||||
this.displayedPages = this.#allPages;
|
||||
return;
|
||||
}
|
||||
|
||||
this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(annotations, primary, secondary);
|
||||
this.displayedPages = [...this.displayedAnnotations.keys()];
|
||||
const pagesThatDisplayAnnotations = [...this.displayedAnnotations.keys()];
|
||||
const enabledFilters = this.filterService.enabledFlatFilters;
|
||||
if (enabledFilters.some(f => f.id === 'pages-without-annotations')) {
|
||||
if (enabledFilters.length === 1) {
|
||||
this.displayedPages = this.#allPages.filter(page => !pagesThatDisplayAnnotations.includes(page));
|
||||
} else {
|
||||
this.displayedPages = [];
|
||||
}
|
||||
this.displayedAnnotations.clear();
|
||||
} else if (enabledFilters.length) {
|
||||
this.displayedPages = pagesThatDisplayAnnotations;
|
||||
} else {
|
||||
this.displayedPages = this.#allPages;
|
||||
}
|
||||
|
||||
return this.displayedAnnotations;
|
||||
}
|
||||
|
||||
|
||||
@ -435,10 +435,13 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
}
|
||||
|
||||
async downloadOriginalFile(file: File) {
|
||||
const data = await this._fileManagementService
|
||||
.downloadOriginalFile(this.dossierId, this.fileId, 'response', file.cacheIdentifier)
|
||||
.toPromise();
|
||||
download(data, file.filename);
|
||||
const originalFile = this._fileManagementService.downloadOriginalFile(
|
||||
this.dossierId,
|
||||
this.fileId,
|
||||
'response',
|
||||
file.cacheIdentifier,
|
||||
);
|
||||
download(await firstValueFrom(originalFile), file.filename);
|
||||
}
|
||||
|
||||
#deactivateMultiSelect(): void {
|
||||
|
||||
@ -9,6 +9,7 @@ import { IViewedPage } from '@red/domain';
|
||||
@Injectable()
|
||||
export class AnnotationProcessingService {
|
||||
static secondaryAnnotationFilters(viewedPages: IViewedPage[]): INestedFilter[] {
|
||||
const _viewedPages = viewedPages.map(page => page.page);
|
||||
return [
|
||||
{
|
||||
id: 'with-comments',
|
||||
@ -32,7 +33,15 @@ export class AnnotationProcessingService {
|
||||
label: _('filter-menu.unseen-pages'),
|
||||
checked: false,
|
||||
topLevelFilter: true,
|
||||
checker: (annotation: AnnotationWrapper) => !viewedPages.map(page => page.page).includes(annotation.pageNumber),
|
||||
checker: (annotation: AnnotationWrapper) => !_viewedPages.includes(annotation.pageNumber),
|
||||
},
|
||||
{
|
||||
id: 'pages-without-annotations',
|
||||
icon: 'iqser:pages',
|
||||
label: _('filter-menu.pages-without-annotations'),
|
||||
checked: false,
|
||||
topLevelFilter: true,
|
||||
checker: () => true,
|
||||
},
|
||||
].map(item => new NestedFilter(item));
|
||||
}
|
||||
|
||||
@ -1226,9 +1226,12 @@
|
||||
"jump-to-previous": "Jump to Previous",
|
||||
"label": "Workload",
|
||||
"page-is": "This page is",
|
||||
"reset": "reset",
|
||||
"select": "Select",
|
||||
"select-all": "All",
|
||||
"select-none": "None"
|
||||
"select-none": "None",
|
||||
"the-filters": "the filters",
|
||||
"wrong-filters": "The selected filter combination is not possible. Please adjust or"
|
||||
},
|
||||
"document-info": {
|
||||
"close": "Close Document Info",
|
||||
@ -1284,6 +1287,7 @@
|
||||
"filter-options": "Filter options",
|
||||
"filter-types": "Filter",
|
||||
"label": "Filter",
|
||||
"pages-without-annotations": "Only pages without annotations",
|
||||
"redaction-changes": "Only annotations with redaction changes",
|
||||
"unseen-pages": "Only annotations on unseen pages",
|
||||
"with-comments": "Only annotations with comments"
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit e2f85365512c68b927465ee5fe4c0d8e3d5dfe1a
|
||||
Subproject commit 174b239f26e9b877648f5c63432abf8c9bb97654
|
||||
Loading…
x
Reference in New Issue
Block a user