Commit db54bcdd authored by Lukas Burgey's avatar Lukas Burgey

Hide login while loading the idps

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