From bb9d8242c4d37831ae9a1411fcd25050db6d78bf Mon Sep 17 00:00:00 2001 From: Niggl Date: Fri, 10 Jul 2020 16:08:09 +0200 Subject: [PATCH 1/7] Removed the "table" part from "backlog-table" --- src/app/app-routing.module.ts | 2 +- src/app/app.module.ts | 2 +- .../components/{backlog-table => backlog}/backlog.component.css | 0 .../{backlog-table => backlog}/backlog.component.html | 0 .../components/{backlog-table => backlog}/backlog.component.ts | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename src/app/components/{backlog-table => backlog}/backlog.component.css (100%) rename src/app/components/{backlog-table => backlog}/backlog.component.html (100%) rename src/app/components/{backlog-table => backlog}/backlog.component.ts (100%) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4acfc7b..98e1f7b 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -4,7 +4,7 @@ import { DashboardComponent } from './components/dashboard/dashboard.component'; import { UserstoryTableComponent } from './components/userstory-table/userstory-table.component'; import { TaskTableComponent } from './components/task-table/task-table.component'; import { SprintTableComponent } from './components/sprint-table/sprint-table.component'; -import {BacklogComponent} from './components/backlog-table/backlog.component'; +import {BacklogComponent} from './components/backlog/backlog.component'; const routes: Routes = [ { path: 'tasks', component: TaskTableComponent }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e11e331..444cbfc 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -16,7 +16,7 @@ import { TaskTableComponent } from './components/task-table/task-table.component import { SprintTableComponent } from './components/sprint-table/sprint-table.component'; import { DashboardComponent } from './components/dashboard/dashboard.component'; import { UserstoryInnerTableComponent } from './components/userstory-inner-table/userstory-inner-table.component'; -import { BacklogComponent } from './components/backlog-table/backlog.component'; +import { BacklogComponent } from './components/backlog/backlog.component'; @NgModule({ declarations: [ diff --git a/src/app/components/backlog-table/backlog.component.css b/src/app/components/backlog/backlog.component.css similarity index 100% rename from src/app/components/backlog-table/backlog.component.css rename to src/app/components/backlog/backlog.component.css diff --git a/src/app/components/backlog-table/backlog.component.html b/src/app/components/backlog/backlog.component.html similarity index 100% rename from src/app/components/backlog-table/backlog.component.html rename to src/app/components/backlog/backlog.component.html diff --git a/src/app/components/backlog-table/backlog.component.ts b/src/app/components/backlog/backlog.component.ts similarity index 100% rename from src/app/components/backlog-table/backlog.component.ts rename to src/app/components/backlog/backlog.component.ts From f78180bac9217787ca2dd6a479d47d35a520a45b Mon Sep 17 00:00:00 2001 From: Niggl Date: Fri, 10 Jul 2020 16:10:47 +0200 Subject: [PATCH 2/7] Fixed the userstory prio selector that seems to have been ignored in a merge --- .../userstory-inner-table.component.html | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/app/components/userstory-inner-table/userstory-inner-table.component.html b/src/app/components/userstory-inner-table/userstory-inner-table.component.html index 2706790..9b4d907 100644 --- a/src/app/components/userstory-inner-table/userstory-inner-table.component.html +++ b/src/app/components/userstory-inner-table/userstory-inner-table.component.html @@ -32,18 +32,22 @@ - - Priorität - - - - - + +
+ Priorität: +
+ {{filterPriority || "All"}} +
+ + +
+
+ + + + + +
Category From ed1d31bdafc0a3a8a137989fc96ff98324820ff3 Mon Sep 17 00:00:00 2001 From: Niggl Date: Fri, 10 Jul 2020 16:56:32 +0200 Subject: [PATCH 3/7] Added sprint selection to backlog --- .../components/backlog/backlog.component.html | 33 +++++++++++++++---- .../components/backlog/backlog.component.ts | 32 +++++++++++------- 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/app/components/backlog/backlog.component.html b/src/app/components/backlog/backlog.component.html index b0295e3..a61ca33 100644 --- a/src/app/components/backlog/backlog.component.html +++ b/src/app/components/backlog/backlog.component.html @@ -8,10 +8,34 @@
+ +
+

Backlog

+
+
+ +

Aktuell läuft kein Sprint. Zur Sprint Übersicht

+
+ +

Aktueller Sprint:

+

Sprint:

+ +
+
+
-

Backlog

@@ -32,12 +56,9 @@
-
-
- -

Sprint-Backlog - Aktueller Sprint: {{this.currentSprint.title}}

-
+
+

{{story.title}}

diff --git a/src/app/components/backlog/backlog.component.ts b/src/app/components/backlog/backlog.component.ts index f67c1fb..2c251f9 100644 --- a/src/app/components/backlog/backlog.component.ts +++ b/src/app/components/backlog/backlog.component.ts @@ -28,9 +28,9 @@ export class BacklogComponent extends TableComponentBase< public status: ScrumStatus[] = []; public categories: ScrumCategory[] = []; public sprints: ScrumSprint[] = []; + public storys: ScrumUserstory[] = []; - public backlog: ScrumUserstory[] = []; - public choosen: ScrumUserstory[] = []; + public selectedSprint: ScrumSprint; constructor( private backendService: BackendService, @@ -43,14 +43,14 @@ export class BacklogComponent extends TableComponentBase< alert('Fehler'); } else { this.sprints.push(...response.body); + this.selectedSprint = this.currentSprint; } }); backendService.getUserstories().subscribe((response) => { if (response.status > 399) { alert('Fehler'); } else { - this.backlog = response.body.filter(u => u.sprintid == null); - this.choosen = response.body.filter(u => u.sprintid == this.currentSprint.id); + this.storys.push(...response.body); } }); backendService.getTasks().subscribe((response) => { @@ -117,10 +117,7 @@ export class BacklogComponent extends TableComponentBase< // Sprint-Backlog public addToSprintBacklog(userstory: ScrumUserstory) { - this.choosen.push(userstory); - const index = this.backlog.indexOf(userstory); - this.backlog.splice(index, 1); - userstory.sprintid = this.currentSprint.id; + userstory.sprintid = this.selectedSprint.id; this.backendService.putUserstory(userstory).subscribe((response) => { if (response.status > 399) { alert('Fehler'); @@ -129,9 +126,6 @@ export class BacklogComponent extends TableComponentBase< } public deleteFromSprintBacklog(userstory: ScrumUserstory){ - const index = this.choosen.indexOf(userstory); - this.choosen.splice(index, 1); - this.backlog.push(userstory) userstory.sprintid = null; this.backendService.putUserstory(userstory).subscribe((response) => { if (response.status > 399) { @@ -140,11 +134,27 @@ export class BacklogComponent extends TableComponentBase< }); } + public get choosen(): ScrumUserstory[] + { + if(this.selectedSprint === undefined){return null;} + return this.storys.filter(u => u.sprintid == this.selectedSprint.id); + } + + public get backlog(): ScrumUserstory[] + { + return this.storys.filter(u => u.sprintid === undefined); + } + public get currentSprint(): ScrumSprint { const now = Date.now(); return this.sprints.find(s => Date.parse(s.startDate) < now && Date.parse(s.endDate) > now); } + public toDateString(isoFormatString) { + const date = new Date(isoFormatString); + return `${date.getDate()}.${date.getMonth() + 1}.${date.getFullYear()}`; + } + public openSprintForm(editSprint?: ScrumSprint) { const modalRef = this.modalService.open(SprintFormComponent, { backdrop: 'static', From 33b24cd746b64935a78d77ed4b47d58ef197162e Mon Sep 17 00:00:00 2001 From: Niggl Date: Fri, 10 Jul 2020 17:00:27 +0200 Subject: [PATCH 4/7] Add buttons now are only visible, wehen a sprint is selected --- src/app/components/backlog/backlog.component.html | 14 +++++++------- src/app/components/backlog/backlog.component.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/components/backlog/backlog.component.html b/src/app/components/backlog/backlog.component.html index a61ca33..de13738 100644 --- a/src/app/components/backlog/backlog.component.html +++ b/src/app/components/backlog/backlog.component.html @@ -46,7 +46,7 @@ Category: {{story.categoryid || "N/A"}} Status: {{story.statusid || "N/A"}}
-
+
-
- -
+
+ +
diff --git a/src/app/components/backlog/backlog.component.ts b/src/app/components/backlog/backlog.component.ts index 2c251f9..c6b8630 100644 --- a/src/app/components/backlog/backlog.component.ts +++ b/src/app/components/backlog/backlog.component.ts @@ -126,7 +126,7 @@ export class BacklogComponent extends TableComponentBase< } public deleteFromSprintBacklog(userstory: ScrumUserstory){ - userstory.sprintid = null; + userstory.sprintid = undefined; this.backendService.putUserstory(userstory).subscribe((response) => { if (response.status > 399) { alert('Fehler'); From 13fda66525c2c9c47eaea667b1f728740162b789 Mon Sep 17 00:00:00 2001 From: Niggl Date: Fri, 10 Jul 2020 17:25:38 +0200 Subject: [PATCH 5/7] Added comments and cleaned stuff up --- .../components/backlog/backlog.component.ts | 142 ++++++++---------- 1 file changed, 64 insertions(+), 78 deletions(-) diff --git a/src/app/components/backlog/backlog.component.ts b/src/app/components/backlog/backlog.component.ts index c6b8630..07cf2ce 100644 --- a/src/app/components/backlog/backlog.component.ts +++ b/src/app/components/backlog/backlog.component.ts @@ -1,17 +1,12 @@ 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'; @@ -20,24 +15,24 @@ import { SprintFormComponent } from '../sprint-form/sprint-form.component'; templateUrl: './backlog.component.html', styleUrls: ['./backlog.component.css'], }) -export class BacklogComponent extends TableComponentBase< - ScrumUserstory -> { - public tasks: ScrumTask[] = []; - public filterPriority: string | null = null; + + +export class BacklogComponent{ public status: ScrumStatus[] = []; public categories: ScrumCategory[] = []; public sprints: ScrumSprint[] = []; public storys: ScrumUserstory[] = []; - public selectedSprint: ScrumSprint; + /** + * Constructor of the class that initialized the communication with the backend + * @param backendService + * @param modalService + */ constructor( private backendService: BackendService, private modalService: NgbModal, - private route: ActivatedRoute, ) { - super(); backendService.getSprints().subscribe((response) => { if (response.status > 399) { alert('Fehler'); @@ -53,13 +48,6 @@ export class BacklogComponent extends TableComponentBase< this.storys.push(...response.body); } }); - 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'); @@ -76,46 +64,54 @@ export class BacklogComponent extends TableComponentBase< }); } - 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); - } + /** + * Formats an ISO DateString to a simple date string in the format "DD.MM.YYYY" + * @param isoFormatString date formatted as an ISO DateString (Date objects get converted implicitly) + */ + public toDateString(isoFormatString) { + const date = new Date(isoFormatString); + return `${date.getDate()}.${date.getMonth() + 1}.${date.getFullYear()}`; } - 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 + + /** + * Getter that returns an array with all userstories that are in the currently selected sprint. + * The relation to the sprint is determined by the userstory's sprintid. + * If no sprint is selected it just returns an empty array. + */ + public get choosen(): ScrumUserstory[] + { + if(this.selectedSprint === undefined){return null;} + return this.storys.filter(u => u.sprintid == this.selectedSprint.id); } - public getNumberOfTasks(userstory: ScrumUserstory) { - return this.tasks.filter((t) => t.userstoryid === userstory.id).length; + /** + * Getter that returns an array with all userstories that aren't in any sprint. + * The relation to no sprint is determined by the userstory's sprintid being undefined. + */ + public get backlog(): ScrumUserstory[] + { + return this.storys.filter(u => u.sprintid === undefined); } - getCategoryTitleById(id) { - var category = this.categories.find((x) => x.id === id); - if (!category) { - return 'N/A'; - } - return category.title; + /** + * Getter that returns the current sprint. + * The current sprint is selected by determining if todays date is between the startDate and the endDate of the sprint. + */ + public get currentSprint(): ScrumSprint { + const now = Date.now(); + return this.sprints.find(s => Date.parse(s.startDate) < now && Date.parse(s.endDate) > now); } - // Sprint-Backlog + //#endregion getters + //#region backlogFunctions + + /** + * Adds a userstory to the currently selected sprint by changing it's sprintid to the current sprint's id + * @param userstory userstory object that shall be added to the selected sprint's backlog + */ public addToSprintBacklog(userstory: ScrumUserstory) { userstory.sprintid = this.selectedSprint.id; this.backendService.putUserstory(userstory).subscribe((response) => { @@ -125,6 +121,10 @@ export class BacklogComponent extends TableComponentBase< }); } + /** + * Deletes a userstory from the currently selected sprint by changing it's sprintid to undefined + * @param userstory userstory object that shall be removed from the selected sprint's backlog + */ public deleteFromSprintBacklog(userstory: ScrumUserstory){ userstory.sprintid = undefined; this.backendService.putUserstory(userstory).subscribe((response) => { @@ -134,37 +134,23 @@ export class BacklogComponent extends TableComponentBase< }); } - public get choosen(): ScrumUserstory[] - { - if(this.selectedSprint === undefined){return null;} - return this.storys.filter(u => u.sprintid == this.selectedSprint.id); - } + //#endregion backlogFunctions - public get backlog(): ScrumUserstory[] - { - return this.storys.filter(u => u.sprintid === undefined); - } - - public get currentSprint(): ScrumSprint { - const now = Date.now(); - return this.sprints.find(s => Date.parse(s.startDate) < now && Date.parse(s.endDate) > now); - } - - public toDateString(isoFormatString) { - const date = new Date(isoFormatString); - return `${date.getDate()}.${date.getMonth() + 1}.${date.getFullYear()}`; - } - - public openSprintForm(editSprint?: ScrumSprint) { + //#region modals + /** + * Opens the SprintForm Modal to let the user create a new sprint. + * The created sprint get pushed to the database and the local sprints array. + */ + public openSprintForm() { const modalRef = this.modalService.open(SprintFormComponent, { backdrop: 'static', keyboard: true, + size: "lg", + }); + + modalRef.result.then(result => { + this.sprints.push(result); }); - if (editSprint === null) { - modalRef.result.then(result => { - this.items.push(result); - }); } - modalRef.componentInstance.sprint = editSprint; - } + //#endregion modals } From 765419430911f73ae823ca52f7351f3a06db0d05 Mon Sep 17 00:00:00 2001 From: Niggl Date: Fri, 10 Jul 2020 18:25:09 +0200 Subject: [PATCH 6/7] Changed modal size --- src/app/components/backlog/backlog.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/backlog/backlog.component.ts b/src/app/components/backlog/backlog.component.ts index 07cf2ce..6581fae 100644 --- a/src/app/components/backlog/backlog.component.ts +++ b/src/app/components/backlog/backlog.component.ts @@ -145,7 +145,7 @@ export class BacklogComponent{ const modalRef = this.modalService.open(SprintFormComponent, { backdrop: 'static', keyboard: true, - size: "lg", + size: "md", }); modalRef.result.then(result => { From 8dcc3a1f45b4ae497926fb4c5424d752cb7e3a33 Mon Sep 17 00:00:00 2001 From: Niggl Date: Fri, 10 Jul 2020 18:44:20 +0200 Subject: [PATCH 7/7] Prettified --- .../components/backlog/backlog.component.html | 172 ++++++++++-------- 1 file changed, 93 insertions(+), 79 deletions(-) diff --git a/src/app/components/backlog/backlog.component.html b/src/app/components/backlog/backlog.component.html index de13738..d1d1592 100644 --- a/src/app/components/backlog/backlog.component.html +++ b/src/app/components/backlog/backlog.component.html @@ -1,83 +1,97 @@
-
- -

Backlog

-
-
-
-
- -
-
-
-

Backlog

-
-
- -

Aktuell läuft kein Sprint. Zur Sprint Übersicht

-
- -

Aktueller Sprint:

-

Sprint:

- -
-
-
-
-
-
-
-
-
-

{{story.title}}

-
Prio: {{story.priority}}
-

{{story.content}}

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

{{story.title}}

-
Prio: {{story.priority}}
-

{{story.content}}

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

Backlog

+
+
+
+ +
+
+ +
+
+

Backlog

+
+
+
+ +

+ Aktuell läuft kein Sprint. + Zur Sprint Übersicht +

+
+ +

Aktueller Sprint:

+

Sprint:

+ +
+
+
+
+ +
+
+
+
+
+

{{story.title}}

+
Prio: + {{story.priority}}
+

{{story.content}}

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

{{story.title}}

+
Prio: + {{story.priority}}
+

{{story.content}}

+
+ Category: + {{story.categoryid || "N/A"}} + Status: + {{story.statusid || "N/A"}} +
+
+ +
+
+
+
-
- -
-
-
-
-
-
+
\ No newline at end of file