Merge branch 'master' into VM/RED-2614

This commit is contained in:
Valentin 2022-01-12 13:15:09 +02:00
commit efb4a76d5c
8 changed files with 40 additions and 43 deletions

View File

@ -27,7 +27,6 @@
</div>
<redaction-user-button
[matMenuTriggerFor]="userMenu"
[showDot]="fileDownloadService.hasPendingDownloads"
[userId]="currentUser.id"
iqserHelpMode="open-usermenu"
></redaction-user-button>
@ -36,7 +35,6 @@
<ng-container *ngFor="let item of userMenuItems; trackBy: trackByName">
<button (click)="(item.action)" *ngIf="item.show" [routerLink]="item.routerLink" mat-menu-item translate>
{{ item.name }}
<span *ngIf="item.showDot()" class="dot"></span>
</button>
</ng-container>

View File

@ -36,26 +36,22 @@ export class BaseScreenComponent {
routerLink: '/main/account',
show: true,
action: this.appStateService.reset,
showDot: () => false,
},
{
name: _('top-bar.navigation-items.my-account.children.admin'),
routerLink: '/main/admin',
show: this.currentUser.isManager || this.currentUser.isUserAdmin,
action: this.appStateService.reset,
showDot: () => false,
},
{
name: _('top-bar.navigation-items.my-account.children.downloads'),
routerLink: '/main/downloads',
show: this.currentUser.isUser,
showDot: () => this.fileDownloadService.hasPendingDownloads,
},
{
name: _('top-bar.navigation-items.my-account.children.trash'),
routerLink: '/main/admin/trash',
show: this.currentUser.isManager,
showDot: () => false,
},
];
readonly searchActions: readonly SpotlightSearchAction[] = [
@ -85,7 +81,6 @@ export class BaseScreenComponent {
readonly userService: UserService,
readonly userPreferenceService: UserPreferenceService,
readonly titleService: Title,
readonly fileDownloadService: FileDownloadService,
private readonly _router: Router,
private readonly _translateService: TranslateService,
readonly breadcrumbsService: BreadcrumbsService,

View File

@ -11,6 +11,8 @@ import {
} from '@iqser/common-ui';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { RouterHistoryService } from '@services/router-history.service';
import { interval } from 'rxjs';
import { switchMap } from 'rxjs/operators';
@Component({
selector: 'redaction-downloads-list-screen',
@ -43,6 +45,9 @@ export class DownloadsListScreenComponent extends ListingComponent<DownloadStatu
) {
super(_injector);
this._loadingService.loadWhile(this._loadData());
this.addSubscription = interval(5000)
.pipe(switchMap(() => this._loadData()))
.subscribe();
}
downloadItem(download: DownloadStatus) {

View File

@ -67,7 +67,7 @@
<redaction-pdf-viewer
(annotationSelected)="handleAnnotationSelected($event)"
(annotationsChanged)="annotationsChangedByReviewAction($event)"
(keyUp)="handleKeyEvent($event)"
(keyUp)="handleKeyEvent($event); handleArrowEvent($event)"
(manualAnnotationRequested)="openManualAnnotationDialog($event)"
(pageChanged)="viewerPageChanged($event)"
(viewerReady)="viewerReady($event)"

View File

@ -144,19 +144,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return this._instance;
}
private _setActiveViewerPage() {
const currentPage = this._instance?.Core.documentViewer?.getCurrentPage();
if (!currentPage) {
this.activeViewerPage = 1;
} else {
this.activeViewerPage = this.viewModeService.isCompare
? currentPage % 2 === 0
? currentPage / 2
: (currentPage + 1) / 2
: currentPage;
}
}
private get _canPerformAnnotationActions$() {
return combineLatest([this.file$, this.viewModeService.viewMode$]).pipe(
map(([file, viewMode]) => this.permissionsService.canPerformAnnotationActions(file) && viewMode === 'STANDARD'),
@ -331,6 +318,14 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
}
handleArrowEvent($event: KeyboardEvent): void {
if (['ArrowUp', 'ArrowDown'].includes($event.key)) {
if (this.selectedAnnotations.length === 1) {
this._workloadComponent.navigateAnnotations($event);
}
}
}
@HostListener('window:keyup', ['$event'])
handleKeyEvent($event: KeyboardEvent) {
if (this._router.url.indexOf('/file/') < 0) {
@ -341,13 +336,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return;
}
if (['ArrowUp', 'ArrowDown'].includes($event.key)) {
if (this.selectedAnnotations.length === 1) {
this._workloadComponent.navigateAnnotations($event);
}
return;
}
if (['Escape'].includes($event.key)) {
this.fullScreen = false;
this.closeFullScreen();
@ -389,6 +377,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
async viewerReady($event: WebViewerInstance) {
this._instance = $event;
this.ready = true;
await this._stampPDF();
await this._reloadAnnotations();
this._setExcludedPageStyles();
@ -410,6 +399,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
} else {
this._loadingService.stop();
}
this._changeDetectorRef.markForCheck();
}
async annotationsChangedByReviewAction(annotation: AnnotationWrapper) {
@ -445,6 +435,19 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return false;
}
private _setActiveViewerPage() {
const currentPage = this._instance?.Core.documentViewer?.getCurrentPage();
if (!currentPage) {
this.activeViewerPage = 1;
} else {
this.activeViewerPage = this.viewModeService.isCompare
? currentPage % 2 === 0
? currentPage / 2
: (currentPage + 1) / 2
: currentPage;
}
}
private _setExcludedPageStyles() {
const file = this._filesMapService.get(this.dossierId, this.fileId);
setTimeout(() => {
@ -469,19 +472,25 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
if (!this._instance) {
return;
}
const document = this._instance.Core.documentViewer.getDocument();
if (!document) {
return;
}
const pdfNet = this._instance.Core.PDFNet;
const document = await this._instance.Core.documentViewer.getDocument().getPDFDoc();
const pdfDoc = await this._instance.Core.documentViewer.getDocument().getPDFDoc();
const file = this._filesMapService.get(this.dossierId, this.fileId);
const allPages = [...Array(file.numberOfPages).keys()].map(page => page + 1);
await clearStamps(document, pdfNet, allPages);
await clearStamps(pdfDoc, pdfNet, allPages);
if (this.viewModeService.viewMode === 'REDACTED') {
const dossier = this._dossiersService.find(this.dossierId);
if (dossier.watermarkPreviewEnabled) {
await this._stampPreview(document, dossier.dossierTemplateId);
await this._stampPreview(pdfDoc, dossier.dossierTemplateId);
}
} else {
await this._stampExcludedPages(document, file.excludedPages);
await this._stampExcludedPages(pdfDoc, file.excludedPages);
}
this._instance.Core.documentViewer.refreshAll();
this._instance.Core.documentViewer.updateView([this.activeViewerPage], this.activeViewerPage);

View File

@ -16,8 +16,6 @@ import { EntitiesService, List, mapEach, RequiredParam, Validate } from '@iqser/
@Injectable()
export class FileDownloadService extends EntitiesService<DownloadStatus, IDownloadStatus> {
hasPendingDownloads = false;
constructor(
private readonly _userService: UserService,
private readonly _keycloakService: KeycloakService,
@ -25,13 +23,6 @@ export class FileDownloadService extends EntitiesService<DownloadStatus, IDownlo
protected readonly _injector: Injector,
) {
super(_injector, DownloadStatus, 'async/download');
interval(5000)
.pipe(
withLatestFrom(_userService.currentUser$),
filter(([, user]) => user.isUser),
switchMap(() => this.loadAll()),
)
.subscribe();
}
downloadFiles(fileIds: List, dossierId: string): Observable<DownloadStatus[]> {
@ -45,7 +36,6 @@ export class FileDownloadService extends EntitiesService<DownloadStatus, IDownlo
return this.getStatuses().pipe(
mapEach(entity => new DownloadStatus(entity)),
tap(entities => this.setEntities(entities)),
tap(() => (this.hasPendingDownloads = !!this.all.find(f => !f.lastDownload && f.isReady))),
);
}

View File

@ -1,6 +1,6 @@
{
"name": "redaction",
"version": "3.140.0",
"version": "3.143.0",
"private": true,
"license": "MIT",
"scripts": {

Binary file not shown.