Pull request #87: RED-913: Spinner on bulk actions
Merge in RED/ui from RED-913 to master * commit '80bd667d04834c1bf17a423ab1500ade8bdd6b11': Spinner on bulk actions
This commit is contained in:
commit
bd2af9adee
@ -1,4 +1,4 @@
|
|||||||
<ng-container *ngIf="areSomeFilesSelected">
|
<ng-container *ngIf="areSomeFilesSelected && !loading">
|
||||||
<redaction-circle-button
|
<redaction-circle-button
|
||||||
(action)="delete()"
|
(action)="delete()"
|
||||||
*ngIf="canDelete"
|
*ngIf="canDelete"
|
||||||
@ -55,3 +55,7 @@
|
|||||||
icon="red:refresh"
|
icon="red:refresh"
|
||||||
></redaction-circle-button>
|
></redaction-circle-button>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container *ngIf="loading">
|
||||||
|
<mat-spinner diameter="15"></mat-spinner>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { computerize } from '../../../utils/functions';
|
|||||||
export class BulkActionsComponent {
|
export class BulkActionsComponent {
|
||||||
@Input() selectedFileIds: string[];
|
@Input() selectedFileIds: string[];
|
||||||
@Output() private reload = new EventEmitter();
|
@Output() private reload = new EventEmitter();
|
||||||
|
public loading = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _appStateService: AppStateService,
|
||||||
@ -57,23 +58,29 @@ export class BulkActionsComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public delete() {
|
public delete() {
|
||||||
|
this.loading = true;
|
||||||
this._dialogService.openDeleteFilesDialog(null, this._appStateService.activeProject.project.projectId, this.selectedFileIds, () => {
|
this._dialogService.openDeleteFilesDialog(null, this._appStateService.activeProject.project.projectId, this.selectedFileIds, () => {
|
||||||
this.reload.emit();
|
this.reload.emit();
|
||||||
|
this.loading = false;
|
||||||
this.selectedFileIds.splice(0, this.selectedFileIds.length);
|
this.selectedFileIds.splice(0, this.selectedFileIds.length);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public assign() {
|
public assign() {
|
||||||
|
this.loading = true;
|
||||||
this._dialogService.openBulkAssignFileReviewerDialog(this.selectedFileIds, () => {
|
this._dialogService.openBulkAssignFileReviewerDialog(this.selectedFileIds, () => {
|
||||||
this.reload.emit();
|
this.reload.emit();
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async reanalyse() {
|
public async reanalyse() {
|
||||||
|
this.loading = true;
|
||||||
const fileIds = this.selectedFiles.filter((file) => this._permissionsService.fileRequiresReanalysis(file)).map((file) => file.fileId);
|
const fileIds = this.selectedFiles.filter((file) => this._permissionsService.fileRequiresReanalysis(file)).map((file) => file.fileId);
|
||||||
|
|
||||||
await this._reanalysisControllerService.reanalyzeFilesForProject(fileIds, this._appStateService.activeProject.projectId).toPromise();
|
await this._reanalysisControllerService.reanalyzeFilesForProject(fileIds, this._appStateService.activeProject.projectId).toPromise();
|
||||||
this.reload.emit();
|
this.reload.emit();
|
||||||
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under review
|
// Under review
|
||||||
@ -82,10 +89,13 @@ export class BulkActionsComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setToUnderReview() {
|
public setToUnderReview() {
|
||||||
|
this.loading = true;
|
||||||
|
|
||||||
const promises = this.selectedFiles.map((file) => this._fileActionService.setFileUnderReview(file).toPromise());
|
const promises = this.selectedFiles.map((file) => this._fileActionService.setFileUnderReview(file).toPromise());
|
||||||
|
|
||||||
Promise.all(promises).then(() => {
|
Promise.all(promises).then(() => {
|
||||||
this.reload.emit();
|
this.reload.emit();
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,10 +105,12 @@ export class BulkActionsComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setToUnderApproval() {
|
public setToUnderApproval() {
|
||||||
|
this.loading = true;
|
||||||
const promises = this.selectedFiles.map((file) => this._fileActionService.setFileUnderApproval(file).toPromise());
|
const promises = this.selectedFiles.map((file) => this._fileActionService.setFileUnderApproval(file).toPromise());
|
||||||
|
|
||||||
Promise.all(promises).then(() => {
|
Promise.all(promises).then(() => {
|
||||||
this.reload.emit();
|
this.reload.emit();
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,10 +120,12 @@ export class BulkActionsComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public approveDocuments() {
|
public approveDocuments() {
|
||||||
|
this.loading = true;
|
||||||
const promises = this.selectedFiles.map((file) => this._fileActionService.setFileApproved(file).toPromise());
|
const promises = this.selectedFiles.map((file) => this._fileActionService.setFileApproved(file).toPromise());
|
||||||
|
|
||||||
Promise.all(promises).then(() => {
|
Promise.all(promises).then(() => {
|
||||||
this.reload.emit();
|
this.reload.emit();
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,10 +136,12 @@ export class BulkActionsComponent {
|
|||||||
|
|
||||||
// Bulk Download
|
// Bulk Download
|
||||||
downloadRedactedFiles() {
|
downloadRedactedFiles() {
|
||||||
|
this.loading = true;
|
||||||
this._fileManagementControllerService
|
this._fileManagementControllerService
|
||||||
.downloadRedactedFiles({ fileIds: this.selectedFiles.map((file) => file.fileId) }, this._appStateService.activeProjectId, false, 'response')
|
.downloadRedactedFiles({ fileIds: this.selectedFiles.map((file) => file.fileId) }, this._appStateService.activeProjectId, false, 'response')
|
||||||
.subscribe((data) => {
|
.subscribe((data) => {
|
||||||
download(data, 'redacted_files_' + computerize(this._appStateService.activeProject.name) + '.zip');
|
download(data, 'redacted_files_' + computerize(this._appStateService.activeProject.name) + '.zip');
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user