* initial commit
This commit is contained in:
23
src/app/admin/admin-routing.module.ts
Normal file
23
src/app/admin/admin-routing.module.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { TeamListComponent} from './team-list/team-list.component';
|
||||
import { TeamService } from '../shared/service/team.service';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'admin/teams/list',
|
||||
component: TeamListComponent,
|
||||
// canActivate: [AuthGuardService, RoleGuardService],
|
||||
resolve: {
|
||||
teams: TeamService,
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AdminRoutingModule {
|
||||
}
|
||||
15
src/app/admin/admin.module.ts
Normal file
15
src/app/admin/admin.module.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { AdminRoutingModule } from './admin-routing.module';
|
||||
import { TeamListComponent } from './team-list/team-list.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
AdminRoutingModule
|
||||
],
|
||||
declarations: [TeamListComponent],
|
||||
providers: []
|
||||
})
|
||||
export class AdminModule { }
|
||||
0
src/app/admin/team-list/team-list.component.css
Normal file
0
src/app/admin/team-list/team-list.component.css
Normal file
26
src/app/admin/team-list/team-list.component.html
Normal file
26
src/app/admin/team-list/team-list.component.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<div class="ui main container">
|
||||
<h1 class="ui dividing header">Teams</h1>
|
||||
<div class="ui raised segments">
|
||||
<div class="ui segment">
|
||||
<table *ngIf="teams?.length" class="ui celled definition table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="clickable">Team</th>
|
||||
<th class="clickable">Members</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let team of teams">
|
||||
<td class="collapsing">
|
||||
<a [routerLink]="['/team/edit', team.id]" title="Change"><i
|
||||
class="large edit link icon"></i></a>
|
||||
</td>
|
||||
<td>{{team.name}}</td>
|
||||
<td>{{fancyMemberNames(team)}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
25
src/app/admin/team-list/team-list.component.spec.ts
Normal file
25
src/app/admin/team-list/team-list.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TeamListComponent } from './team-list.component';
|
||||
|
||||
describe('TeamListComponent', () => {
|
||||
let component: TeamListComponent;
|
||||
let fixture: ComponentFixture<TeamListComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TeamListComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TeamListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
36
src/app/admin/team-list/team-list.component.ts
Normal file
36
src/app/admin/team-list/team-list.component.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { Team } from '../../shared/team';
|
||||
import { TeamService } from '../../shared/service/team.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-team-list',
|
||||
templateUrl: './team-list.component.html',
|
||||
styleUrls: ['./team-list.component.css']
|
||||
})
|
||||
export class TeamListComponent implements OnInit {
|
||||
|
||||
constructor(private teamService: TeamService,
|
||||
private titleService: Title,
|
||||
private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Teams : MTAStv');
|
||||
this.route.data.subscribe((data: {teams: Array<Team>}) => this.teams = data.teams);
|
||||
}
|
||||
|
||||
get teams(): Array<Team> {
|
||||
return this.teamService.teams;
|
||||
}
|
||||
|
||||
set teams(teams: Array<Team>) {
|
||||
this.teamService.teams = teams;
|
||||
}
|
||||
|
||||
public fancyMemberNames(team: Team): String {
|
||||
return team.members.map(member => member.name).join(', ');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user