Merge branch 'RED-9175' into 'master'
Resolve RED-9175 Closes RED-9175 See merge request redactmanager/red-ui!439
This commit is contained in:
commit
25d8815c17
@ -36,6 +36,7 @@ export class PageExclusionComponent {
|
||||
try {
|
||||
const pageRanges = extractPageRanges(inputValue, file);
|
||||
await this._reanalysisService.excludePages({ pageRanges }, file);
|
||||
this._state.excludedPages.update(value => [...value, ...this.flattenPageRanges(pageRanges)]);
|
||||
this._inputComponent.reset();
|
||||
} catch (e) {
|
||||
this._toaster.error(_('file-preview.tabs.exclude-pages.error'));
|
||||
@ -46,6 +47,7 @@ export class PageExclusionComponent {
|
||||
async includePagesRange(range: IPageRange): Promise<void> {
|
||||
this._loadingService.start();
|
||||
await this._reanalysisService.includePages({ pageRanges: [range] }, this._state.file());
|
||||
this._state.excludedPages.update(value => value.filter(page => !this.flattenPageRanges([range]).includes(page)));
|
||||
this._inputComponent.reset();
|
||||
this._loadingService.stop();
|
||||
}
|
||||
@ -64,4 +66,15 @@ export class PageExclusionComponent {
|
||||
return ranges;
|
||||
}, []);
|
||||
}
|
||||
|
||||
flattenPageRanges(ranges: IPageRange[]) {
|
||||
const flattenedPages = [];
|
||||
ranges.forEach(range => {
|
||||
for (let page = range.startPage; page <= range.endPage; page++) {
|
||||
flattenedPages.push(page);
|
||||
}
|
||||
});
|
||||
|
||||
return flattenedPages;
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,14 +173,17 @@ export class FilePreviewScreenComponent
|
||||
}
|
||||
});
|
||||
|
||||
effect(() => {
|
||||
this._viewModeService.viewMode();
|
||||
this.updateViewMode().then();
|
||||
});
|
||||
|
||||
effect(() => {
|
||||
this.state.updateExcludedPagesStyle();
|
||||
if (this._viewModeService.viewMode()) {
|
||||
this.updateViewMode().then();
|
||||
if (_documentViewer.loaded()) {
|
||||
this._logger.info('[PDF] Stamp pdf');
|
||||
this._stampService.stampPDF().then();
|
||||
}
|
||||
this._viewModeService.viewMode();
|
||||
if (_documentViewer.loaded()) {
|
||||
this._logger.info('[PDF] Stamp pdf');
|
||||
this._stampService.stampPDF().then();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { HttpEvent, HttpEventType, HttpProgressEvent, HttpResponse } from '@angular/common/http';
|
||||
import { computed, effect, inject, Injectable, signal, Signal } from '@angular/core';
|
||||
import { computed, effect, inject, Injectable, signal, Signal, WritableSignal } from '@angular/core';
|
||||
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
||||
import { LoadingService, wipeCache } from '@iqser/common-ui';
|
||||
import { getParam } from '@iqser/common-ui/lib/utils';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Dictionary, Dossier, DOSSIER_ID, DOSSIER_TEMPLATE_ID, File, FILE_ID } from '@red/domain';
|
||||
import { Dictionary, Dossier, DOSSIER_ID, DOSSIER_TEMPLATE_ID, File, FILE_ID, ViewModes } from '@red/domain';
|
||||
import { DossiersService } from '@services/dossiers/dossiers.service';
|
||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||
import { DossierDictionariesMapService } from '@services/entity-services/dossier-dictionaries-map.service';
|
||||
@ -44,7 +44,8 @@ export class FilePreviewStateService {
|
||||
readonly dossierId = getParam(DOSSIER_ID);
|
||||
readonly dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
|
||||
readonly fileId = getParam(FILE_ID);
|
||||
readonly updateExcludedPagesStyle = computed(() => this.file().excludedPages);
|
||||
readonly excludedPages: WritableSignal<number[]>;
|
||||
readonly updateExcludedPagesStyle = computed(() => this.excludedPages());
|
||||
readonly isEditingReviewer = signal(false);
|
||||
|
||||
constructor(
|
||||
@ -61,6 +62,7 @@ export class FilePreviewStateService {
|
||||
this.dossier = toSignal(dossiersServiceResolver().getEntityChanged$(this.dossierId));
|
||||
this.file$ = inject(FilesMapService).watch$(this.dossierId, this.fileId);
|
||||
this.file = toSignal(this.file$);
|
||||
this.excludedPages = signal(this.file().excludedPages);
|
||||
this.isWritable = computed(() => {
|
||||
const isWritable = this._permissionsService.canPerformAnnotationActions(this.file(), this.dossier());
|
||||
this._logger.info('[FILE] Is writeable:', isWritable);
|
||||
@ -80,7 +82,9 @@ export class FilePreviewStateService {
|
||||
effect(
|
||||
() => {
|
||||
if (this._viewModeService.isEarmarks() && !this.file().hasHighlights) {
|
||||
this._viewModeService.switchToStandard();
|
||||
if (this._viewModeService.viewMode() !== ViewModes.STANDARD) {
|
||||
this._viewModeService.switchToStandard();
|
||||
}
|
||||
}
|
||||
},
|
||||
{ allowSignalWrites: true },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user