RED-4086: Keep manual redactions flag

This commit is contained in:
Adina Țeudan 2022-05-31 17:30:15 +03:00
parent e856ec1eb3
commit 8224cf7755
9 changed files with 47 additions and 66 deletions

View File

@ -1,21 +0,0 @@
<div>
<div
[class.error]="file.isError"
[class.initial-processing]="file.isInitialProcessing"
[matTooltip]="file.filename"
class="table-item-title"
matTooltipPosition="above"
>
{{ file.filename }}
</div>
</div>
<div *ngIf="primaryAttribute" class="small-label">
<div class="primary-attribute">
<span [matTooltip]="primaryAttribute" matTooltipPosition="above">
{{ primaryAttribute }}
</span>
</div>
</div>
<redaction-file-stats [file]="file"></redaction-file-stats>

View File

@ -1,18 +0,0 @@
@use 'common-mixins';
.table-item-title {
max-width: 25vw;
&.error {
color: var(--iqser-red-1);
}
&.initial-processing {
color: var(--iqser-disabled);
}
}
.primary-attribute {
padding-top: 6px;
@include common-mixins.line-clamp(1);
}

View File

@ -1,21 +0,0 @@
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
import { File } from '@red/domain';
import { PrimaryFileAttributeService } from '@services/primary-file-attribute.service';
@Component({
selector: 'redaction-file-name-column',
templateUrl: './file-name-column.component.html',
styleUrls: ['./file-name-column.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FileNameColumnComponent implements OnChanges {
@Input() file: File;
@Input() dossierTemplateId: string;
primaryAttribute: string;
constructor(private readonly _primaryFileAttributeService: PrimaryFileAttributeService) {}
ngOnChanges() {
this.primaryAttribute = this._primaryFileAttributeService.getPrimaryFileAttributeValue(this.file, this.dossierTemplateId);
}
}

View File

@ -10,6 +10,7 @@ interface PartialFile {
readonly excludedPages: number[];
readonly lastOCRTime?: string;
readonly fileAttributes: FileAttributes;
readonly lastManualChangeDate?: string;
}
@Component({

View File

@ -9,4 +9,5 @@ export interface FileUploadModel {
typeError: boolean;
dossierId?: string;
dossierName?: string;
keepManualRedactions?: boolean;
}

View File

@ -106,6 +106,14 @@ export class FileUploadService extends GenericService<IFileUploadResult> impleme
file.sizeError = true;
}
}
let keepManualRedactions = false;
const manualChangesFiles = files.filter(f => dossierFiles.find(pf => pf.filename === f.file.name && !!pf.lastManualChangeDate));
if (manualChangesFiles.length > 0) {
keepManualRedactions = await this._dialogService.keepManualRedactions();
manualChangesFiles.forEach(f => (f.keepManualRedactions = keepManualRedactions));
}
this.files.push(...files);
files.forEach(newFile => {
this._addFileToGroup(newFile);
@ -139,9 +147,11 @@ export class FileUploadService extends GenericService<IFileUploadResult> impleme
}
@Validate()
uploadFileForm(@RequiredParam() dossierId: string, file?: Blob) {
uploadFileForm(@RequiredParam() dossierId: string, keepManualRedactions = false, file?: Blob) {
const formParams = new FormData();
formParams.append('keepManualRedactions', keepManualRedactions.toString());
if (file !== undefined) {
formParams.append('file', file);
}
@ -190,7 +200,7 @@ export class FileUploadService extends GenericService<IFileUploadResult> impleme
private _createSubscription(uploadFile: FileUploadModel) {
this.activeUploads++;
const obs = this.uploadFileForm(uploadFile.dossierId, uploadFile.file);
const obs = this.uploadFileForm(uploadFile.dossierId, uploadFile.keepManualRedactions, uploadFile.file);
return obs.subscribe(
event => {
if (event.type === HttpEventType.UploadProgress) {

View File

@ -2,6 +2,8 @@ import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { OverwriteFilesDialogComponent } from '../dialogs/overwrite-files-dialog/overwrite-files-dialog.component';
import { firstValueFrom } from 'rxjs';
import { ConfirmationDialogComponent, ConfirmationDialogInput } from '@iqser/common-ui';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
const dialogConfig = {
width: '662px',
@ -21,4 +23,17 @@ export class UploadDownloadDialogService {
return firstValueFrom(ref.afterClosed()).then(res => res || { cancel: true });
}
keepManualRedactions(): Promise<boolean> {
const data = new ConfirmationDialogInput({
title: _('confirmation-dialog.keep-manual-redactions.title'),
question: _('confirmation-dialog.keep-manual-redactions.question'),
confirmationText: _('confirmation-dialog.keep-manual-redactions.confirmation-text'),
denyText: _('confirmation-dialog.keep-manual-redactions.deny-text'),
});
const ref = this._dialog.open(ConfirmationDialogComponent, { ...dialogConfig, data });
return firstValueFrom(ref.afterClosed());
}
}

View File

@ -577,6 +577,12 @@
"title": "{count, plural, one{{justificationName}} other{ausgewählte Begründungen}} löschen"
},
"input-label": "Bitte geben Sie unten Folgendes ein, um fortzufahren",
"keep-manual-redactions": {
"confirmation-text": "",
"deny-text": "",
"question": "",
"title": ""
},
"report-template-same-name": {
"confirmation-text": "Ja. Hochladen fortsetzen",
"deny-text": "Nein. Hochladen abbrechen",
@ -1448,11 +1454,13 @@
"labels": {
"download-cleanup-download-files-hours": "",
"download-cleanup-not-download-files-hours": "",
"remove-digital-signature-on-upload": "",
"soft-delete-cleanup-time": ""
},
"placeholders": {
"download-cleanup-download-files-hours": "",
"download-cleanup-not-download-files-hours": "",
"remove-digital-signature-on-upload": "",
"soft-delete-cleanup-time": ""
},
"title": ""

View File

@ -577,6 +577,12 @@
"title": "Delete {count, plural, one{{justificationName}} other{Selected Justifications}}"
},
"input-label": "To proceed please type below",
"keep-manual-redactions": {
"confirmation-text": "Keep",
"deny-text": "Clear",
"question": "At least one of the files you're overwriting has manual changes, do you wish to keep them?",
"title": "Keep Manual Redactions?"
},
"report-template-same-name": {
"confirmation-text": "Yes. Continue upload",
"deny-text": "No. Cancel Upload",
@ -1448,14 +1454,14 @@
"labels": {
"download-cleanup-download-files-hours": "Cleanup time for downloaded files (hours)",
"download-cleanup-not-download-files-hours": "Cleanup time for not downloaded files (hours)",
"soft-delete-cleanup-time": "Soft delete cleanup time (hours)",
"remove-digital-signature-on-upload": "Remove Digital Signature on Upload"
"remove-digital-signature-on-upload": "Remove Digital Signature on Upload",
"soft-delete-cleanup-time": "Soft delete cleanup time (hours)"
},
"placeholders": {
"download-cleanup-download-files-hours": "(hours)",
"download-cleanup-not-download-files-hours": "(hours)",
"soft-delete-cleanup-time": "(hours)",
"remove-digital-signature-on-upload": "True / False"
"remove-digital-signature-on-upload": "True / False",
"soft-delete-cleanup-time": "(hours)"
},
"title": "System Preferences"
},