diff --git a/src/app/workspace-admin/files/files.component.html b/src/app/workspace-admin/files/files.component.html index e5098f38c53a5b099f9c282bd2721dde4be12e13..c1c92f81dde82841b832fbc0b23e2ceddf3283e2 100644 --- a/src/app/workspace-admin/files/files.component.html +++ b/src/app/workspace-admin/files/files.component.html @@ -99,9 +99,12 @@ {{ i }} </p> - <pre>{{fileStats | json}}</pre> - - <br/> + <div *ngFor="let stat of fileStats | keyvalue"> + <div class="vertical-align-middle"> + <mat-icon class="report-info">info</mat-icon> + <alert text="{{stat.value}} Dateien vom Typ `{{stat.key}}`"></alert> + </div> + </div> </div> </div> diff --git a/src/app/workspace-admin/files/files.component.ts b/src/app/workspace-admin/files/files.component.ts index 766f2bef93c063665c42bfacc058a6156a9f0142..a530a140fe36fa9521cff001c294d8b1d9e39643 100644 --- a/src/app/workspace-admin/files/files.component.ts +++ b/src/app/workspace-admin/files/files.component.ts @@ -34,7 +34,7 @@ export class FilesComponent implements OnInit { public checkInfos = []; @ViewChild(MatSort, { static: true }) sort: MatSort; - private fileStats: {[type: string]: number}; + public fileStats: {[type: string]: number}; constructor( @Inject('SERVER_URL') private serverUrl: string, @@ -54,37 +54,34 @@ export class FilesComponent implements OnInit { }); } - checkAll(isChecked: boolean) { - this.serverfiles.data.forEach((element) => { + checkAll(isChecked: boolean): void { + this.serverfiles.data.forEach(element => { + // eslint-disable-next-line no-param-reassign element.isChecked = isChecked; }); } - deleteFiles() { + deleteFiles(): void { if (this.wds.wsRole === 'RW') { this.checkErrors = []; this.checkWarnings = []; this.checkInfos = []; const filesToDelete = []; - this.serverfiles.data.forEach((element) => { + this.serverfiles.data.forEach(element => { if (element.isChecked) { filesToDelete.push(`${element.type}/${element.filename}`); } }); if (filesToDelete.length > 0) { - let prompt = 'Sie haben '; - if (filesToDelete.length > 1) { - prompt = prompt + filesToDelete.length + ' Dateien ausgewählt. Sollen'; - } else { - prompt = prompt + ' eine Datei ausgewählt. Soll'; - } + const p = filesToDelete.length > 1; const dialogRef = this.confirmDialog.open(ConfirmDialogComponent, { width: '400px', data: <ConfirmDialogData>{ title: 'Löschen von Dateien', - content: `${prompt} diese gelöscht werden?`, + content: `Sie haben ${p ? filesToDelete.length : 'eine'} Datei${p ? 'en' : ''}\` + ausgewählt. Soll${p ? 'en' : ''} diese gelöscht werden?`, confirmbuttonlabel: 'Löschen', showcancel: true } @@ -96,12 +93,12 @@ export class FilesComponent implements OnInit { this.bs.deleteFiles(filesToDelete).subscribe((fileDeletionReport: FileDeletionReport) => { const message = []; if (fileDeletionReport.deleted.length > 0) { - message.push(fileDeletionReport.deleted.length + ' Dateien erfolgreich gelöscht.'); + message.push(`${fileDeletionReport.deleted.length} Dateien erfolgreich gelöscht.`); } if (fileDeletionReport.not_allowed.length > 0) { - message.push(fileDeletionReport.not_allowed.length + ' Dateien konnten nicht gelöscht werden.'); + message.push(`${fileDeletionReport.not_allowed.length} Dateien konnten nicht gelöscht werden.`); } - this.snackBar.open(message.join('<br>'), message.length > 1 ? 'Achtung' : '', {duration: 1000}); + this.snackBar.open(message.join('<br>'), message.length > 1 ? 'Achtung' : '', { duration: 1000 }); this.updateFileList(); }); }