-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the logout experience (#4439)
* Add support for including breaking changes in the changelog * Improve the logout experience * Fix unit tests
- Loading branch information
Showing
10 changed files
with
135 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/frontend/packages/core/src/features/login/logout-page/logout-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<app-intro-screen id="app-login-page" class="logout"> | ||
<mat-card class="logout__card"> | ||
<app-stratos-title></app-stratos-title> | ||
<div class="logout__body" *ngIf="error$ | async; else loading"> | ||
<div class="logout__msg">An error occurred logging out</div> | ||
<button (click)="reload()" color="primary" mat-raised-button mat-button>Reload</button> | ||
</div> | ||
<ng-template #loading> | ||
<div class="logout__body"> | ||
<div class="logout__msg">Logging out</div> | ||
<div id="logout__loading" class="logout__loading"> | ||
<mat-progress-bar mode="indeterminate"></mat-progress-bar> | ||
</div> | ||
</div> | ||
</ng-template> | ||
</mat-card> | ||
</app-intro-screen> |
14 changes: 14 additions & 0 deletions
14
src/frontend/packages/core/src/features/login/logout-page/logout-page.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.logout { | ||
&__card { | ||
padding: 0; | ||
width: 300px; | ||
} | ||
&__body { | ||
padding: 24px; | ||
text-align: center; | ||
} | ||
&__msg { | ||
font-size: 18px; | ||
padding-bottom: 20px; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/frontend/packages/core/src/features/login/logout-page/logout-page.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { CoreModule } from '@angular/flex-layout'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { StoreModule } from '@ngrx/store'; | ||
|
||
import { appReducers } from '../../../../../store/src/reducers.module'; | ||
import { SharedModule } from '../../../public-api'; | ||
import { LogoutPageComponent } from './logout-page.component'; | ||
|
||
describe('LogoutPageComponent', () => { | ||
let component: LogoutPageComponent; | ||
let fixture: ComponentFixture<LogoutPageComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ LogoutPageComponent ], | ||
imports: [ | ||
CommonModule, | ||
CoreModule, | ||
SharedModule, | ||
RouterTestingModule, | ||
NoopAnimationsModule, | ||
StoreModule.forRoot( | ||
appReducers | ||
) | ||
] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(LogoutPageComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
src/frontend/packages/core/src/features/login/logout-page/logout-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Store } from '@ngrx/store'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
|
||
import { Logout } from '../../../../../store/src/actions/auth.actions'; | ||
import { AppState } from '../../../../../store/src/app-state'; | ||
|
||
@Component({ | ||
selector: 'app-logout-page', | ||
templateUrl: './logout-page.component.html', | ||
styleUrls: ['./logout-page.component.scss'] | ||
}) | ||
export class LogoutPageComponent implements OnInit { | ||
|
||
public error$: Observable<boolean>; | ||
|
||
constructor(private store: Store<AppState>) { | ||
this.error$ = this.store.select(s => s.auth).pipe( | ||
map(auth => auth.error) | ||
); | ||
} | ||
|
||
ngOnInit() { | ||
// Dispatch the logout action after 1 second - give the logging out screen time to show | ||
setTimeout(() => { | ||
this.store.dispatch(new Logout()); | ||
}, 1000) | ||
} | ||
|
||
reload() { | ||
window.location.assign(window.location.origin); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters