Commit ed1d192a authored by Lukas Burgey's avatar Lukas Burgey

Make some minor changes

parent db59f40d
......@@ -7,7 +7,7 @@
</ng-container>
<ng-container matColumnDef="info">
<mat-header-cell *matHeaderCellDef>Info</mat-header-cell>
<mat-cell *matCellDef="let element">{{ element.info }}</mat-cell>
<mat-cell *matCellDef="let element">{{ element.info | json }}</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="columns"></mat-header-row>
<mat-row *matRowDef="let row; columns: columns;"></mat-row>
......
<div>
<span *ngIf="userService.userState ? false : true">
<span *ngIf="userService.loggedIn() ? false : true">
<form *ngIf="idps"
(ngSubmit)="userService.login(selectedIdP)" #loginForm="ngForm">
<mat-form-field>
......@@ -12,16 +12,19 @@
<button mat-raised-button [disabled]="!loginForm.form.valid" color="accent" type="submit">Login</button>
</form>
</span>
<span *ngIf="userService.userState">
<span *ngIf="userService.loggedIn()">
<button mat-button mat-icon-button (click)="dialog.openAccount()">
<mat-icon>settings</mat-icon>
</button>
<button mat-button mat-icon-button (click)="dialog.openSshKeys()">
<mat-icon>vpn_key</mat-icon>
</button>
<button mat-button (click)="dialog.openProfile()">
<button *ngIf="userService.user != null" mat-button (click)="dialog.openProfile()">
{{ userService.user?.email }}
</button>
<button *ngIf="userService.user == null" mat-button (click)="dialog.openProfile()">
Profile
</button>
<button mat-raised-button color="accent" (click)="userService.logout()">Logout</button>
</span>
</div>
......@@ -18,6 +18,7 @@ export class LoginComponent {
public userService: UserService,
public dialog: DialogService,
) {
if (!userService.loggedIn()) {
this.userService.getIdPPreference().subscribe(
(allAuthInfo: AllAuthInfo) => {
if (allAuthInfo === null) {
......@@ -27,5 +28,6 @@ export class LoginComponent {
this.selectedIdP = allAuthInfo.selected;
}
);
}
}
}
......@@ -251,7 +251,6 @@ export class UserService {
return this.http.post('/backend/api/questionnaire?id='+String(stateItemID), answers).subscribe(
(data: t.UserState) => {
this.snackBar.open('Uploaded questionnaire');
//this.snackBar.open('Deployed key ' + key.name);
this.updateUserState(data);
},
(err) => {
......@@ -263,10 +262,12 @@ export class UserService {
}
public deleteUser() {
return this.http.delete('/backend/api/delete_user/').subscribe(
(data: t.UserState) => {
this.snackBar.open('Deleted user from server');
this.updateUserState(data);
return this.http.delete('/backend/api/delete_user').subscribe(
(data: {deleted: boolean}) => {
if (data && data.deleted) {
this._logout();
this.snackBar.open('Deleted user from server');
}
},
(err) => {
this.snackBar.open('Error deleting user from server');
......
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