1
0
mirror of https://github.com/dkmstr/openuds-gui.git synced 2025-01-03 05:17:36 +03:00

Merge remote-tracking branch 'origin/v3.5'

This commit is contained in:
Adolfo Gómez García 2022-05-17 16:42:57 +02:00
commit fc7535288d
2 changed files with 15 additions and 7 deletions

View File

@ -12,7 +12,9 @@
<h1 class="title"> <h1 class="title">
<uds-translate>An error has occurred</uds-translate> <uds-translate>An error has occurred</uds-translate>
</h1> </h1>
<p class="description" [innerHTML]="this.error | safeHtml">
<p class="description">
<span *ngFor="let error of this.error" [innerHTML]="error"></span>
</p> </p>
<a mat-raised-button color="warn" routerLink="/"><uds-translate>Return</uds-translate></a> <a mat-raised-button color="warn" routerLink="/"><uds-translate>Return</uds-translate></a>

View File

@ -7,12 +7,12 @@ declare const udsData: any;
@Component({ @Component({
selector: 'uds-error', selector: 'uds-error',
templateUrl: './error.component.html', templateUrl: './error.component.html',
styleUrls: ['./error.component.css'] styleUrls: ['./error.component.css'],
}) })
export class ErrorComponent implements OnInit { export class ErrorComponent implements OnInit {
error = ''; error: string[] = [''];
constructor(private route: ActivatedRoute) { } constructor(private route: ActivatedRoute) {}
ngOnInit() { ngOnInit() {
this.getError(); this.getError();
@ -21,13 +21,19 @@ export class ErrorComponent implements OnInit {
getError(): void { getError(): void {
const id = this.route.snapshot.paramMap.get('id'); const id = this.route.snapshot.paramMap.get('id');
try { try {
this.error = new TextDecoder().decode(Uint8Array.from(window.atob(id), c => (c as any).charCodeAt(c))).replace('\n', '<br/>'); const errText = new TextDecoder()
.decode(
Uint8Array.from(window.atob(id), (c) => (c as any).charCodeAt(c))
)
.replace('<', '&lt;')
.replace('>', '&gt;');
// Split error text in lines
this.error = errText.split('\n');
console.log(this.error); console.log(this.error);
udsData.error = this.error; udsData.error = this.error;
} catch (e) { } catch (e) {
console.log(e); console.log(e);
this.error = django.gettext('Invalid error string'); this.error = [django.gettext('Invalid error string')];
} }
} }
} }