added download redacted
This commit is contained in:
parent
b5a86e5988
commit
3898526e23
@ -53,6 +53,17 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button
|
||||
(click)="downloadFile($event, fileStatus)"
|
||||
*ngIf="permissionsService.canDownloadRedactedFile(fileStatus)"
|
||||
[matTooltipPosition]="tooltipPosition"
|
||||
[matTooltip]="'project-overview.download-redacted-file' | translate"
|
||||
color="accent"
|
||||
mat-icon-button
|
||||
>
|
||||
<mat-icon svgIcon="red:download"></mat-icon>
|
||||
</button>
|
||||
|
||||
<button
|
||||
(click)="setFileApproved($event, fileStatus)"
|
||||
*ngIf="permissionsService.canApprove(fileStatus)"
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { PermissionsService } from '../service/permissions.service';
|
||||
import { FileStatusWrapper } from '../../screens/file/model/file-status.wrapper';
|
||||
import { DialogService } from '../../dialogs/dialog.service';
|
||||
import { AppStateService } from '../../state/app-state.service';
|
||||
import { FileActionService } from '../../screens/file/service/file-action.service';
|
||||
import { FileDownloadService } from '../../screens/file/service/file-download.service';
|
||||
import { saveAs } from 'file-saver';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-file-actions',
|
||||
@ -20,7 +22,8 @@ export class FileActionsComponent implements OnInit {
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly appStateService: AppStateService,
|
||||
private readonly _dialogService: DialogService,
|
||||
private readonly _fileActionService: FileActionService
|
||||
private readonly _fileActionService: FileActionService,
|
||||
private readonly _fileDownloadService: FileDownloadService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@ -91,4 +94,11 @@ export class FileActionsComponent implements OnInit {
|
||||
this.actionPerformed.emit(action);
|
||||
});
|
||||
}
|
||||
|
||||
downloadFile($event: MouseEvent, fileStatus: FileStatusWrapper) {
|
||||
$event.stopPropagation();
|
||||
this._fileDownloadService.loadFile('REDACTED', fileStatus).subscribe((data) => {
|
||||
saveAs(data, fileStatus.filename);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,4 +182,11 @@ export class PermissionsService {
|
||||
(fileStatus.status === 'UNDER_REVIEW' && this.isFileReviewer(fileStatus)) || (fileStatus.status === 'UNDER_APPROVAL' && this.isManagerAndOwner())
|
||||
);
|
||||
}
|
||||
|
||||
canDownloadRedactedFile(fileStatus: FileStatusWrapper) {
|
||||
if (!fileStatus) {
|
||||
fileStatus = this._appStateService.activeFile;
|
||||
}
|
||||
return fileStatus.status === 'APPROVED' && this.isManagerAndOwner();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<div class="needs-work">
|
||||
<redaction-annotation-icon *ngIf="reanalysisRequired()" type="square" label="A" color="#dd4d50"></redaction-annotation-icon>
|
||||
<redaction-annotation-icon *ngIf="needsWorkInput.hasRedactions" type="square" label="R" color="#283241"></redaction-annotation-icon>
|
||||
<redaction-annotation-icon *ngIf="needsWorkInput.hintsOnly" type="round" label="H" color="#9398a0"></redaction-annotation-icon>
|
||||
<redaction-annotation-icon *ngIf="needsWorkInput.hintsOnly || true" type="circle" label="H" color="#9398a0"></redaction-annotation-icon>
|
||||
<redaction-annotation-icon *ngIf="needsWorkInput.hasRequests" type="rhombus" label="S" [color]="suggestionColor"></redaction-annotation-icon>
|
||||
</div>
|
||||
|
||||
@ -142,6 +142,7 @@
|
||||
"members": "Members"
|
||||
},
|
||||
"project-overview": {
|
||||
"download-redacted-file": "Download Redacted File",
|
||||
"under-approval": "For Approval",
|
||||
"approve": "Approve",
|
||||
"under-review": "Under Review",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user