-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from Devoxx4Kids-NPO/LITTIL-284-Admin-login
LITTIL-284 Admin menu for users with admin role
- Loading branch information
Showing
39 changed files
with
396 additions
and
60 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { AdminComponent } from './admin.component'; | ||
import { routes } from './admin.routing'; | ||
import {NgModule} from '@angular/core'; | ||
import {CommonModule} from '@angular/common'; | ||
import {ContentContainerModule} from "../../components/content-container/content-container.module"; | ||
import {RouterModule, Routes} from "@angular/router"; | ||
import { FooterModule } from '../../components/footer/footer.module'; | ||
import {AdminComponent} from "./admin/admin.component"; | ||
import { TitleModule } from "../../components/title/title.module"; | ||
import {ContactBannerModule} from "../../components/contact-banner/contact-banner.module"; | ||
import {UsersComponent} from "./users/users.component"; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: AdminComponent, | ||
}, | ||
{ | ||
path: 'users', | ||
component: UsersComponent, | ||
}, | ||
]; | ||
|
||
@NgModule({ | ||
declarations: [AdminComponent], | ||
imports: [CommonModule, RouterModule.forChild(routes)], | ||
providers: [], | ||
exports: [AdminComponent], | ||
entryComponents: [], | ||
declarations: [ | ||
AdminComponent, | ||
UsersComponent, | ||
], | ||
imports: [ | ||
CommonModule, | ||
ContentContainerModule, | ||
RouterModule.forChild(routes), | ||
TitleModule, | ||
ContactBannerModule, | ||
FooterModule | ||
], | ||
exports: [ContactBannerModule] | ||
}) | ||
export class AdminModule {} | ||
|
||
export class AdminModule { } |
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,11 @@ | ||
<littil-title>Administrator</littil-title> | ||
|
||
<littil-content-container> | ||
<div class="grid grid-cols-12 gap-x-4 my-12"> | ||
<article class="col-span-12 md:col-span-8"> | ||
<h1>TODO !!!!!!</h1> | ||
</article> | ||
|
||
</div> | ||
</littil-content-container> | ||
<littil-footer></littil-footer> |
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,29 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ContentContainerComponent } from '../../../components/content-container/content-container.component'; | ||
import { TitleComponent } from '../../../components/title/title.component'; | ||
import { AdminComponent } from './admin.component'; | ||
import {ContactBannerComponent} from "../../../components/contact-banner/contact-banner.component"; | ||
|
||
describe('AdminComponent', () => { | ||
let component: AdminComponent; | ||
let fixture: ComponentFixture<AdminComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ | ||
AdminComponent, | ||
TitleComponent, | ||
ContentContainerComponent, | ||
ContactBannerComponent | ||
], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(AdminComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
5 changes: 3 additions & 2 deletions
5
src/app/pages/admin/admin.component.ts → src/app/pages/admin/admin/admin.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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'littil-admin', | ||
templateUrl: './admin.component.html', | ||
}) | ||
export class AdminComponent {} | ||
export class AdminComponent { | ||
} |
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,24 @@ | ||
<littil-title>Gebruikers</littil-title> | ||
<littil-content-container> | ||
<div> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>email</th> | ||
<th>roles</th> | ||
<th>Provider</th> | ||
<th>providerId</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let user of users$ | async"> | ||
<td>{{ user.emailAddress }}</td> | ||
<td>{{ user.roles }}</td> | ||
<td>{{ user.provider }}</td> | ||
<td>{{ user.providerId }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</littil-content-container> | ||
<littil-footer></littil-footer> |
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,62 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ButtonComponent } from '../../../components/button/button.component'; | ||
import { ContentContainerComponent } from '../../../components/content-container/content-container.component'; | ||
import { TitleComponent } from '../../../components/title/title.component'; | ||
import { UsersComponent } from './users.component'; | ||
import {ContactBannerComponent} from "../../../components/contact-banner/contact-banner.component"; | ||
import {NO_ERRORS_SCHEMA} from "@angular/core"; | ||
import {MockProvider} from "ng-mocks"; | ||
import {of} from "rxjs"; | ||
import {LittilUserService} from "../../../services/littil-user/littil-user.service"; | ||
import {User} from "../../../api/generated"; | ||
import {By} from "@angular/platform-browser"; | ||
|
||
|
||
const littilUsers: User[] = [ | ||
{"id": "12345", "emailAddress": "[email protected]", | ||
"provider": "AUTH0", "providerId" : "auth0|12345"} | ||
] | ||
|
||
function getUserServiceDef() { | ||
return { | ||
declarations: [ | ||
UsersComponent, | ||
TitleComponent, | ||
ButtonComponent, | ||
ContentContainerComponent, | ||
ContactBannerComponent | ||
], | ||
schemas: [NO_ERRORS_SCHEMA], | ||
providers: [ | ||
MockProvider(LittilUserService, { | ||
getAll: () => of(littilUsers), | ||
}), | ||
] | ||
}; | ||
} | ||
|
||
describe('UsersComponent', () => { | ||
let component: UsersComponent; | ||
let fixture: ComponentFixture<UsersComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule(getUserServiceDef()) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(UsersComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should display users when data is available', () => { | ||
// userServiceMock.getAll.and.returnValue(of(users)); | ||
fixture.detectChanges(); | ||
const rows = fixture.debugElement.queryAll(By.css('tbody tr')); | ||
expect(rows.length).toBe(1); | ||
}); | ||
|
||
}); |
Oops, something went wrong.