Commit for server test

This commit is contained in:
Julius Gruber
2019-10-16 13:14:24 +02:00
parent 331596968b
commit a59aafb1f4
3 changed files with 26 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import { ShibbConstants } from '../../../+login-page/shibbolethTargetPage/const/
export class AuthMethodModel { export class AuthMethodModel {
authMethodType: AuthMethodType; authMethodType: AuthMethodType;
location?: string; location?: string;
isStandalonePage?: any;
constructor(authMethodName: string, location?: string) { constructor(authMethodName: string, location?: string) {
switch (authMethodName) { switch (authMethodName) {

View File

@@ -1,6 +1,6 @@
<ds-loading *ngIf="(loading | async) || (isAuthenticated | async)" class="m-5"></ds-loading> <ds-loading *ngIf="(loading | async) || (isAuthenticated | async)" class="m-5"></ds-loading>
<div *ngIf="!(loading | async) && !(isAuthenticated | async)" class="form-login px-4 py-3"> <div *ngIf="!(loading | async) && !(isAuthenticated | async)" class="form-login px-4 py-3">
<ng-container *ngFor="let authMethodModel of injectedAuthMethods"> <ng-container *ngFor="let authMethodModel of (authMethodData | async)">
<ds-login-container <ds-login-container
[authMethodModel]="authMethodModel"></ds-login-container> [authMethodModel]="authMethodModel"></ds-login-container>
</ng-container> </ng-container>

View File

@@ -5,7 +5,7 @@ import { select, Store } from '@ngrx/store';
import { getAuthenticationMethods, isAuthenticated, isAuthenticationLoading } from '../../core/auth/selectors'; import { getAuthenticationMethods, isAuthenticated, isAuthenticationLoading } from '../../core/auth/selectors';
import { CoreState } from '../../core/core.reducers'; import { CoreState } from '../../core/core.reducers';
import { InjectedAuthMethodModel } from './injectedAuthMethodModel/injectedAuthMethodModel'; import { InjectedAuthMethodModel } from './injectedAuthMethodModel/injectedAuthMethodModel';
import { filter, takeWhile } from 'rxjs/operators'; import { filter, takeWhile, tap } from 'rxjs/operators';
import { AuthService } from '../../core/auth/auth.service'; import { AuthService } from '../../core/auth/auth.service';
@Component({ @Component({
@@ -51,16 +51,29 @@ export class LogInComponent implements OnInit, OnDestroy {
} }
ngOnInit(): void { ngOnInit(): void {
this.authMethodData = this.store.pipe(select(getAuthenticationMethods)); /* this.store.pipe(
select(getAuthenticationMethods),
tap((authMethods) => console.log('authMethods: ', authMethods))
).subscribe(
(authMethods) => this.authMethodData = authMethods
);*/
this.subscription = this.authMethodData.subscribe((methods) => this.authMethods = methods); this.authMethodData = this.store.pipe(
this.injectedAuthMethods = new Array<InjectedAuthMethodModel>(); select(getAuthenticationMethods),
// tslint:disable-next-line:forin /* tap((authMethods) => authMethods.forEach((method) => {
for (const index in this.authMethods) { method.isStandalonePage = this.isStandalonePage;
const injectedAuthMethod = new InjectedAuthMethodModel(this.authMethods[index].authMethodType, this.authMethods[index].location, this.isStandalonePage); }))*/
this.injectedAuthMethods.push(injectedAuthMethod); );
} /*
console.log('injectedAuthMethods in ngOnInit(): ', this.injectedAuthMethods); this.subscription = this.authMethodData.subscribe((methods) => this.authMethods = methods);
this.injectedAuthMethods = new Array<InjectedAuthMethodModel>();
// tslint:disable-next-line:forin
for (const index in this.authMethods) {
const injectedAuthMethod = new InjectedAuthMethodModel(this.authMethods[index].authMethodType, this.authMethods[index].location, this.isStandalonePage);
this.injectedAuthMethods.push(injectedAuthMethod);
}
console.log('injectedAuthMethods in ngOnInit(): ', this.injectedAuthMethods);
*/
// set loading // set loading
this.loading = this.store.pipe(select(isAuthenticationLoading)); this.loading = this.store.pipe(select(isAuthenticationLoading));
@@ -81,7 +94,7 @@ export class LogInComponent implements OnInit, OnDestroy {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.subscription.unsubscribe(); // this.subscription.unsubscribe();
this.alive = false; this.alive = false;
} }