Commit db54bcdd authored by Lukas Burgey's avatar Lukas Burgey

Hide login while loading the idps

parent 3dba74a9
......@@ -19,11 +19,12 @@
</button>
</span>
<ng-template #notLoggedIn>
<span>
<form (ngSubmit)="userService.login(selectedIdP)" #loginForm="ngForm">
<span *ngIf="(idps$ | async) as idps">
<form *ngIf="(selectedIdP$ | async) as selectedIdP"
(ngSubmit)="userService.login(selectedIdP)" #loginForm="ngForm">
<mat-form-field>
<mat-select name="idp" required [(ngModel)]="selectedIdP">
<mat-option *ngFor="let idp of idps$ | async" [value]="idp">
<mat-option *ngFor="let idp of idps" [value]="idp">
{{ idp.name }}
</mat-option>
</mat-select>
......
......@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { UserService } from '../user.service';
import { AllAuthInfo, IdP } from '../types/types.module';
import { IdP } from '../types/types.module';
import { IdpService } from '../idp.service';
import { DialogService } from '../dialogues/dialog.service';
......@@ -14,10 +14,8 @@ import { DialogService } from '../dialogues/dialog.service';
})
export class HeaderComponent implements OnInit {
idps$: Observable<IdP[]>;
selectedIdP$: Observable<IdP>;
public selectedIdP: IdP;
public idps$: Observable<IdP[]>;
public selectedIdP$: Observable<IdP>;
constructor(
private idpService: IdpService,
......@@ -26,12 +24,6 @@ export class HeaderComponent implements OnInit {
) {
this.idps$ = this.idpService.subscribeIdps();
this.selectedIdP$ = this.idpService.subscribeSelectedIdp();
this.selectedIdP$.subscribe(
(idp: IdP) => {
this.selectedIdP = idp;
}
);
}
ngOnInit() {
......
......@@ -28,10 +28,10 @@ export class IdpService {
private initializeDataService() {
if (!this.idps$) {
this.idps$ = <BehaviorSubject<IdP[]>> new BehaviorSubject(new Array<IdP>());
this.idps$ = <BehaviorSubject<IdP[]>> new BehaviorSubject(undefined);
}
if (!this.selectedIdp$) {
this.selectedIdp$ = <BehaviorSubject<IdP>> new BehaviorSubject(new Object);
this.selectedIdp$ = <BehaviorSubject<IdP>> new BehaviorSubject(undefined);
}
this.apiCall();
}
......
......@@ -13,11 +13,6 @@ export interface AuthInfo {
default: number;
}
export interface AllAuthInfo {
idps: IdP[];
selected: IdP;
}
// user stuff
export interface EntitlementNameSpace {
name: string;
......
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