mirror of
https://github.com/dkmstr/openuds-gui.git
synced 2024-12-22 17:33:48 +03:00
Merge remote-tracking branch 'origin/v3.5'
This commit is contained in:
commit
4b290e907d
@ -14,7 +14,7 @@
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<p class="description">
|
<p class="description">
|
||||||
<span *ngFor="let error of this.error" [innerHTML]="error"></span>
|
{{ error }}
|
||||||
</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>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { UDSApiService } from '../../uds-api.service';
|
||||||
|
|
||||||
declare const django: any;
|
declare const django: any;
|
||||||
declare const udsData: any;
|
declare const udsData: any;
|
||||||
@ -10,9 +11,9 @@ declare const udsData: any;
|
|||||||
styleUrls: ['./error.component.css'],
|
styleUrls: ['./error.component.css'],
|
||||||
})
|
})
|
||||||
export class ErrorComponent implements OnInit {
|
export class ErrorComponent implements OnInit {
|
||||||
error: string[] = [''];
|
error: string;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute) {}
|
constructor(public api: UDSApiService, private route: ActivatedRoute) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.getError();
|
this.getError();
|
||||||
@ -20,20 +21,11 @@ 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 {
|
this.error = '';
|
||||||
const errText = new TextDecoder()
|
// Request error string from UDS
|
||||||
.decode(
|
this.api.getErrorInformation(id).subscribe((errInfo) => {
|
||||||
Uint8Array.from(window.atob(id), (c) => (c as any).charCodeAt(c))
|
// Set error to errInfo.error + Hex code
|
||||||
)
|
this.error = errInfo.error;
|
||||||
.replace('<', '<')
|
});
|
||||||
.replace('>', '>');
|
|
||||||
// Split error text in lines
|
|
||||||
this.error = errText.split('\n');
|
|
||||||
console.log(this.error);
|
|
||||||
udsData.error = this.error;
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
this.error = [django.gettext('Invalid error string')];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ export interface UDSUrls {
|
|||||||
readonly galleryImage: string;
|
readonly galleryImage: string;
|
||||||
readonly transportIcon: string;
|
readonly transportIcon: string;
|
||||||
readonly clientDownload: string;
|
readonly clientDownload: string;
|
||||||
|
readonly error: string;
|
||||||
|
|
||||||
readonly launch: string;
|
readonly launch: string;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,11 @@ export interface JSONServicesInformation {
|
|||||||
transports: string;
|
transports: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface JSONErrorInformation {
|
||||||
|
error: string;
|
||||||
|
code: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface JSONEnabledService {
|
export interface JSONEnabledService {
|
||||||
url: string;
|
url: string;
|
||||||
error: string;
|
error: string;
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
JSONStatusService,
|
JSONStatusService,
|
||||||
JSONService,
|
JSONService,
|
||||||
JSONTransportURLService,
|
JSONTransportURLService,
|
||||||
|
JSONErrorInformation,
|
||||||
} from './types/services';
|
} from './types/services';
|
||||||
import { UDSGuiService } from './gui/uds-gui.service';
|
import { UDSGuiService } from './gui/uds-gui.service';
|
||||||
import { Plugin } from './helpers/plugin';
|
import { Plugin } from './helpers/plugin';
|
||||||
@ -141,6 +142,13 @@ export class UDSApiService implements UDSApiServiceType {
|
|||||||
return this.http.get<JSONServicesInformation>(this.config.urls.services);
|
return this.http.get<JSONServicesInformation>(this.config.urls.services);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets error string from a code
|
||||||
|
*/
|
||||||
|
getErrorInformation(errorCode: string): Observable<JSONErrorInformation> {
|
||||||
|
return this.http.get<JSONErrorInformation>(this.config.urls.error.replace('9999', errorCode));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes custom javascript for service launch if it is available
|
* Executes custom javascript for service launch if it is available
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user