cleaned up some comments.

This commit is contained in:
test 2020-07-23 11:50:42 +02:00
parent 8f924ae0b7
commit 412458da99
3 changed files with 75 additions and 70 deletions

View File

@ -1,4 +1,6 @@
// Importing necessary components and interfaces. /**
* Importing necessary components and interfaces.
* */
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { BackendService, ScrumSprint } from '../../../services/backend.service'; import { BackendService, ScrumSprint } from '../../../services/backend.service';
@ -6,15 +8,18 @@ import { BackendService, ScrumSprint } from '../../../services/backend.service';
@Component({ @Component({
selector: 'app-task-form', selector: 'app-task-form',
templateUrl: './sprint-form.component.html', templateUrl: './sprint-form.component.html',
styleUrls: [ './sprint-form.component.css' ] styleUrls: ['./sprint-form.component.css']
}) })
export // Class implements the logic for a popup window form to create and modify sprints.
class SprintFormComponent implements OnInit { /**
* Class implements the logic for a popup window form to create and modify sprints.
*/
export class SprintFormComponent implements OnInit {
@Input() public sprint: ScrumSprint; @Input() public sprint: ScrumSprint;
public editing: Boolean; public editing: Boolean;
public sprintId: string; public sprintId: string;
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {} constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) { }
/** /**
* If no sprint exists a new one will be created. * If no sprint exists a new one will be created.
@ -62,4 +67,4 @@ class SprintFormComponent implements OnInit {
onClose() { onClose() {
this.activeModalService.dismiss(this.sprint); this.activeModalService.dismiss(this.sprint);
} }
} }

View File

@ -1,4 +1,6 @@
// Importing necessary components and interfaces. /**
* Importing necessary components and interfaces.
*/
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { import {
@ -17,10 +19,13 @@ import { HttpResponse } from '@angular/common/http';
@Component({ @Component({
selector: 'app-task-form', selector: 'app-task-form',
templateUrl: './task-form.component.html', templateUrl: './task-form.component.html',
styleUrls: [ './task-form.component.css' ] styleUrls: ['./task-form.component.css']
}) })
export // Class implements the logic for a popup window form to create and modify tasks.
class TaskFormComponent implements OnInit { /**
* Class implements the logic for a popup window form to create and modify tasks.
*/
export class TaskFormComponent implements OnInit {
@Input() public task: ScrumTask; @Input() public task: ScrumTask;
public editing: boolean; public editing: boolean;
public creating: boolean; public creating: boolean;
@ -150,18 +155,16 @@ class TaskFormComponent implements OnInit {
* The new user is available to all tasks. * The new user is available to all tasks.
* @param user ScrumUser to store in the database * @param user ScrumUser to store in the database
*/ */
createUser(user: ScrumUser) { createUser(user: ScrumUser) {
this.backendService.postUser(user).subscribe((response) => { this.backendService.postUser(user).subscribe((response) => {
if (response.status > 399) { if (response.status > 399) {
alert('Fehler'); alert('Fehler');
} else { } else {
this.allUser.push(response.body); this.allUser.push(response.body);
} }
}); });
} }
// A custom status can even be deleted if not used anymore.
// This will remove the status from status-array.
/** /**
* A custom status can even be deleted if not used anymore. * A custom status can even be deleted if not used anymore.
* This will remove the status from status-array * This will remove the status from status-array
@ -182,27 +185,25 @@ class TaskFormComponent implements OnInit {
}); });
} }
// A custom user can even be deleted if not used anymore.
// This will remove the user from user-array.
/** /**
* A custom user can even be deleted if not used anymore. * A custom user can even be deleted if not used anymore.
* This will remove the user from user-array * This will remove the user from user-array
* @param id the id of the chosen user * @param id the id of the chosen user
*/ */
deleteUser(id: number) { deleteUser(id: number) {
var user = this.allUser.find((x) => x.id === id); var user = this.allUser.find((x) => x.id === id);
this.backendService.deleteUser(user).subscribe((response) => { this.backendService.deleteUser(user).subscribe((response) => {
if (response.status > 399) { if (response.status > 399) {
alert('Fehler'); alert('Fehler');
} else { } else {
const index = this.allUser.indexOf(user); const index = this.allUser.indexOf(user);
if (index !== -1) { if (index !== -1) {
this.allUser.splice(index, 1); this.allUser.splice(index, 1);
}
} }
} this.task.assignedToId = null;
this.task.assignedToId = null; });
}); }
}
/** /**
* Getting the value of the priority enum to be shown in a dropdown in popup window. * Getting the value of the priority enum to be shown in a dropdown in popup window.
@ -268,4 +269,4 @@ class TaskFormComponent implements OnInit {
} }
return user.name; return user.name;
} }
} }

View File

@ -1,4 +1,6 @@
// Importing necessary components and interfaces. /**
* Importing necessary components and interfaces.
*/
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { BackendService, ScrumUserstory, Priority, ScrumStatus, ScrumCategory, ScrumUser } from '../../../services/backend.service'; import { BackendService, ScrumUserstory, Priority, ScrumStatus, ScrumCategory, ScrumUser } from '../../../services/backend.service';
@ -6,10 +8,13 @@ import { BackendService, ScrumUserstory, Priority, ScrumStatus, ScrumCategory, S
@Component({ @Component({
selector: 'app-userstory-form', selector: 'app-userstory-form',
templateUrl: './userstory-form.component.html', templateUrl: './userstory-form.component.html',
styleUrls: [ './userstory-form.component.css' ] styleUrls: ['./userstory-form.component.css']
}) })
export // Class implements the logic for a popup window form to create and modify userstories.
class UserstoryFormComponent implements OnInit { /**
* Class implements the logic for a popup window form to create and modify userstories.
*/
export class UserstoryFormComponent implements OnInit {
@Input() public userstory: ScrumUserstory; @Input() public userstory: ScrumUserstory;
public allStatus: any[] = []; public allStatus: any[] = [];
public status: ScrumStatus = { title: '', description: '' }; public status: ScrumStatus = { title: '', description: '' };
@ -182,8 +187,6 @@ class UserstoryFormComponent implements OnInit {
}); });
} }
// If desired a new arbitrary category can be created, which will be stored in an array.
// The new category is available to all userstories.
/** /**
* If desired a new arbitrary category can be created, which will be stored in an array. * If desired a new arbitrary category can be created, which will be stored in an array.
* The new category is available to all userstories. * The new category is available to all userstories.
@ -204,18 +207,16 @@ class UserstoryFormComponent implements OnInit {
* The new user is available to all userstories. * The new user is available to all userstories.
* @param user ScrumUser to store in the database * @param user ScrumUser to store in the database
*/ */
createUser(user: ScrumUser) { createUser(user: ScrumUser) {
this.backendService.postUser(user).subscribe((response) => { this.backendService.postUser(user).subscribe((response) => {
if (response.status > 399) { if (response.status > 399) {
alert('Fehler'); alert('Fehler');
} else { } else {
this.allUser.push(response.body); this.allUser.push(response.body);
} }
}); });
} }
// A custom category can even be deleted if not used anymore.
// This will remove the category from category-array.
/** /**
* A custom category can even be deleted if not used anymore. * A custom category can even be deleted if not used anymore.
* This will remove the category from category-array. * This will remove the category from category-array.
@ -236,27 +237,25 @@ class UserstoryFormComponent implements OnInit {
}); });
} }
// A custom user can even be deleted if not used anymore.
// This will remove the user from user-array.
/** /**
* A custom user can even be deleted if not used anymore. * A custom user can even be deleted if not used anymore.
* This will remove the user from user-array * This will remove the user from user-array
* @param id the id of the chosen user * @param id the id of the chosen user
*/ */
deleteUser(id: number) { deleteUser(id: number) {
var user = this.allUser.find((x) => x.id === id); var user = this.allUser.find((x) => x.id === id);
this.backendService.deleteUser(user).subscribe((response) => { this.backendService.deleteUser(user).subscribe((response) => {
if (response.status > 399) { if (response.status > 399) {
alert('Fehler'); alert('Fehler');
} else { } else {
const index = this.allUser.indexOf(user); const index = this.allUser.indexOf(user);
if (index !== -1) { if (index !== -1) {
this.allUser.splice(index, 1); this.allUser.splice(index, 1);
}
} }
} this.userstory.createdById = null;
this.userstory.createdById = null; });
}); }
}
/** /**
* Shows the before choosen category in the category-field in the popup window. * Shows the before choosen category in the category-field in the popup window.
@ -272,4 +271,4 @@ class UserstoryFormComponent implements OnInit {
} }
return category.title; return category.title;
} }
} }