diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 5a7ff58..88d37c7 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -4,15 +4,14 @@ import { DashboardComponent } from './dashboard/dashboard.component'; import { UserstoryTableComponent } from './userstory-table/userstory-table.component'; import { TaskTableComponent } from './task-table/task-table.component'; import { SprintTableComponent } from './sprint-table/sprint-table.component'; -// import { DashboardComponent } from './dashboard/dashboard.component'; - - +import {BacklogComponent} from './backlog-table/backlog.component'; const routes: Routes = [ { path: 'tasks', component: TaskTableComponent }, { path: 'userstories', component: UserstoryTableComponent }, { path: 'dashboard', component: DashboardComponent }, { path: 'sprints', component: SprintTableComponent }, + { path: 'backlog', component: BacklogComponent }, { path: '', redirectTo: '/tasks', pathMatch: 'full' }, ]; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a107416..b7809b2 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -16,6 +16,7 @@ import { TaskTableComponent } from './task-table/task-table.component'; import { SprintTableComponent } from './sprint-table/sprint-table.component'; import { DashboardComponent } from './dashboard/dashboard.component'; import { UserstoryInnerTableComponent } from './userstory-inner-table/userstory-inner-table.component'; +import { BacklogComponent } from './backlog-table/backlog.component'; @NgModule({ declarations: [ @@ -29,6 +30,7 @@ import { UserstoryInnerTableComponent } from './userstory-inner-table/userstory- SprintTableComponent, DashboardComponent, UserstoryInnerTableComponent, + BacklogComponent ], imports: [ BrowserModule, diff --git a/src/app/backlog-table/backlog.component.css b/src/app/backlog-table/backlog.component.css new file mode 100644 index 0000000..7fd1803 --- /dev/null +++ b/src/app/backlog-table/backlog.component.css @@ -0,0 +1,3 @@ +th.sortable:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/src/app/backlog-table/backlog.component.html b/src/app/backlog-table/backlog.component.html new file mode 100644 index 0000000..4abc9d8 --- /dev/null +++ b/src/app/backlog-table/backlog.component.html @@ -0,0 +1,62 @@ +
+
+ +

Backlog

+
+
+
+
+ +
+
+
+
+

Backlog

+
+
+
+

{{story.title}}

+
Prio: {{story.priority}}
+

{{story.content}}

+
+ Category: {{story.categoryid || "N/A"}} + Status: {{story.statusid || "N/A"}} +
+
+ +
+
+
+
+
+
+ +
+ +

Sprint-Backlog - y

+
+
+
+

{{story.title}}

+
Prio: {{story.priority}}
+

{{story.content}}

+
+ Category: {{story.categoryid || "N/A"}} + Status: {{story.statusid || "N/A"}} +
+
+ +
+
+
+
+
+
+
+
diff --git a/src/app/backlog-table/backlog.component.ts b/src/app/backlog-table/backlog.component.ts new file mode 100644 index 0000000..cb7fccc --- /dev/null +++ b/src/app/backlog-table/backlog.component.ts @@ -0,0 +1,181 @@ +import { Component } from '@angular/core'; +import { + BackendService, + ScrumTask, + ScrumUserstory, + ScrumStatus, + ScrumCategory, + ScrumSprint, +} 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 } from '@angular/router'; +import { SprintFormComponent } from '../sprint-form/sprint-form.component'; + + +@Component({ + selector: 'app-backlog', + templateUrl: './backlog.component.html', + styleUrls: ['./backlog.component.css'], +}) +export class BacklogComponent extends TableComponentBase< + ScrumUserstory +> { + public tasks: ScrumTask[] = []; + public filterPriority: string | null = null; + public status: ScrumStatus[] = []; + public categories: ScrumCategory[] = []; + public currentSprint: ScrumSprint; + + public backlog: ScrumUserstory[] = []; + public choosen: ScrumUserstory[] = []; + + constructor( + private backendService: BackendService, + private modalService: NgbModal, + private route: ActivatedRoute, + ) { + super(); + + backendService.getUserstories().subscribe((response) => { + if (response.status > 399) { + alert('Fehler'); + } else { + this.items.push(...response.body); + this.backlog = this.items; + } + }); + 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); + } + }); + this.getCurrentSprint(); + } + + 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, + size: 'lg' + }); + 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; + } + + // Sprint-Backlog + + public addToSprintBacklog(userstory: ScrumUserstory) { + this.choosen.push(userstory); + const index = this.backlog.indexOf(userstory); + this.backlog.splice(index, 1); + + } + public deleteFromSprintBacklog(userstory: ScrumUserstory){ + + const index = this.choosen.indexOf(userstory); + this.choosen.splice(index, 1); + this.backlog.push(userstory); + } + + public getCurrentSprint() + { + this.backendService.getSprints().subscribe((response) => { + if (response.status > 399) { + } else { + const now = Date.now(); + this.currentSprint = response.body.find(s => Date.parse(s.startDate) < now && Date.parse(s.endDate) > now); + }}); + } + + public openSprintForm(editSprint?: ScrumSprint) { + const modalRef = this.modalService.open(SprintFormComponent, { + backdrop: 'static', + keyboard: true, + }); + if (editSprint === null) { + modalRef.result.then(result => { + this.items.push(result); + }); + } + modalRef.componentInstance.sprint = editSprint; + } +} diff --git a/src/app/dashboard/dashboard.component.css b/src/app/dashboard/dashboard.component.css index eaf95ec..e67ab28 100644 --- a/src/app/dashboard/dashboard.component.css +++ b/src/app/dashboard/dashboard.component.css @@ -5,11 +5,3 @@ .text-very-large { font-size: 2.4rem; } - -.content { - position: relative; - float: left; - margin-top: 10px; - margin-left: 20px; - width: 80%; -} diff --git a/src/app/sprint-table/sprint-table.component.css b/src/app/sprint-table/sprint-table.component.css index 7303d6b..e69de29 100644 --- a/src/app/sprint-table/sprint-table.component.css +++ b/src/app/sprint-table/sprint-table.component.css @@ -1,11 +0,0 @@ -th.sortable:hover { - text-decoration: underline; -} - -.content { - position: relative; - float: left; - margin-top: 10px; - margin-left: 20px; - width: 80%; -} diff --git a/src/app/task-form/task-form.component.html b/src/app/task-form/task-form.component.html index 2e688ac..872a86a 100644 --- a/src/app/task-form/task-form.component.html +++ b/src/app/task-form/task-form.component.html @@ -1,83 +1,118 @@ -
+
-
-
- -
-
-
-

Neuen Task anlegen

-