MOBILE-3947 dev: Improve error log styling

main
Pau Ferrer Ocaña 2023-11-17 14:14:39 +01:00
parent b7322d696d
commit 1fcbd4f2ce
3 changed files with 19 additions and 14 deletions

View File

@ -9,7 +9,7 @@
</ion-title> </ion-title>
<ion-buttons slot="end" *ngIf="errorLogs.length"> <ion-buttons slot="end" *ngIf="errorLogs.length">
<ion-button fill="clear" (click)="copyInfo()" [attr.aria-label]="'core.settings.copyinfo' | translate"> <ion-button fill="clear" (click)="copyError()" [attr.aria-label]="'core.settings.copyinfo' | translate">
<ion-icon slot="icon-only" name="fas-clipboard" aria-hidden="true"></ion-icon> <ion-icon slot="icon-only" name="fas-clipboard" aria-hidden="true"></ion-icon>
</ion-button> </ion-button>
</ion-buttons> </ion-buttons>
@ -18,8 +18,8 @@
<ion-content> <ion-content>
<ion-list *ngIf="errorLogs.length; else noLogs"> <ion-list *ngIf="errorLogs.length; else noLogs">
<ion-item button lines="full" class="ion-text-wrap" *ngFor="let error of errorLogs"> <ion-item button lines="full" class="ion-text-wrap" *ngFor="let error of errorLogs" (click)="copyError(error)">
<div class="ion-padding" [collapsible-item]="96"> <ion-label class="ion-padding" [collapsible-item]="96">
<p class="item-heading">Trace</p> <p class="item-heading">Trace</p>
<p class="ion-text-wrap">{{ error.message }}</p> <p class="ion-text-wrap">{{ error.message }}</p>
@ -38,10 +38,10 @@
<p class="ion-text-wrap">{{ error.data | json }}</p> <p class="ion-text-wrap">{{ error.data | json }}</p>
</ng-container> </ng-container>
<div *ngIf="error.time"> <p *ngIf="error.time" class="ion-text-end">
<span class="ion-text-end">{{ error.time | coreFormatDate :'strftimedatetimeshort' }}</span> {{ error.time | coreFormatDate :'strftimedatetimeshort' }}
</div> </p>
</div> </ion-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
<ng-template #noLogs> <ng-template #noLogs>

View File

@ -1,4 +0,0 @@
.timestamp {
display: flex;
justify-content: end;
}

View File

@ -22,18 +22,27 @@ import { CoreErrorLogs, CoreSettingsErrorLog } from '@singletons/error-logs';
@Component({ @Component({
selector: 'page-core-app-settings-error-log', selector: 'page-core-app-settings-error-log',
templateUrl: 'error-log.html', templateUrl: 'error-log.html',
styleUrls: ['./error-log.scss'],
}) })
export class CoreSettingsErrorLogPage implements OnInit { export class CoreSettingsErrorLogPage implements OnInit {
errorLogs: CoreSettingsErrorLog[] = []; errorLogs: CoreSettingsErrorLog[] = [];
/**
* @inheritdoc
*/
ngOnInit(): void { ngOnInit(): void {
this.errorLogs = CoreErrorLogs.getErrorLogs(); this.errorLogs = CoreErrorLogs.getErrorLogs();
} }
copyInfo(): void { /**
CoreUtils.copyToClipboard(JSON.stringify({ errors: this.errorLogs })); * Copy Info of all the errors.
*/
async copyError(error?: CoreSettingsErrorLog): Promise<void> {
if (error) {
await CoreUtils.copyToClipboard(JSON.stringify(error));
} else {
await CoreUtils.copyToClipboard(JSON.stringify({ errors: this.errorLogs }));
}
} }
} }