From 7344d5d478f1c5e1d218cd5da567cd97828d4f8a Mon Sep 17 00:00:00 2001
From: paf <paf@titelfrei.de>
Date: Wed, 6 Jan 2021 11:28:43 +0100
Subject: [PATCH] remove fields with formatted dates and filesizes from `[GET]
 workspace/ws_id/files`'s return type

---
 src/app/workspace-admin/files/files.component.html | 12 ++++++------
 src/app/workspace-admin/files/files.component.ts   |  8 ++++++++
 src/app/workspace-admin/workspace.interfaces.ts    |  3 ---
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/app/workspace-admin/files/files.component.html b/src/app/workspace-admin/files/files.component.html
index d376b64f..e1bfe20a 100644
--- a/src/app/workspace-admin/files/files.component.html
+++ b/src/app/workspace-admin/files/files.component.html
@@ -13,7 +13,7 @@
 
       <ng-container matColumnDef="typelabel">
         <mat-header-cell *matHeaderCellDef mat-sort-header> Typ </mat-header-cell>
-        <mat-cell *matCellDef="let element">{{element.typelabel}}</mat-cell>
+        <mat-cell *matCellDef="let element">{{typeLabels[element.type]}}</mat-cell>
       </ng-container>
 
       <ng-container matColumnDef="filename">
@@ -49,16 +49,16 @@
 
       <ng-container matColumnDef="filedatetime">
         <mat-header-cell *matHeaderCellDef mat-sort-header class="datecell"> Datum </mat-header-cell>
-        <mat-cell *matCellDef="let element" class="datecell"> {{element.filedatetimestr}} </mat-cell>
+        <mat-cell *matCellDef="let element" class="datecell">
+          {{(element.filedatetime * 1000) | date: 'd.M.yy hh:mm'}}
+        </mat-cell>
       </ng-container>
 
       <ng-container matColumnDef="filesize">
         <mat-header-cell *matHeaderCellDef mat-sort-header> Größe </mat-header-cell>
         <mat-cell *matCellDef="let element">
-          {{element.filesizestr}}
-          <span *ngIf="element.info.totalSize">
-            / {{element.info.totalSize | bytes }}
-          </span>
+          {{element.filesize | bytes}}
+          <span *ngIf="element.info.totalSize"> (Komplett: {{element.info.totalSize | bytes }})</span>
         </mat-cell>
       </ng-container>
 
diff --git a/src/app/workspace-admin/files/files.component.ts b/src/app/workspace-admin/files/files.component.ts
index 8bfd5e17..b1c9c686 100644
--- a/src/app/workspace-admin/files/files.component.ts
+++ b/src/app/workspace-admin/files/files.component.ts
@@ -45,6 +45,14 @@ export class FilesComponent implements OnInit {
   public checkWarnings = [];
   public checkInfos = [];
 
+  public typeLabels = {
+    'Testtakers': 'Teilnehmerliste',
+    'Booklet': 'Testheft',
+    'SysCheck': 'Systemcheck',
+    'Resource': 'Resource',
+    'Unit': 'Unit'
+  }
+
   @ViewChild(MatSort, { static: true }) sort: MatSort;
   public fileStats: FileStats = {
     types: {},
diff --git a/src/app/workspace-admin/workspace.interfaces.ts b/src/app/workspace-admin/workspace.interfaces.ts
index aeb16634..a5c747ec 100644
--- a/src/app/workspace-admin/workspace.interfaces.ts
+++ b/src/app/workspace-admin/workspace.interfaces.ts
@@ -7,11 +7,8 @@ export interface WorkspaceData {
 export interface GetFileResponseData {
   filename: string;
   filesize: number;
-  filesizestr: string;
   filedatetime: string;
-  filedatetimestr: string;
   type: string;
-  typelabel: string;
   isChecked: boolean;
   report: {
     error: string[];
-- 
GitLab