Skip to content
Snippets Groups Projects
Commit 6c9eb895 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #14383 TIME 0:10 fix tech info if no file

parent bf7deee2
No related branches found
No related tags found
No related merge requests found
...@@ -10,12 +10,14 @@ ...@@ -10,12 +10,14 @@
<div *ngIf="loading" class="loading" color="primary"> <div *ngIf="loading" class="loading" color="primary">
<mat-spinner></mat-spinner> <mat-spinner></mat-spinner>
</div> </div>
<mat-form-field class="data-item" *ngFor="let data of techData | keyvalue"> <ng-container *ngFor="let data of techData | keyvalue">
<mat-icon matPrefix [class]="data.value.icon" color="primary" style="width: 35px;text-align: center;"></mat-icon> <mat-form-field *ngIf="!functions.empty(data.value.value)" class="data-item">
<mat-label>{{'lang.'+data.key | translate}}</mat-label> <mat-icon matPrefix [class]="data.value.icon" color="primary" style="width: 35px;text-align: center;">
<input matInput [value]="data.value.value" readonly> </mat-icon>
</mat-form-field> <mat-label>{{'lang.'+data.key | translate}}</mat-label>
<input matInput [value]="data.value.value" readonly>
</mat-form-field>
</ng-container>
<mat-accordion *ngIf="!isEmptyCustom()"> <mat-accordion *ngIf="!isEmptyCustom()">
<mat-expansion-panel expanded> <mat-expansion-panel expanded>
<mat-expansion-panel-header> <mat-expansion-panel-header>
...@@ -24,7 +26,8 @@ ...@@ -24,7 +26,8 @@
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<mat-form-field *ngFor="let custom of customsData | keyvalue" class="data-item"> <mat-form-field *ngFor="let custom of customsData | keyvalue" class="data-item">
<mat-icon matPrefix [class]="custom.value.icon" color="primary" style="width: 35px;text-align: center;"></mat-icon> <mat-icon matPrefix [class]="custom.value.icon" color="primary"
style="width: 35px;text-align: center;"></mat-icon>
<mat-label>{{custom.value.label}}</mat-label> <mat-label>{{custom.value.label}}</mat-label>
<input matInput [value]="custom.value.value" readonly> <input matInput [value]="custom.value.value" readonly>
</mat-form-field> </mat-form-field>
......
...@@ -156,14 +156,18 @@ export class FunctionsService { ...@@ -156,14 +156,18 @@ export class FunctionsService {
} }
formatBytes(bytes: number, decimals = 2) { formatBytes(bytes: number, decimals = 2) {
if (bytes === 0) { return '0 Octet'; } if (typeof bytes === 'number') {
if (bytes === 0) { return '0 Octet'; }
const k = 1024; const k = 1024;
const dm = decimals < 0 ? 0 : decimals; const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Octets', 'KO', 'MO', 'GO', 'TO', 'PO', 'EO', 'ZO', 'YO']; const sizes = ['Octets', 'KO', 'MO', 'GO', 'TO', 'PO', 'EO', 'ZO', 'YO'];
const i = Math.floor(Math.log(bytes) / Math.log(k)); const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
} else {
return bytes;
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment