1
0
mirror of https://github.com/dkmstr/openuds-gui.git synced 2024-10-26 08:55:23 +03:00

advancing more

This commit is contained in:
Adolfo Gómez García 2018-09-10 09:26:46 +02:00
parent 9741d94c99
commit 1c2354a478
8 changed files with 123 additions and 18 deletions

View File

@ -39,6 +39,26 @@
"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",

View File

@ -1,21 +1,21 @@
.service {
width: 8rem;
height: auto;
margin: 0 1rem 2rem 0;
padding: 1rem;
border-radius: 1rem;
box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
padding: 0.5rem 1rem 1rem 1rem;
/*border-radius: 1rem;*/
box-shadow: 0 12px 18px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
transition: all 0.3s cubic-bezier(.25, .8, .25, 1);
flex: 1 0 25%;
display: flex;
flex: 1;
align-items: center;
justify-content: center;
justify-content: start;
flex-flow: column wrap;
/*background-color: #F0F0F0;*/
}
.service:hover {
cursor: pointer;
box-shadow: 0 0.1rem 0.2rem rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
}
.icon {
@ -27,4 +27,31 @@
.icon img {
width: 100%;
height: 100%;
max-height: 96px;
overflow: hidden;
}
.name {
margin-top: 0.5em;
font-size: 1.2em;
display: flex;
flex: 1 0 auto;
flex-flow: row auto;
align-items: center;
justify-content: space-between;
height: 2.5rem;
}
.name button {
justify-self: flex-end;
}
.transport-item {
display: flex;
align-items: center;
}
.transport-item img {
width: 2em;
margin-right: 0.4em;
}

View File

@ -1,11 +1,37 @@
<div class="service" (click)="launch()">
<div class="icon">
<div *ngIf="service.transports.length > 0">
<mat-menu #transports>
<button mat-menu-item *ngFor="let trans of service.transports">
<div class="transport-item">
<img [src]="getTransportIcon(trans.id)">
{{ trans.name }}
</div>
</button>
</mat-menu>
<mat-menu #actions>
<button mat-menu-item *ngIf="service.allow_users_remove">
<i class="fa fa-trash"></i> <uds-translate> Release service</uds-translate>
</button>
<button mat-menu-item *ngIf="service.allow_users_reset">
<i class="fa fa-refresh"></i> <uds-translate> Reset service</uds-translate>
</button>
</mat-menu>
<mat-menu #menu>
<button mat-menu-item [matMenuTriggerFor]="transports" *ngIf="hasManyTransports()"><uds-translate>Transports</uds-translate></button>
<button mat-menu-item [matMenuTriggerFor]="actions" *ngIf="hasActions()"><uds-translate>Actions</uds-translate></button>
</mat-menu>
<div class="service">
<div class="icon" (click)="launch()">
<img [src]="serviceImage">
</div>
<div class="name">
{{ serviceName }}
<div>{{ serviceName }}</div>
<div>
<button mat-icon-button [matMenuTriggerFor]="menu" *ngIf="hasMenu()"><i class="fa fa-gears"></i></button>
</div>
<div class="toolbar">
</div>
</div>
</div>

View File

@ -19,7 +19,7 @@ export class ServiceComponent implements OnInit {
}
get serviceImage() {
return this.api.galeryImageURL(this.service.imageId);
return this.api.galleryImageURL(this.service.imageId);
}
get serviceName() {
@ -34,7 +34,34 @@ export class ServiceComponent implements OnInit {
return this.service.name;
}
getTransportIcon(transId: string) {
return this.api.transportIcon(transId);
}
hasActions() {
return this.service.allow_users_remove || this.service.allow_users_reset;
}
hasManyTransports() {
return this.service.transports.length > 1;
}
hasMenu() {
return this.hasActions() || this.hasManyTransports();
}
notifyNotLaunching(message: string) {
this.api.gui.alert(django.gettext('Launcher'), message);
}
launch() {
if (this.service.maintenance ) {
this.notifyNotLaunching(django.gettext('Service is in maintenance and cannot be launched'));
}
if (this.service.not_accesible) {
this.notifyNotLaunching(django.gettext('Service has been restricted and cannot be launched'));
}
this.api.launchURL(this.service.transports[0].link);
}
}

View File

@ -19,7 +19,7 @@ export class ServicesGroupComponent implements OnInit {
}
get groupImage() {
return this.api.galeryImageURL(this.group.imageUuid);
return this.api.galleryImageURL(this.group.imageUuid);
}
}

View File

@ -19,7 +19,7 @@
<!-- shriked menu -->
<mat-menu x-position="before" #shrink="matMenu">
<button mat-menu-item *ngIf="api.user.isLogged" [matMenuTriggerFor]="userMenu">{{api.user.user}}</button>
<button mat-menu-item [matMenuTriggerFor]="appMenu">{{ lang.name }}</button>
<button mat-menu-item routerLink="/client-download">UDS Plugin</button>
<button mat-menu-item routerLink="/about"><uds-translate>About</uds-translate></button>
</mat-menu>

View File

@ -22,7 +22,8 @@ export interface UDSUrls {
readonly services: string;
readonly admin: string;
readonly enabler: string;
readonly galeryImage: string;
readonly galleryImage: string;
readonly transportIcon: string;
}
export interface UDSConfig {

View File

@ -38,8 +38,12 @@ export class UDSApiService {
return this.http.get<JSONEnabledService>(enabler);
}
galeryImageURL(imageUuid: string) {
return this.config.urls.galeryImage.replace('param1', imageUuid);
galleryImageURL(imageId: string) {
return this.config.urls.galleryImage.replace('param1', imageId);
}
transportIcon(transportId: string) {
return this.config.urls.transportIcon.replace('param1', transportId);
}
/**