From ed0a8cbd312fc2ab009a7d3e939f1b49756f4a50 Mon Sep 17 00:00:00 2001 From: Niggl Date: Tue, 14 Jul 2020 18:44:13 +0200 Subject: [PATCH] Fixed wrongly placed files --- .../userstory-inner-table.component.spec.ts | 2 +- .../userstory-inner-table.component.css | 0 .../userstory-inner-table.component.html | 90 ----------- .../userstory-inner-table.component.ts | 143 ------------------ 4 files changed, 1 insertion(+), 234 deletions(-) rename src/app/components/{ => tabels}/userstory-inner-table/userstory-inner-table.component.spec.ts (92%) delete mode 100644 src/app/userstory-inner-table/userstory-inner-table.component.css delete mode 100644 src/app/userstory-inner-table/userstory-inner-table.component.html delete mode 100644 src/app/userstory-inner-table/userstory-inner-table.component.ts diff --git a/src/app/components/userstory-inner-table/userstory-inner-table.component.spec.ts b/src/app/components/tabels/userstory-inner-table/userstory-inner-table.component.spec.ts similarity index 92% rename from src/app/components/userstory-inner-table/userstory-inner-table.component.spec.ts rename to src/app/components/tabels/userstory-inner-table/userstory-inner-table.component.spec.ts index 66d55db..0cd9275 100644 --- a/src/app/components/userstory-inner-table/userstory-inner-table.component.spec.ts +++ b/src/app/components/tabels/userstory-inner-table/userstory-inner-table.component.spec.ts @@ -1,6 +1,6 @@ import { TestBed, async } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; -import { BackendService } from '../../services/backend.service'; +import { BackendService } from '../../../services/backend.service'; import { HttpClientModule } from '@angular/common/http'; import { UserstoryInnerTableComponent } from './userstory-inner-table.component'; diff --git a/src/app/userstory-inner-table/userstory-inner-table.component.css b/src/app/userstory-inner-table/userstory-inner-table.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/userstory-inner-table/userstory-inner-table.component.html b/src/app/userstory-inner-table/userstory-inner-table.component.html deleted file mode 100644 index 2706790..0000000 --- a/src/app/userstory-inner-table/userstory-inner-table.component.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ID - - - - - - Titel - - - - - - Tasks - - - - - - Status - - - - - - Priorität - - - - - - - Category - - - - -
{{userstory.id}}{{userstory.title}} - - {{getNumberOfTasks(userstory)}} Tasks - - - - {{getStatusTitleById(userstory.statusid)}} - - {{userstory.priority}} - - {{getCategoryTitleById(userstory.categoryid)}} - - - - -
\ No newline at end of file diff --git a/src/app/userstory-inner-table/userstory-inner-table.component.ts b/src/app/userstory-inner-table/userstory-inner-table.component.ts deleted file mode 100644 index 3430dc0..0000000 --- a/src/app/userstory-inner-table/userstory-inner-table.component.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { - BackendService, - ScrumTask, - ScrumUserstory, - ScrumStatus, - ScrumCategory, -} from '../services/backend.service'; -import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; -import { TableComponentBase } from '../services/table-component.base'; -import { getNumberForPriority } from '../services/sorting.service'; -import { UserstoryFormComponent } from '../userstory-form/userstory-form.component'; -import { ActivatedRoute, ParamMap, Router } from '@angular/router'; - -@Component({ - selector: 'app-userstory-inner-table', - templateUrl: './userstory-inner-table.component.html', - styleUrls: ['./userstory-inner-table.component.css'] -}) -export class UserstoryInnerTableComponent extends TableComponentBase { - public tasks: ScrumTask[] = []; - public filterPriority: string | null = null; - public highlightId: number; - public status: ScrumStatus[] = []; - public categories: ScrumCategory[] = []; - - @Input() public items: ScrumUserstory[] = []; - - public get filteredItems() { - return this.items.filter( - (task) => - 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.getTasks().subscribe((response) => { - if (response.status > 399) { - alert('Fehler'); - } else { - this.tasks.push(...response.body); - } - }); - backendService.getAllStatus().subscribe((response) => { - if (response.status > 399) { - alert('Fehler'); - } else { - this.status.push(...response.body); - } - }); - backendService.getCategories().subscribe((response) => { - if (response.status > 399) { - alert('Fehler'); - } else { - this.categories.push(...response.body); - } - }); - } - - private applyFilterParameters(params: ParamMap) { - if (params.has('id')) { - this.highlightId = parseInt(params.get('id')); - } - } - - public deleteUserstory(userstory: ScrumUserstory) { - this.backendService.deleteUserstory(userstory).subscribe((response) => { - 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, - }); - if (editUserstory === null) { - modalRef.result.then((result) => { - this.items.push(result); - }); - } - modalRef.componentInstance.userstory = editUserstory; - } - - public getNumberOfTasks(userstory: ScrumUserstory) { - return this.tasks.filter((t) => t.userstoryid === userstory.id).length; - } - - public sortById() { - this.doNumericSort('id', (us) => us.id); - } - - public sortByTitle() { - this.doStringSort('title', (us) => us.title); - } - - 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) { - return 'N/A'; - } - return status.title; - } - - getCategoryTitleById(id) { - var category = this.categories.find((x) => x.id === id); - if (!category) { - return 'N/A'; - } - return category.title; - } -}