BAEL-797 adding some basic UI stuff to show the different login states

This commit is contained in:
tschiman
2017-04-26 22:36:27 -06:00
parent f6c21f132c
commit bf0c42c8d6
7 changed files with 9 additions and 53 deletions
@@ -100,7 +100,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<phase>generate-resources</phase>
<configuration>
<tasks>
<exec executable="cmd" osfamily="windows" dir="${project.basedir}/src/main/angular/ui">
@@ -20,14 +20,15 @@
<div *ngIf="loginFailed">
<div class="alert alert-warning">Login Failed</div>
</div>
</div>
</nav>
<div class="jumbotron">
<div class="container">
<h1>Book Rater App</h1>
<p class="lead">Keep track of all the latest books and their ratings.</p>
<p *ngIf="!principal.authenticated" class="lead">Anyone can view the books.</p>
<p *ngIf="principal.authenticated && !principal.isAdmin()" class="lead">Users can view and create ratings</p>
<p *ngIf="principal.isAdmin()" class="lead">Admins can do anything!</p>
</div>
</div>
@@ -1,31 +0,0 @@
import {TestBed, async} from "@angular/core/testing";
import {AppComponent} from "./app.component";
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app works!'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!');
}));
});
@@ -15,23 +15,13 @@ export class AppComponent {
username: '',
password: ''
};
selectedBook: Book = null;
private username: String = '';
private password: String = '';
principal: Principal = new Principal(false, [], null);
// principal: Principal = new Principal(true, [new Authority("ROLE_USER")], {username: 'user', password: 'password'});
loginFailed: boolean = false;
constructor(private httpService: HttpService){}
ngOnInit(): void {
}
ngOnInit(): void {}
onLogin(form: NgForm) {
this.loginFailed = false;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long