Merge branch 'VM/RED-10504' into 'master'

RED-10504 - displayed all file annotations on documine when devMode is active...

Closes RED-10504

See merge request redactmanager/red-ui!721
This commit is contained in:
Nicoleta Panaghiu 2024-11-24 11:19:09 +01:00
commit 820dab3bfb
6 changed files with 30 additions and 17 deletions

View File

@ -146,7 +146,7 @@
id="annotations-list"
tabindex="1"
>
<ng-container *ngIf="pdf.currentPage() && !displayedAnnotations().get(pdf.currentPage())?.length">
<ng-container *ngIf="pdf.currentPage() && !displayedAnnotations().get(currentAnnotationsPage)?.length">
<iqser-empty-state
[horizontalPadding]="24"
[text]="'file-preview.no-data.title' | translate"

View File

@ -60,6 +60,7 @@ import { PagesComponent } from '../pages/pages.component';
import { ReadonlyBannerComponent } from '../readonly-banner/readonly-banner.component';
import { DocumentInfoComponent } from '../document-info/document-info.component';
import { getLast } from '@utils/functions';
import { ALL_ANNOTATIONS_PAGE } from '../../utils/constants';
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
@ -158,7 +159,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
this.filteredAnnotations$ = this._filteredAnnotations$;
this.annotationsList$ = combineLatest([this.filteredAnnotations$, this.pdf.currentPage$]).pipe(
map(([annotations, page]) => annotations.get(page)),
map(([annotations]) => annotations.get(this.currentAnnotationsPage)),
);
effect(() => {
@ -455,19 +456,24 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
this.displayedAnnotations.set(this._annotationProcessingService.filterAndGroupAnnotations(annotations, primary, secondary));
const pagesThatDisplayAnnotations = [...this.displayedAnnotations().keys()];
this.enabledFilters = this.filterService.enabledFlatFilters;
if (this.enabledFilters.some(f => f.id === 'pages-without-annotations')) {
if (this.enabledFilters.length === 1 && !onlyPageWithAnnotations) {
const pages = allPages.filter(page => !pagesThatDisplayAnnotations.includes(page));
this.#setDisplayedPages(pages);
} else {
this.#setDisplayedPages([]);
}
this.displayedAnnotations().clear();
} else if (this.enabledFilters.length || onlyPageWithAnnotations || componentReferenceIds) {
this.#setDisplayedPages(pagesThatDisplayAnnotations);
} else {
if (this.isDocumine && this.#isIqserDevMode) {
this.#setDisplayedPages(allPages);
} else {
if (this.enabledFilters.some(f => f.id === 'pages-without-annotations')) {
if (this.enabledFilters.length === 1 && !onlyPageWithAnnotations) {
const pages = allPages.filter(page => !pagesThatDisplayAnnotations.includes(page));
this.#setDisplayedPages(pages);
} else {
this.#setDisplayedPages([]);
}
this.displayedAnnotations().clear();
} else if (this.enabledFilters.length || onlyPageWithAnnotations || componentReferenceIds) {
this.#setDisplayedPages(pagesThatDisplayAnnotations);
} else {
this.#setDisplayedPages(allPages);
}
}
this.displayedPages.sort((a, b) => a - b);
return this.displayedAnnotations();
@ -590,6 +596,10 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
);
}
get currentAnnotationsPage() {
return this.isDocumine && this.#isIqserDevMode ? ALL_ANNOTATIONS_PAGE : this.pdf.currentPage();
}
@HostListener('click', ['$event'])
clickInsideWorkloadView($event: MouseEvent) {
$event?.stopPropagation();

View File

@ -1,7 +1,7 @@
<div *ngIf="viewedPages$ | async as viewedPages" class="pages" id="pages" [attr.help-mode-key]="'workload_page_list'">
<redaction-page-indicator
(pageSelected)="pageSelectedByClick($event)"
*ngFor="let pageNumber of pages; trackBy: trackBy"
*ngFor="let pageNumber of pages(); trackBy: trackBy"
[activeSelection]="pageHasSelection(pageNumber)"
[number]="pageNumber"
[read]="!!getViewedPage(viewedPages, pageNumber)"

View File

@ -1,5 +1,5 @@
import { AsyncPipe, NgForOf, NgIf } from '@angular/common';
import { AfterViewInit, Component, inject, Input } from '@angular/core';
import { AfterViewInit, Component, inject, input, Input } from '@angular/core';
import { List } from '@iqser/common-ui/lib/utils';
import { ViewedPage } from '@red/domain';
import { ViewedPagesMapService } from '@services/files/viewed-pages-map.service';
@ -22,7 +22,7 @@ export class PagesComponent implements AfterViewInit {
readonly #multiSelectService = inject(MultiSelectService);
readonly #listingService = inject(AnnotationsListingService);
protected readonly _pdf = inject(PdfViewer);
@Input({ required: true }) pages: List<number>;
readonly pages = input.required<List<number>>();
readonly viewedPages$ = inject(ViewedPagesMapService).get$(this.#state.fileId);
ngAfterViewInit() {

View File

@ -19,6 +19,7 @@ import {
} from '../utils/sort-by-page-rotation.utils';
import { FileDataService } from './file-data.service';
import { FilePreviewStateService } from './file-preview-state.service';
import { ALL_ANNOTATIONS_PAGE } from '../utils/constants';
@Injectable()
export class AnnotationProcessingService {
@ -167,7 +168,7 @@ export class AnnotationProcessingService {
continue;
}
const pageNumber = annotation.pageNumber;
const pageNumber = this.#devMode && this.#isDocumine ? ALL_ANNOTATIONS_PAGE : annotation.pageNumber;
if (!obj.has(pageNumber)) {
obj.set(pageNumber, []);

View File

@ -73,3 +73,5 @@ export const ANNOTATION_ACTIONS = [
'Hide',
'Ausblenden',
] as const;
export const ALL_ANNOTATIONS_PAGE = 0;