Commit 936e90fe authored by Lukas Burgey's avatar Lukas Burgey

Add language service

parent cb881c55
import { NgModule,Pipe,PipeTransform } from '@angular/core'; import { NgModule, LOCALE_ID } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
...@@ -15,6 +15,7 @@ import { CookieService } from 'ngx-cookie-service'; ...@@ -15,6 +15,7 @@ import { CookieService } from 'ngx-cookie-service';
// //
// services // services
import { UserService } from './user.service'; import { UserService } from './user.service';
import { LanguageService } from './language.service';
import { SnackBarService } from './snackbar.service'; import { SnackBarService } from './snackbar.service';
// imports // imports
...@@ -59,11 +60,14 @@ import { VoDataComponent } from './vo-data/vo-data.component'; ...@@ -59,11 +60,14 @@ import { VoDataComponent } from './vo-data/vo-data.component';
providers: [ providers: [
CookieService, CookieService,
UserService, UserService,
LanguageService,
SnackBarService, SnackBarService,
StompRService, StompRService,
JsonPipe, JsonPipe,
], ],
bootstrap: [AppComponent], bootstrap: [
AppComponent,
],
}) })
export class AppModule { export class AppModule {
constructor() { constructor() {
......
...@@ -29,7 +29,7 @@ export class AccountComponent implements OnInit { ...@@ -29,7 +29,7 @@ export class AccountComponent implements OnInit {
this.dialog.open( this.dialog.open(
ProfileComponent, ProfileComponent,
{ {
width: '70%', panelClass: 'scrolling-dialog',
data: { data: {
user: user, user: user,
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div> <div>
<h2>Key Information</h2> <h2>Key Information</h2>
<p> <p>
These are the current states of your keys at this service. The keys listed as "deployed" can be used to access the service via ssh. These are the current states of your keys at this service. The keys listed as "{{ lang.printState('deployed') }}" can be used to access the service via ssh.
</p> </p>
<table> <table>
<thead> <thead>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<mat-icon *ngSwitchCase="'rejected'" mat-icon-button>error</mat-icon> <mat-icon *ngSwitchCase="'rejected'" mat-icon-button>error</mat-icon>
<mat-icon *ngSwitchDefault mat-icon-button>call_received</mat-icon> <mat-icon *ngSwitchDefault mat-icon-button>call_received</mat-icon>
</span> </span>
{{ state.state }} {{ lang.printState(state.state) }}
</td> </td>
<td style="font-size: 110%;"> <td style="font-size: 110%;">
{{ state.credential.name }} {{ state.credential.name }}
......
...@@ -4,6 +4,7 @@ import { MAT_DIALOG_DATA, MatTableDataSource } from '@angular/material'; ...@@ -4,6 +4,7 @@ import { MAT_DIALOG_DATA, MatTableDataSource } from '@angular/material';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { UserService } from '../../user.service'; import { UserService } from '../../user.service';
import { LanguageService } from '../../language.service';
import { DeploymentState, Service, CredentialState } from '../../types/types.module'; import { DeploymentState, Service, CredentialState } from '../../types/types.module';
@Component({ @Component({
...@@ -21,6 +22,7 @@ export class CredentialsComponent implements OnInit { ...@@ -21,6 +22,7 @@ export class CredentialsComponent implements OnInit {
constructor( constructor(
public userService: UserService, public userService: UserService,
public lang: LanguageService,
@Inject(MAT_DIALOG_DATA) public data: any, @Inject(MAT_DIALOG_DATA) public data: any,
) { ) {
if (data) { if (data) {
......
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class LanguageService {
constructor() { }
public printState(state: string) {
switch (state) {
case "not_deployed":
return "Not deployed";
case "deployed":
return "Deployed";
case "deployment_pending":
return "Deployment pending";
case "removal_pending":
return "Removal pending";
case "failed":
return "Failed";
case "rejected":
return "Rejected";
default:
return "Not deployed";
}
}
}
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<mat-icon *ngSwitchCase="'rejected'" mat-icon-button matTooltip="Site {{ site.name }} rejected the deployment of the credentials. Click for details.">error</mat-icon> <mat-icon *ngSwitchCase="'rejected'" mat-icon-button matTooltip="Site {{ site.name }} rejected the deployment of the credentials. Click for details.">error</mat-icon>
<mat-icon *ngSwitchDefault mat-icon-button matTooltip="Access to this service was never requested.">call_received</mat-icon> <mat-icon *ngSwitchDefault mat-icon-button matTooltip="Access to this service was never requested.">call_received</mat-icon>
</span> </span>
{{ stateItem.state }} {{ lang.printState(stateItem.state) }}
</td> </td>
<td *ngIf="stateItem.state === 'questionaire'"> <td *ngIf="stateItem.state === 'questionaire'">
<button (click)="dialog.openQuestionnaire(stateItem)" mat-raised-button class="mat-elevation-z6"> Questionnaire </button> <button (click)="dialog.openQuestionnaire(stateItem)" mat-raised-button class="mat-elevation-z6"> Questionnaire </button>
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<td *ngIf="stateItem.state === 'rejected'"> <td *ngIf="stateItem.state === 'rejected'">
<button (click)="dialog.openMessage(stateItem)" mat-raised-button class="mat-elevation-z6"> Rejected </button> <button (click)="dialog.openMessage(stateItem)" mat-raised-button class="mat-elevation-z6"> Rejected </button>
</td> </td>
<td *ngIf="stateItem.is_credential_pending"> <td *ngIf="!stateItem.is_pending && stateItem.is_credential_pending">
<span class="spaced"> <span class="spaced">
<mat-progress-spinner diameter="24" mode="indeterminate"></mat-progress-spinner> <mat-progress-spinner diameter="24" mode="indeterminate"></mat-progress-spinner>
</span> </span>
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
<span> <span>
<mat-icon mat-icon-button matTooltip="Access to this service was never requested.">call_received</mat-icon> <mat-icon mat-icon-button matTooltip="Access to this service was never requested.">call_received</mat-icon>
</span> </span>
{{ lang.printState('not_deployed') }}
</td> </td>
</ng-template> </ng-template>
</tr> </tr>
......
...@@ -4,6 +4,7 @@ import { Observable, BehaviorSubject } from 'rxjs'; ...@@ -4,6 +4,7 @@ import { Observable, BehaviorSubject } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { UserService } from '../user.service'; import { UserService } from '../user.service';
import { LanguageService } from '../language.service';
import { DialogService } from '../dialogues/dialog.service'; import { DialogService } from '../dialogues/dialog.service';
import { VO, Site, Service, Deployment, DeploymentState } from '../types/types.module'; import { VO, Site, Service, Deployment, DeploymentState } from '../types/types.module';
...@@ -29,6 +30,7 @@ export class VoDataComponent implements OnInit { ...@@ -29,6 +30,7 @@ export class VoDataComponent implements OnInit {
constructor( constructor(
public userService: UserService, public userService: UserService,
public lang: LanguageService,
public dialog: DialogService, public dialog: DialogService,
) { ) {
} }
......
...@@ -95,4 +95,5 @@ mat-checkbox { ...@@ -95,4 +95,5 @@ mat-checkbox {
.scrolling-dialog .mat-dialog-container { .scrolling-dialog .mat-dialog-container {
margin: 70px 0px 6px 0px; margin: 70px 0px 6px 0px;
height: unset; height: unset;
min-width: 800px;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment