From eb4f51a6bb7beeb818aadf4137a8ed1d93a5d8e3 Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Wed, 27 Jan 2021 16:39:23 +0100 Subject: [PATCH] FEAT #16071 TIME 0:35 Display initiator in technical informations --- .../resource/controllers/ResController.php | 3 +- .../technical-information.component.html | 2 +- .../technical-information.component.ts | 45 ++++++++++--------- .../app/resource/ResControllerTest.php | 3 ++ 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/app/resource/controllers/ResController.php b/src/app/resource/controllers/ResController.php index 148e0718538..7de6e47553e 100755 --- a/src/app/resource/controllers/ResController.php +++ b/src/app/resource/controllers/ResController.php @@ -1377,7 +1377,7 @@ class ResController extends ResourceControlController $resource = ResModel::getById([ 'resId' => $args['resId'], - 'select' => ['format', 'fingerprint', 'filesize', 'fulltext_result', 'creation_date', 'filename', 'docserver_id', 'path'] + 'select' => ['format', 'fingerprint', 'filesize', 'fulltext_result', 'creation_date', 'filename', 'docserver_id', 'path', 'typist'] ]); if (!empty($resource['docserver_id'])) { @@ -1387,6 +1387,7 @@ class ResController extends ResourceControlController $resource['docserverPathFile'] = str_replace('#', '/', $resource['docserverPathFile']); } + $resource['typistLabel'] = UserModel::getLabelledUserById(['id' => $resource['typist']]); $resource['creationDate'] = $resource['creation_date']; unset($resource['creation_date']); diff --git a/src/frontend/app/indexation/technical-information/technical-information.component.html b/src/frontend/app/indexation/technical-information/technical-information.component.html index 926bbd77f88..d04d32d85a7 100644 --- a/src/frontend/app/indexation/technical-information/technical-information.component.html +++ b/src/frontend/app/indexation/technical-information/technical-information.component.html @@ -10,7 +10,7 @@ <div *ngIf="loading" class="loading" color="primary"> <mat-spinner></mat-spinner> </div> - <ng-container *ngFor="let data of techData | keyvalue"> + <ng-container *ngFor="let data of techData | keyvalue: null"> <mat-form-field *ngIf="!functions.empty(data.value.value)" class="data-item"> <mat-icon matPrefix [class]="data.value.icon" color="primary" style="width: 35px;text-align: center;"> </mat-icon> diff --git a/src/frontend/app/indexation/technical-information/technical-information.component.ts b/src/frontend/app/indexation/technical-information/technical-information.component.ts index f14ba52b6ae..3a28eca37db 100644 --- a/src/frontend/app/indexation/technical-information/technical-information.component.ts +++ b/src/frontend/app/indexation/technical-information/technical-information.component.ts @@ -19,35 +19,40 @@ export class TechnicalInformationComponent implements OnInit { loading: boolean = false; techData: any = { - format: { - label: 'fileFormat', + initiator: { + label: 'initiator', value: '', - icon: 'far fa-file-archive' + icon: 'fas fa-user' + }, + creationDate: { + label: 'creationDate', + value: '', + icon: 'fas fa-calendar-day' }, size: { label: 'filesize', value: '', icon: 'fas fa-cubes' }, - creationDate: { - label: 'creationDate', + format: { + label: 'fileFormat', value: '', - icon: 'fas fa-calendar-day' + icon: 'far fa-file-archive' }, - fingerprint: { - label: 'fingerprint', + filename: { + label: 'filename', value: '', - icon: 'fas fa-fingerprint' + icon: 'fas fa-quote-right' }, docserverPathFile: { label: 'docserverPathFile', value: '', icon: 'fas fa-terminal' }, - filename: { - label: 'filename', + fingerprint: { + label: 'fingerprint', value: '', - icon: 'fas fa-quote-right' + icon: 'fas fa-fingerprint' }, fulltext: { label: 'fulltext', @@ -79,14 +84,14 @@ export class TechnicalInformationComponent implements OnInit { this.http.get(`../rest/resources/${this.data.resId}/fileInformation`).pipe( tap((data: any) => { this.techData.format.value = data.information.format, - this.techData.fingerprint.value = data.information.fingerprint, - this.techData.size.value = this.functions.formatBytes(data.information.filesize), - this.techData.fulltext.value = data.information.fulltext_result, - this.techData.docserverPathFile.value = data.information.docserverPathFile, - this.techData.filename.value = data.information.filename, - this.techData.creationDate.value = this.datePipe.transform(data.information.creationDate, 'dd/MM/y HH:mm') , - this.loading = false; - + this.techData.fingerprint.value = data.information.fingerprint, + this.techData.size.value = this.functions.formatBytes(data.information.filesize), + this.techData.fulltext.value = data.information.fulltext_result, + this.techData.docserverPathFile.value = data.information.docserverPathFile, + this.techData.filename.value = data.information.filename, + this.techData.initiator.value = data.information.typistLabel, + this.techData.creationDate.value = this.datePipe.transform(data.information.creationDate, 'dd/MM/y HH:mm') , + this.loading = false; }), exhaustMap(() => this.http.get('../rest/customFields')), tap((data: any) => { diff --git a/test/unitTests/app/resource/ResControllerTest.php b/test/unitTests/app/resource/ResControllerTest.php index 42d60c3e019..d881728842d 100755 --- a/test/unitTests/app/resource/ResControllerTest.php +++ b/test/unitTests/app/resource/ResControllerTest.php @@ -1954,6 +1954,9 @@ class ResControllerTest extends TestCase $this->assertSame('txt', $responseBody['information']['format']); $this->assertIsString($responseBody['information']['fingerprint']); $this->assertNotEmpty($responseBody['information']['fingerprint']); + $this->assertIsString($responseBody['information']['typistLabel']); + $this->assertNotEmpty($responseBody['information']['typistLabel']); + $this->assertNotEmpty($responseBody['information']['typist']); $this->assertSame(46, $responseBody['information']['filesize']); $this->assertSame('SUCCESS', $responseBody['information']['fulltext_result']); $this->assertSame(true, $responseBody['information']['canConvert']); -- GitLab