Cleaned up the sprint table
This commit is contained in:
parent
cd7221503d
commit
05e233c05e
@ -45,7 +45,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr *ngFor="let sprint of filteredItems" [class.table-info]="sprint.id === highlightId">
|
||||
<tr *ngFor="let sprint of items" [class.table-info]="sprint.id === highlightId">
|
||||
<td>{{sprint.id}}</td>
|
||||
<td>{{sprint.title}}</td>
|
||||
<td>{{sprint.startDate | date:'dd.MM.yyyy'}}</td>
|
||||
|
@ -11,14 +11,8 @@ import { SprintFormComponent } from '../../sprint-form/sprint-form.component';
|
||||
styleUrls: ['./sprint-table.component.css']
|
||||
})
|
||||
export class SprintTableComponent extends TableComponentBase<ScrumSprint> {
|
||||
public filterSprintId: number | null = null;
|
||||
public highlightId: number;
|
||||
|
||||
public get filteredItems() {
|
||||
return this.items.filter(sprint =>
|
||||
(this.filterSprintId === null || sprint.id === this.filterSprintId)
|
||||
);
|
||||
}
|
||||
|
||||
constructor(
|
||||
private backendService: BackendService, private modalService: NgbModal,
|
||||
@ -26,9 +20,6 @@ export class SprintTableComponent extends TableComponentBase<ScrumSprint> {
|
||||
) {
|
||||
super();
|
||||
|
||||
this.applyFilterParameters(route.snapshot.paramMap);
|
||||
route.paramMap.subscribe(map => this.applyFilterParameters(map));
|
||||
|
||||
backendService.getSprints().subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
@ -38,12 +29,10 @@ export class SprintTableComponent extends TableComponentBase<ScrumSprint> {
|
||||
});
|
||||
}
|
||||
|
||||
private applyFilterParameters(params: ParamMap) {
|
||||
if (params.has('id')) {
|
||||
this.highlightId = parseInt(params.get('id'));
|
||||
}
|
||||
}
|
||||
//#region getters
|
||||
//#endregion getters
|
||||
|
||||
//#region sprintTableFunctions
|
||||
public deleteSprint(sprint: ScrumSprint) {
|
||||
this.backendService.deleteSprint(sprint).subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
@ -55,11 +44,24 @@ export class SprintTableComponent extends TableComponentBase<ScrumSprint> {
|
||||
this.items.splice(index, 1);
|
||||
}
|
||||
}
|
||||
//#endregion sprintTableFunctions
|
||||
|
||||
//#region sorters
|
||||
sortByStartDate() {
|
||||
this.doStringSort('startDate', sprint => sprint.startDate);
|
||||
}
|
||||
|
||||
sortByEndDate() {
|
||||
this.doStringSort('endDate', sprint => sprint.endDate);
|
||||
}
|
||||
//#endregion sorters
|
||||
|
||||
//#region modals
|
||||
public openSprintForm(editSprint?: ScrumSprint) {
|
||||
const modalRef = this.modalService.open(SprintFormComponent, {
|
||||
backdrop: 'static',
|
||||
keyboard: true,
|
||||
size: "md",
|
||||
});
|
||||
if (editSprint === null) {
|
||||
modalRef.result.then(result => {
|
||||
@ -68,20 +70,5 @@ export class SprintTableComponent extends TableComponentBase<ScrumSprint> {
|
||||
}
|
||||
modalRef.componentInstance.sprint = editSprint;
|
||||
}
|
||||
|
||||
sortById() {
|
||||
this.doNumericSort('id', sprint => sprint.id);
|
||||
}
|
||||
|
||||
sortByTitle() {
|
||||
this.doStringSort('title', sprint => sprint.title);
|
||||
}
|
||||
|
||||
sortByStartDate() {
|
||||
this.doStringSort('startDate', sprint => sprint.startDate);
|
||||
}
|
||||
|
||||
sortByEndDate() {
|
||||
this.doStringSort('endDate', sprint => sprint.endDate);
|
||||
}
|
||||
//#endregion modals
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user