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