reanalysis issue fix and notifications for downloads

This commit is contained in:
Timo 2021-02-07 21:57:33 +02:00
parent 8e85d70156
commit feedb0e983
6 changed files with 26 additions and 17 deletions

View File

@ -4,6 +4,7 @@ import { ProjectWrapper } from '../../../state/model/project.wrapper';
import { FileStatusWrapper } from '../../../screens/file/model/file-status.wrapper';
import { FileDownloadService } from '../../../upload-download/file-download.service';
import { NotificationService } from '../../../notification/notification.service';
import { TranslateService } from '@ngx-translate/core';
export type MenuState = 'OPEN' | 'CLOSED';
@ -22,6 +23,7 @@ export class FileDownloadBtnComponent {
constructor(
private readonly _permissionsService: PermissionsService,
private readonly _fileDownloadService: FileDownloadService,
private readonly _translateService: TranslateService,
private readonly _notificationService: NotificationService
) {}
@ -35,7 +37,8 @@ export class FileDownloadBtnComponent {
downloadFiles($event: MouseEvent) {
$event.stopPropagation();
// Bulk Download
this._fileDownloadService.downloadFiles(Array.isArray(this.file) ? this.file : [this.file], this.project).subscribe((data) => {});
this._fileDownloadService.downloadFiles(Array.isArray(this.file) ? this.file : [this.file], this.project).subscribe(() => {
this._notificationService.showToastNotification(this._translateService.instant('download-status.queued'));
});
}
}

View File

@ -80,9 +80,6 @@ export class AssignOwnerDialogComponent {
pw.project.memberIds = memberIds;
pw.project.ownerId = ownerId;
await this._appStateService.addOrUpdateProject(pw.project);
this._notificationService.showToastNotification(
'Successfully assigned ' + this.userService.getNameForId(ownerId) + ' to project: ' + pw.project.projectName
);
}
if (this.data.type === 'file') {
@ -99,9 +96,6 @@ export class AssignOwnerDialogComponent {
for (const file of this.data.files) {
file.currentReviewer = reviewerId;
file.reviewerName = this.userService.getNameForId(reviewerId);
this._notificationService.showToastNotification(
'Successfully assigned ' + this.userService.getNameForId(reviewerId) + ' to file: ' + file.filename
);
}
}
} catch (error) {

View File

@ -3,11 +3,17 @@
<div class="flex-1">
<div class="red-input-group slider-row">
<mat-button-toggle-group [value]="viewMode" (change)="switchView($event)" appearance="legacy">
<mat-button-toggle [value]="'STANDARD'"> {{ 'file-preview.standard' | translate }}</mat-button-toggle>
<mat-button-toggle [value]="'DELTA'" [disabled]="canNotSwitchToDeltaView"> {{ 'file-preview.delta' | translate }}</mat-button-toggle>
<mat-button-toggle [value]="'STANDARD'">
<div [matTooltip]="'file-preview.standard-tooltip' | translate">{{ 'file-preview.standard' | translate }}</div>
</mat-button-toggle>
<mat-button-toggle [value]="'DELTA'" [disabled]="!canSwitchToDeltaView">
<div [matTooltip]="'file-preview.delta-tooltip' | translate">{{ 'file-preview.delta' | translate }}</div>
</mat-button-toggle>
<mat-button-toggle [value]="'REDACTED'" [disabled]="canNotSwitchToRedactedView">
{{ 'file-preview.redacted' | translate }}</mat-button-toggle
>
<div [matTooltip]="'file-preview.redacted-tooltip' | translate">
{{ 'file-preview.redacted' | translate }}
</div>
</mat-button-toggle>
</mat-button-toggle-group>
</div>
</div>

View File

@ -67,6 +67,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
loadingMessage: string;
canPerformAnnotationActions: boolean;
filesAutoUpdateTimer: Subscription;
fileReanalysedSubscription: Subscription;
constructor(
public readonly appStateService: AppStateService,
@ -160,8 +161,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
return this.permissionsService.fileRequiresReanalysis();
}
get canNotSwitchToDeltaView() {
return this.fileData?.redactionChangeLog?.redactionLogEntry?.length === 0;
get canSwitchToDeltaView() {
return this.fileData?.redactionChangeLog?.redactionLogEntry?.length > 0;
}
ngOnInit(): void {
@ -181,7 +182,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
this._loadFileData().subscribe(() => {
this._updateCanPerformActions();
});
this.appStateService.fileReanalysed.subscribe((fileStatus: FileStatusWrapper) => {
this.fileReanalysedSubscription = this.appStateService.fileReanalysed.subscribe((fileStatus: FileStatusWrapper) => {
if (fileStatus.fileId === this.fileId) {
this._loadFileData(true).subscribe(() => {
this.viewReady = true;
@ -195,6 +196,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
ngOnDestroy(): void {
this.filesAutoUpdateTimer.unsubscribe();
this.fileReanalysedSubscription.unsubscribe();
}
private _loadFileData(performUpdate: boolean = false) {

View File

@ -63,7 +63,7 @@ export class FileDataModel {
private _convertData(dictionaryData: { [p: string]: TypeValue }): RedactionLogEntryWrapper[] {
let result: RedactionLogEntryWrapper[] = [];
this.redactionChangeLog.redactionLogEntry.forEach((changeLogEntry) => {
this.redactionChangeLog?.redactionLogEntry?.forEach((changeLogEntry) => {
if (changeLogEntry.changeType === 'REMOVED') {
const redactionLogEntryWrapper: RedactionLogEntryWrapper = { actionPendingReanalysis: false };
@ -83,7 +83,7 @@ export class FileDataModel {
return;
}
const existingChangeLogEntry = this.redactionChangeLog.redactionLogEntry.find((rle) => rle.id === redactionLogEntry.id);
const existingChangeLogEntry = this.redactionChangeLog?.redactionLogEntry?.find((rle) => rle.id === redactionLogEntry.id);
// copy the redactionLog Entry
const redactionLogEntryWrapper: RedactionLogEntryWrapper = { actionPendingReanalysis: false };

View File

@ -22,6 +22,7 @@
}
},
"download-status": {
"queued": "Your download has been queued, you can see all your requested downloads here: <a href='/ui/downloads'>My Downloads <a/>.",
"error": {
"generic": "Download failed"
},
@ -279,6 +280,9 @@
"delta": "Delta",
"redacted": "Preview",
"standard": "Standard",
"standard-tooltip": "Standard Workload view shows all hints, redactions, recommendations & suggestions. This view allows editing.",
"redacted-tooltip": "Redaction preview shows only redactions. Consider this a preview for the final redacted version. This view is only available if the file has no pending changes & doesn't require a reanalysis",
"delta-tooltip": "Delta View shows only the changes since last re-analysis. This view is only available if there is at least 1 change",
"no-annotations-for-page": "There are no redactions, hints or requests on this page.",
"show-redacted-view": "Show Redacted Preview",
"cannot-show-redacted-view": "Redactions out of sync. Redacted Preview only available after reanalysis",