diff --git a/src/app/components/tabels/userstory-inner-table/userstory-inner-table.component.ts b/src/app/components/tabels/userstory-inner-table/userstory-inner-table.component.ts index f48b03a..6701b90 100644 --- a/src/app/components/tabels/userstory-inner-table/userstory-inner-table.component.ts +++ b/src/app/components/tabels/userstory-inner-table/userstory-inner-table.component.ts @@ -24,26 +24,20 @@ export class UserstoryInnerTableComponent extends TableComponentBase - this.filterPriority === null || task.priority === this.filterPriority - ); - } - constructor( private backendService: BackendService, private modalService: NgbModal, private route: ActivatedRoute, - private router: Router ) { super(); - this.applyFilterParameters(this.route.snapshot.paramMap); - this.route.paramMap.subscribe((map) => this.applyFilterParameters(map)); - + backendService.getUserstories().subscribe((response) => { + if (response.status > 399) { + alert('Fehler'); + } else { + this.items.push(...response.body); + } + }); backendService.getTasks().subscribe((response) => { if (response.status > 399) { alert('Fehler'); @@ -67,57 +61,16 @@ export class UserstoryInnerTableComponent extends TableComponentBase { - if (response.status > 399) { - alert('Fehler'); - } - }); - const index = this.items.indexOf(userstory); - if (index !== -1) { - this.items.splice(index, 1); - } - } - - public openUserstoryForm(editUserstory?: ScrumUserstory) { - const modalRef = this.modalService.open(UserstoryFormComponent, { - backdrop: 'static', - keyboard: true, - size: "lg", - }); - if (editUserstory === null) { - modalRef.result.then((result) => { - this.items.push(result); - }); - } - modalRef.componentInstance.userstory = editUserstory; + //#region getters + public get filteredItems() { + if(this.filterPriority == null){return this.items;} + return this.items.filter(t => t.priority == this.filterPriority); } public getNumberOfTasks(userstory: ScrumUserstory) { return this.tasks.filter((t) => t.userstoryid === userstory.id).length; } - public sortByPrio() { - this.doNumericSort('priority', (us) => getNumberForPriority(us.priority)); - } - - public sortByTasks() { - this.doNumericSort('tasks', (us) => this.getNumberOfTasks(us)); - } - - sortByStatus() { - this.doNumericSort('statusid', (us) => us.statusid); - } - sortByCategory() { - this.doNumericSort('categoryid', (us) => us.categoryid); - } - getStatusTitleById(id) { var status = this.status.find((x) => x.id === id); if (!status) { @@ -133,4 +86,59 @@ export class UserstoryInnerTableComponent extends TableComponentBase { + if (response.status > 399) { + alert('Fehler'); + } + }); + const index = this.items.indexOf(userstory); + if (index !== -1) { + this.items.splice(index, 1); + } + } + //#endregion userstoryTableFunctions + + //#region sorters + public sortByPrio() { + this.doNumericSort('priority', (us) => getNumberForPriority(us.priority)); + } + + public sortByTasks() { + this.doNumericSort('tasks', (us) => this.getNumberOfTasks(us)); + } + + public sortByStatus() { + this.doNumericSort('statusid', (us) => us.statusid); + } + public sortByCategory() { + this.doNumericSort('categoryid', (us) => us.categoryid); + } + //#endregion sorters + + //#region modals + public openUserstoryForm(editUserstory?: ScrumUserstory) { + const modalRef = this.modalService.open(UserstoryFormComponent, { + backdrop: 'static', + keyboard: true, + size: "lg", + }); + if (editUserstory === null) { + modalRef.result.then((result) => { + this.items.push(result); + }); + } + modalRef.componentInstance.userstory = editUserstory; + } + //#endregion modals } +