viewed pages cleanup
This commit is contained in:
parent
85351e3bc7
commit
5da318496d
@ -117,9 +117,10 @@ export class FileDataModel {
|
||||
const relevantChanges = redactionLogEntry.changes.filter(change => moment(change.dateTime).valueOf() > viewTime);
|
||||
// at least one unseen change
|
||||
if (relevantChanges.length > 0) {
|
||||
// at least 1 relevant change
|
||||
wrapper.changeLogType = relevantChanges[relevantChanges.length - 1].type;
|
||||
wrapper.isChangeLogEntry = true;
|
||||
viewedPage.hasChanges = true;
|
||||
viewedPage.showAsUnseen = moment(viewedPage.viewedTime).valueOf() < moment(lastChange.dateTime).valueOf();
|
||||
this.hasChangeLog = true;
|
||||
} else {
|
||||
// no relevant changes - hide removed anyway
|
||||
|
||||
@ -127,7 +127,6 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
||||
.setFileAttributesConfig(newValue, this._dossierTemplatesService.activeDossierTemplateId)
|
||||
.toPromise()
|
||||
.catch(error => {
|
||||
console.log('error');
|
||||
if (error.status === HttpStatusCode.Conflict) {
|
||||
this._toaster.error(_('file-attributes-listing.error.conflict'));
|
||||
} else {
|
||||
|
||||
@ -94,6 +94,7 @@
|
||||
<mat-icon svgIcon="red:nav-first"></mat-icon>
|
||||
</div>
|
||||
|
||||
{{activeViewerPage}}
|
||||
<div class="pages" id="pages">
|
||||
<redaction-page-indicator
|
||||
(pageSelected)="pageSelectedByClick($event)"
|
||||
|
||||
@ -161,7 +161,7 @@ export class FileWorkloadComponent {
|
||||
}
|
||||
|
||||
hasOnlyManualRedactionsAndIsExcluded(pageNumber: number): boolean {
|
||||
const hasOnlyManualRedactions = this.displayedAnnotations.get(pageNumber).every(annotation => annotation.manual);
|
||||
const hasOnlyManualRedactions = this.displayedAnnotations.get(pageNumber)?.every(annotation => annotation.manual);
|
||||
return hasOnlyManualRedactions && this.file.excludedPages.includes(pageNumber);
|
||||
}
|
||||
|
||||
@ -280,7 +280,7 @@ export class FileWorkloadComponent {
|
||||
if (!this._firstSelectedAnnotation || this.activeViewerPage !== this._firstSelectedAnnotation.pageNumber) {
|
||||
if (this.displayedPages.indexOf(this.activeViewerPage) !== -1) {
|
||||
// Displayed page has annotations
|
||||
return this.selectAnnotations.emit([this.activeAnnotations[0]]);
|
||||
return this.selectAnnotations.emit(this.activeAnnotations ? [this.activeAnnotations[0]] : null);
|
||||
}
|
||||
// Displayed page doesn't have annotations
|
||||
if ($event.key === 'ArrowDown') {
|
||||
@ -337,7 +337,8 @@ export class FileWorkloadComponent {
|
||||
primary: INestedFilter[],
|
||||
secondary: INestedFilter[] = [],
|
||||
): Map<number, AnnotationWrapper[]> {
|
||||
if (!primary) {
|
||||
if (!primary || primary.length === 0) {
|
||||
this.displayedPages = Array.from({ length: this.file?.numberOfPages }, (x, i) => i + 1);
|
||||
return;
|
||||
}
|
||||
this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(annotations, primary, secondary);
|
||||
|
||||
@ -24,6 +24,7 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy
|
||||
@Output() readonly pageSelected = new EventEmitter<number>();
|
||||
|
||||
pageReadTimeout: number = null;
|
||||
read = false;
|
||||
|
||||
constructor(
|
||||
private readonly _viewedPagesService: ViewedPagesService,
|
||||
@ -39,16 +40,17 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy
|
||||
return this.viewedPages?.find(p => p.page === this.number);
|
||||
}
|
||||
|
||||
get read() {
|
||||
private _setReadState() {
|
||||
const activePage = this.activePage;
|
||||
if (!activePage) {
|
||||
return false;
|
||||
this.read = false;
|
||||
} else {
|
||||
return !activePage.hasChanges;
|
||||
this.read = !activePage.showAsUnseen;
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
this._setReadState();
|
||||
this.handlePageRead();
|
||||
}
|
||||
|
||||
@ -83,10 +85,11 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy
|
||||
private async _markPageRead() {
|
||||
await this._viewedPagesService.addPage({ page: this.number }, this.file.dossierId, this.file.fileId).toPromise();
|
||||
if (this.activePage) {
|
||||
this.activePage.hasChanges = false;
|
||||
this.activePage.showAsUnseen = false;
|
||||
} else {
|
||||
this.viewedPages?.push({ page: this.number, fileId: this.file.fileId });
|
||||
}
|
||||
this._setReadState();
|
||||
}
|
||||
|
||||
private async _markPageUnread() {
|
||||
@ -95,5 +98,6 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy
|
||||
this.viewedPages?.findIndex(p => p.page === this.number),
|
||||
1,
|
||||
);
|
||||
this._setReadState();
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
private _setInitialDisplayMode() {
|
||||
this.instance.UI.setFitMode('FitPage');
|
||||
const instanceDisplayMode = this.documentViewer.getDisplayModeManager().getDisplayMode();
|
||||
instanceDisplayMode.mode = this.viewModeService.isStandard ? 'Single' : 'Facing';
|
||||
instanceDisplayMode.mode = this.viewModeService.isCompare ? 'Facing' : 'Single';
|
||||
this.documentViewer.getDisplayModeManager().setDisplayMode(instanceDisplayMode);
|
||||
}
|
||||
|
||||
|
||||
@ -74,6 +74,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
selectedAnnotations: AnnotationWrapper[] = [];
|
||||
hideSkipped = false;
|
||||
displayPdfViewer = false;
|
||||
activeViewerPage : number = null;
|
||||
@ViewChild(PdfViewerComponent) readonly viewerComponent: PdfViewerComponent;
|
||||
readonly dossierId: string;
|
||||
readonly canPerformAnnotationActions$: Observable<boolean>;
|
||||
@ -145,12 +146,15 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
get activeViewerPage(): number {
|
||||
|
||||
|
||||
private _setActiveViewerPage() {
|
||||
const currentPage = this._instance?.Core.documentViewer?.getCurrentPage();
|
||||
if (!currentPage) {
|
||||
return 0;
|
||||
this.activeViewerPage = 0;
|
||||
} else {
|
||||
this.activeViewerPage = this.viewModeService.isCompare ? currentPage % 2 === 0 ? currentPage / 2 : (currentPage + 1) / 2 : currentPage;
|
||||
}
|
||||
return this.viewModeService.isStandard ? currentPage : currentPage % 2 === 0 ? currentPage / 2 : (currentPage + 1) / 2;
|
||||
}
|
||||
|
||||
private get _canPerformAnnotationActions$() {
|
||||
@ -288,9 +292,9 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
@Debounce(10)
|
||||
selectAnnotations(annotations?: AnnotationWrapper[]) {
|
||||
if (annotations) {
|
||||
this.viewerComponent?.utils.selectAnnotations(annotations, this.multiSelectService.isActive);
|
||||
this.viewerComponent?.utils?.selectAnnotations(annotations, this.multiSelectService.isActive);
|
||||
} else {
|
||||
this.viewerComponent?.utils.deselectAllAnnotations();
|
||||
this.viewerComponent?.utils?.deselectAllAnnotations();
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,6 +320,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
response.manualRedactionEntryWrapper.rectId,
|
||||
);
|
||||
this._instance.Core.annotationManager.deleteAnnotation(annotation);
|
||||
// await this._filesService.reload(this.dossierId, this.fileId).toPromise();
|
||||
const distinctPages = manualRedactionEntryWrapper.manualRedactionEntry.positions
|
||||
.map(p => p.page)
|
||||
.filter((item, pos, self) => self.indexOf(item) === pos);
|
||||
@ -388,6 +393,8 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
};
|
||||
this._router.navigate([], extras).then();
|
||||
|
||||
|
||||
this._setActiveViewerPage();
|
||||
this._changeDetectorRef.markForCheck();
|
||||
}
|
||||
|
||||
@ -407,7 +414,9 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
if (pageNumber) {
|
||||
setTimeout(() => {
|
||||
this.selectPage(parseInt(pageNumber, 10));
|
||||
this._setActiveViewerPage();
|
||||
this._scrollViews();
|
||||
this._changeDetectorRef.markForCheck();
|
||||
this._loadingService.stop();
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -120,7 +120,10 @@ export class PdfViewerUtils {
|
||||
this._annotationManager.deselectAllAnnotations();
|
||||
}
|
||||
|
||||
selectAnnotations(annotations: AnnotationWrapper[], multiSelectActive: boolean) {
|
||||
selectAnnotations(annotations?: AnnotationWrapper[], multiSelectActive: boolean = false) {
|
||||
if (!annotations){
|
||||
return;
|
||||
}
|
||||
if (!multiSelectActive) {
|
||||
this.deselectAllAnnotations();
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"ADMIN_CONTACT_NAME": null,
|
||||
"ADMIN_CONTACT_URL": null,
|
||||
"API_URL": "https://dev-08.iqser.cloud/redaction-gateway-v1",
|
||||
"API_URL": "https://aks-staging.iqser.cloud/redaction-gateway-v1",
|
||||
"APP_NAME": "RedactManager",
|
||||
"AUTO_READ_TIME": 1.5,
|
||||
"BACKEND_APP_VERSION": "4.4.40",
|
||||
@ -17,7 +17,7 @@
|
||||
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
||||
"OAUTH_CLIENT_ID": "redaction",
|
||||
"OAUTH_IDP_HINT": null,
|
||||
"OAUTH_URL": "https://dev-08.iqser.cloud/auth/realms/redaction",
|
||||
"OAUTH_URL": "https://aks-staging.iqser.cloud/auth/realms/redaction",
|
||||
"RECENT_PERIOD_IN_HOURS": 24,
|
||||
"SELECTION_MODE": "structural"
|
||||
}
|
||||
|
||||
@ -3,5 +3,5 @@ export interface IViewedPage {
|
||||
page?: number;
|
||||
userId?: string;
|
||||
viewedTime?: string;
|
||||
hasChanges?: boolean;
|
||||
showAsUnseen?: boolean;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user