1
0
mirror of https://github.com/dkmstr/openuds-gui.git synced 2024-12-22 17:33:48 +03:00

advancing

This commit is contained in:
Adolfo Gómez García 2018-09-12 09:41:21 +02:00
parent e31a248484
commit 9872eccad7
12 changed files with 52 additions and 114 deletions

View File

@ -5,7 +5,7 @@
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0 --port 9000 --proxy-config proxy.conf.json",
"build": "ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /static/modern/ --base-href /modern",
"build": "ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /uds/res/modern/ --base-href /uds/page",
"postbuild": "python3 toUDS.py",
"test": "ng test",
"lint": "ng lint",

View File

@ -1,95 +1,5 @@
{
"/js": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",
"port": 8000
},
"secure": false,
"changeOrigin": true,
"logLevel": "info"
},
"/modern/services/": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",
"port": 8000
},
"secure": false,
"changeOrigin": true,
"logLevel": "info"
},
"/enable": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",
"port": 8000
},
"secure": false,
"changeOrigin": true,
"logLevel": "info"
},
"/galimg": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",
"port": 8000
},
"secure": false,
"changeOrigin": true,
"logLevel": "info"
},
"/transicon": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",
"port": 8000
},
"secure": false,
"changeOrigin": true,
"logLevel": "info"
},
"/static/img": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",
"port": 8000
},
"secure": false,
"changeOrigin": true,
"logLevel": "info"
},
"/i18n": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",
"port": 8000
},
"secure": false,
"changeOrigin": true,
"logLevel": "info"
},
"/modern/login/": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",
"port": 8000
},
"secure": false,
"changeOrigin": true,
"logLevel": "info"
},
"/modern/logout": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",
"port": 8000
},
"secure": false,
"changeOrigin": true,
"logLevel": "info"
},
"/customAuth": {
"/uds": {
"target": {
"host": "172.27.0.1",
"protocol": "http:",

View File

@ -40,13 +40,12 @@ export class ServiceComponent implements OnInit {
klass.push('maintenance');
} else if (this.service.not_accesible) {
klass.push('forbidden');
}
}
return klass;
}
getTransportIcon(transId: string) {
return this.api.transportIcon(transId);
return this.api.transportIconURL(transId);
}

View File

@ -13,7 +13,8 @@
<mat-menu #userMenu="matMenu">
<button mat-menu-item *ngIf="api.user.isStaff" (click)="admin()"><i class="material-icons">dashboard</i><uds-translate>Dashboard</uds-translate></button>
<button mat-menu-item routerLink="/"><i class="material-icons">settings</i><uds-translate>Preferences</uds-translate></button>
<button mat-menu-item routerLink="/downloads"><i class="material-icons">file_download</i><uds-translate>Downloads</uds-translate></button>
<button mat-menu-item routerLink="/downloads"><i class="material-icons">file_download</i><uds-translate>Downloads</uds-translate></button>
<button mat-menu-item (click)='logout()'><i class="material-icons" style="color: red">exit_to_app</i><uds-translate>Logout</uds-translate></button>
</mat-menu>
<!-- shriked menu -->

View File

@ -38,7 +38,11 @@ export class NavbarComponent implements OnInit {
}
admin() {
window.location.href = this.api.config.urls.admin;
this.api.gotoAdmin();
}
logout() {
this.api.logout();
}
}

View File

@ -12,7 +12,7 @@
<div class="plugins">
<div class="plugin" *ngFor="let p of api.plugins" (click)="download(p.url)">
<div class="image">
<img src="/static/modern/img/{{ p.name }}.png">
<img [src]="img(p.name)">
</div>
<div class="platform">
{{ p.name }}

View File

@ -17,7 +17,11 @@ export class ClientDownloadComponent implements OnInit {
ngOnInit() {
}
download(url) {
download(url: string) {
window.location.href = url;
}
img(image: string) {
return this.api.staticURL( 'modern/img/' + image + '.png');
}
}

View File

@ -6,7 +6,7 @@
<div class="login-container">
<div class="login-brand">
<img src="/static/modern/img/login-img.png">
<img [src]="api.staticURL('modern/img/login-img.png')">
</div>
<div class="login-info">

View File

@ -15,6 +15,7 @@ export interface Authenticator {
// URLs related
export interface UDSUrls {
readonly static: string;
readonly changeLang: string;
readonly login: string;
readonly logout: string;
@ -27,17 +28,16 @@ export interface UDSUrls {
}
export interface UDSConfig {
version: string;
version_stamp: string;
language: string;
available_languages: Lang[];
static: string;
authenticators: Authenticator[];
os: string;
csrf_field: string;
csrf: string;
urls: UDSUrls;
bypassPluginDetection: boolean;
readonly version: string;
readonly version_stamp: string;
readonly language: string;
readonly available_languages: Lang[];
readonly authenticators: Authenticator[];
readonly os: string;
readonly csrf_field: string;
readonly csrf: string;
readonly urls: UDSUrls;
readonly bypassPluginDetection: boolean;
}
export interface Downloadable {

View File

@ -7,6 +7,8 @@ import { JSONServicesInformation, JSONEnabledService } from './types/services';
import { UDSGuiService } from './gui/uds-gui.service';
import { Plugin } from './helpers/plugin';
import { environment } from '../environments/environment';
@Injectable()
export class UDSApiService {
readonly user: User;
@ -33,19 +35,29 @@ export class UDSApiService {
return udsData.plugins;
}
/* Client enabler */
enabler(serviceId: string, transportId: string) {
const enabler = this.config.urls.enabler.replace('param1', serviceId).replace('param2', transportId);
return this.http.get<JSONEnabledService>(enabler);
}
/* Images & static related */
galleryImageURL(imageId: string) {
return this.config.urls.galleryImage.replace('param1', imageId);
}
transportIcon(transportId: string) {
transportIconURL(transportId: string) {
return this.config.urls.transportIcon.replace('param1', transportId);
}
staticURL(url: string) {
if (environment.production) {
return this.config.urls.static + url;
} else {
return '/static' + url;
}
}
/**
* Gets services information
*/
@ -65,6 +77,14 @@ export class UDSApiService {
}
}
gotoAdmin() {
window.location.href = this.config.urls.admin;
}
logout() {
window.location.href = this.config.urls.logout;
}
launchURL(udsURL): void {
this.plugin.launchURL(udsURL);
}

View File

@ -21,7 +21,7 @@
</script>
<!-- DYNAMIC_DATA -->
<script type="text/javascript" src="server/es.js"></script>
<script type="text/javascript" src="/js"></script>
<script type="text/javascript" src="/uds/js"></script>
<!-- ENDDYNAMIC_DATA -->
</head>

View File

@ -157,7 +157,7 @@ def createDirs():
#
# def buildSource():
# os.system('ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /static/modern')
# os.system('ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /uds/res/modern/ --base-href /uds/page')
def main():