modified and added comments
This commit is contained in:
parent
7d78c14033
commit
b21ba7f58c
@ -4,60 +4,62 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
|||||||
import { BackendService, ScrumSprint } from '../../services/backend.service';
|
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 {
|
||||||
|
@Input() public sprint: ScrumSprint;
|
||||||
|
public editing: Boolean;
|
||||||
|
public sprintId: string;
|
||||||
|
|
||||||
// Class implements the logic for a popup window form to create and modify sprints.
|
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {}
|
||||||
export class SprintFormComponent implements OnInit {
|
|
||||||
@Input() public sprint: ScrumSprint;
|
|
||||||
public editing: Boolean;
|
|
||||||
public sprintId: string;
|
|
||||||
|
|
||||||
constructor(
|
/**
|
||||||
private backendService: BackendService,
|
* If no sprint exists a new one will be created.
|
||||||
private activeModalService: NgbActiveModal
|
* In other cases the sprint exists and gets modifiable.
|
||||||
) {}
|
*/
|
||||||
|
ngOnInit(): void {
|
||||||
|
if (this.sprint === null || this.sprint === undefined) {
|
||||||
|
this.sprint = { title: '', startDate: '', endDate: '' };
|
||||||
|
this.editing = false;
|
||||||
|
} else {
|
||||||
|
this.editing = true;
|
||||||
|
}
|
||||||
|
document.getElementById('titleField').focus();
|
||||||
|
}
|
||||||
|
|
||||||
// If no sprint exists a new one will be created.
|
/**
|
||||||
// In other cases the sprint exists and gets modifiable.
|
* A new created sprint will be saved in the backend (POST).
|
||||||
ngOnInit(): void {
|
* If a sprint already exists, modifiying results an update (PUT) to the backend.
|
||||||
if (this.sprint === null || this.sprint === undefined) {
|
*/
|
||||||
this.sprint = { title: '', startDate: '', endDate: '' };
|
onSubmit() {
|
||||||
this.editing = false;
|
if (this.editing) {
|
||||||
} else {
|
this.backendService.putSprint(this.sprint).subscribe((response) => {
|
||||||
this.editing = true;
|
if (response.status > 399) {
|
||||||
}
|
alert('Fehler');
|
||||||
document.getElementById('titleField').focus();
|
}
|
||||||
}
|
});
|
||||||
|
} else {
|
||||||
|
this.backendService.postSprint(this.sprint).subscribe((response) => {
|
||||||
|
console.log('Sprint gespeichert!');
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
} else {
|
||||||
|
// Copy properties returned by the API
|
||||||
|
Object.assign(this.sprint, response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Closes the popup window after submitting/canceling.
|
||||||
|
this.activeModalService.close(this.sprint);
|
||||||
|
}
|
||||||
|
|
||||||
// A new created sprint will be saved in backend (POST).
|
/**
|
||||||
// If a sprint already exists, modifying results an update (PUT) to the backend.
|
* Closes the popup form window (by clicking "close button"):
|
||||||
onSubmit() {
|
*/
|
||||||
if (this.editing) {
|
onClose() {
|
||||||
this.backendService.putSprint(this.sprint).subscribe((response) => {
|
this.activeModalService.dismiss(this.sprint);
|
||||||
if (response.status > 399) {
|
}
|
||||||
alert('Fehler');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.backendService.postSprint(this.sprint).subscribe((response) => {
|
|
||||||
console.log('Sprint gespeichert!');
|
|
||||||
if (response.status > 399) {
|
|
||||||
alert('Fehler');
|
|
||||||
} else {
|
|
||||||
// Copy properties returned by the API
|
|
||||||
Object.assign(this.sprint, response.body);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Closes the popup window after submitting/canceling.
|
|
||||||
this.activeModalService.close(this.sprint);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Closes the popup form window (by clicking "close button").
|
|
||||||
onClose() {
|
|
||||||
this.activeModalService.dismiss(this.sprint);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,205 +2,234 @@
|
|||||||
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 {
|
||||||
BackendService,
|
BackendService,
|
||||||
ScrumTask,
|
ScrumTask,
|
||||||
Priority,
|
Priority,
|
||||||
ScrumStatus,
|
ScrumStatus,
|
||||||
ScrumCategory,
|
ScrumCategory,
|
||||||
ScrumUser,
|
ScrumUser,
|
||||||
ScrumProject,
|
ScrumProject,
|
||||||
ScrumUserstory,
|
ScrumUserstory
|
||||||
} from '../../services/backend.service';
|
} from '../../services/backend.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { HttpResponse } from '@angular/common/http';
|
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 {
|
||||||
|
@Input() public task: ScrumTask;
|
||||||
|
public editing: boolean;
|
||||||
|
public creating: boolean;
|
||||||
|
public userstoryId: string;
|
||||||
|
public userstories: any[] = [];
|
||||||
|
public allStatus: any[] = [];
|
||||||
|
public status: ScrumStatus = { title: '', description: '' };
|
||||||
|
public allUser: any[] = [];
|
||||||
|
public user: ScrumUser = { name: '' };
|
||||||
|
|
||||||
// Class implements the logic for a popup window form to create and modify tasks.
|
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {
|
||||||
export class TaskFormComponent implements OnInit {
|
this.getUserStories();
|
||||||
@Input() public task: ScrumTask;
|
this.getTaskStatus();
|
||||||
public editing: boolean;
|
this.getAllUsers();
|
||||||
public creating: boolean;
|
}
|
||||||
public userstoryId: string;
|
|
||||||
public userstories: any[] = [];
|
|
||||||
public allStatus: any[] = [];
|
|
||||||
public status: ScrumStatus = { title: '', description: '' };
|
|
||||||
public allUser: any[] = [];
|
|
||||||
public user: ScrumUser = { name: '' };
|
|
||||||
|
|
||||||
constructor(
|
/**
|
||||||
private backendService: BackendService,
|
* If no task exists a new on will be created.
|
||||||
private activeModalService: NgbActiveModal
|
* In other cases the task exists and gets modifiable.
|
||||||
) {
|
*/
|
||||||
this.getUserStories();
|
ngOnInit(): void {
|
||||||
this.getTaskStatus();
|
if (this.task === null || this.task === undefined) {
|
||||||
this.getAllUsers();
|
this.task = { title: '' };
|
||||||
}
|
this.editing = false;
|
||||||
|
this.creating = false;
|
||||||
|
} else if (this.task.userstoryId) {
|
||||||
|
this.editing = true;
|
||||||
|
} else {
|
||||||
|
this.creating = true;
|
||||||
|
}
|
||||||
|
document.getElementById('titleField').focus();
|
||||||
|
this.getRelatedStory();
|
||||||
|
}
|
||||||
|
|
||||||
// If no task exists a new one will be created.
|
/**
|
||||||
// In other cases the task exists and gets modifiable.
|
* A new created task will be saved in the backend (POST).
|
||||||
ngOnInit(): void {
|
* If a task already exists, modifying results an update (PUT) to the backend.
|
||||||
if (this.task === null || this.task === undefined) {
|
*/
|
||||||
this.task = { title: '' };
|
onSubmit() {
|
||||||
this.editing = false;
|
if (this.editing) {
|
||||||
this.creating = false;
|
this.backendService.putTask(this.task).subscribe((response) => {
|
||||||
} else if (this.task.userstoryId) {
|
if (response.status > 399) {
|
||||||
this.editing = true;
|
alert('Fehler');
|
||||||
} else {
|
}
|
||||||
this.creating = true;
|
});
|
||||||
}
|
} else {
|
||||||
document.getElementById('titleField').focus();
|
this.backendService.postTask(this.task).subscribe((response) => {
|
||||||
this.getRelatedStory();
|
if (response.status > 399) {
|
||||||
}
|
alert('Fehler');
|
||||||
// A new created task will be saved in backend (POST).
|
} else {
|
||||||
// If a task already exists, modifying results an update (PUT) to the backend.
|
// Copy properties returned by the API
|
||||||
onSubmit() {
|
Object.assign(this.task, response.body);
|
||||||
if (this.editing) {
|
}
|
||||||
this.backendService.putTask(this.task).subscribe((response) => {
|
});
|
||||||
if (response.status > 399) {
|
}
|
||||||
alert('Fehler');
|
// Closes the popup window after submitting/canceling.
|
||||||
}
|
this.activeModalService.close(this.task);
|
||||||
});
|
}
|
||||||
} else {
|
|
||||||
this.backendService.postTask(this.task).subscribe((response) => {
|
|
||||||
if (response.status > 399) {
|
|
||||||
alert('Fehler');
|
|
||||||
} else {
|
|
||||||
// Copy properties returned by the API
|
|
||||||
Object.assign(this.task, response.body);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Closes the popup window after submitting/canceling.
|
|
||||||
this.activeModalService.close(this.task);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Closes the popup form window (by clicking "close button").
|
/**
|
||||||
onClose() {
|
* Closes the popup form window (by clicking "close button").
|
||||||
this.activeModalService.dismiss(this.task);
|
*/
|
||||||
}
|
onClose() {
|
||||||
|
this.activeModalService.dismiss(this.task);
|
||||||
|
}
|
||||||
|
|
||||||
// Getting the userstory which is related to a task.
|
/**
|
||||||
// The related story will be shown in popup window of a task.
|
* Getting the userstory which is related to a task.
|
||||||
getRelatedStory() {
|
* The related story will be shown in popup window of a task.
|
||||||
if (!this.task.userstoryId) {
|
*/
|
||||||
return null;
|
getRelatedStory() {
|
||||||
}
|
if (!this.task.userstoryId) {
|
||||||
this.backendService
|
return null;
|
||||||
.getUserstory(this.task.userstoryId)
|
}
|
||||||
.subscribe((response) => {
|
this.backendService.getUserstory(this.task.userstoryId).subscribe((response) => {
|
||||||
if (response.status > 399) {
|
if (response.status > 399) {
|
||||||
alert('Fehler');
|
alert('Fehler');
|
||||||
} else {
|
} else {
|
||||||
this.userstoryId = response.body.title;
|
this.userstoryId = response.body.title;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting all userstories from backend to show in a dropdown in popup window.
|
/**
|
||||||
getUserStories() {
|
* Getting all userstories from backend to show in a dropdown in popup window.
|
||||||
this.backendService.getUserstories().subscribe((response) => {
|
*/
|
||||||
if (response.status > 399) {
|
getUserStories() {
|
||||||
alert('Fehler');
|
this.backendService.getUserstories().subscribe((response) => {
|
||||||
} else {
|
if (response.status > 399) {
|
||||||
this.userstories.push(...response.body);
|
alert('Fehler');
|
||||||
}
|
} else {
|
||||||
});
|
this.userstories.push(...response.body);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Getting all available status from backend to list it in status-dropdown in popup window.
|
/**
|
||||||
getTaskStatus() {
|
* Getting all available status from backend to list it in status-dropdown in popup window.
|
||||||
this.backendService.getAllStatus().subscribe((response) => {
|
*/
|
||||||
if (response.status > 399) {
|
getTaskStatus() {
|
||||||
alert('Fehler');
|
this.backendService.getAllStatus().subscribe((response) => {
|
||||||
} else {
|
if (response.status > 399) {
|
||||||
this.allStatus.push(...response.body);
|
alert('Fehler');
|
||||||
}
|
} else {
|
||||||
});
|
this.allStatus.push(...response.body);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// If desired a new arbitrary status (such as "Waiting") can be created, which will be stored in an array.
|
/**
|
||||||
// The new status is available to all tasks.
|
* If desired a new arbitrary status (such as "Waiting") can be created, which will be stored in an array.
|
||||||
createTaskStatus(status: ScrumStatus) {
|
* The new status is available to all tasks.
|
||||||
this.backendService.postStatus(status).subscribe((response) => {
|
* @param status Scrumstatus to store in the database
|
||||||
if (response.status > 399) {
|
*/
|
||||||
alert('Fehler');
|
createTaskStatus(status: ScrumStatus) {
|
||||||
} else {
|
this.backendService.postStatus(status).subscribe((response) => {
|
||||||
this.allStatus.push(response.body);
|
if (response.status > 399) {
|
||||||
}
|
alert('Fehler');
|
||||||
});
|
} else {
|
||||||
}
|
this.allStatus.push(response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
deleteStatus(id: number) {
|
/**
|
||||||
var status = this.allStatus.find((x) => x.id === id);
|
* A custom status can even be deleted if not used anymore.
|
||||||
this.backendService.deleteStatus(status).subscribe((response) => {
|
* This will remove the status from status-array
|
||||||
if (response.status > 399) {
|
* @param id the id of the chosen status
|
||||||
alert('Fehler');
|
*/
|
||||||
} else {
|
deleteStatus(id: number) {
|
||||||
const index = this.allStatus.indexOf(status);
|
var status = this.allStatus.find((x) => x.id === id);
|
||||||
if (index !== -1) {
|
this.backendService.deleteStatus(status).subscribe((response) => {
|
||||||
this.allStatus.splice(index, 1);
|
if (response.status > 399) {
|
||||||
}
|
alert('Fehler');
|
||||||
}
|
} else {
|
||||||
this.task.statusId = null;
|
const index = this.allStatus.indexOf(status);
|
||||||
});
|
if (index !== -1) {
|
||||||
}
|
this.allStatus.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.task.statusId = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Getting the values of the Priority enum to be shown in a dropdown in popup window.
|
/**
|
||||||
getAllPriorities(): Priority[] {
|
* Getting the value of the priority enum to be shown in a dropdown in popup window.
|
||||||
return Object.values(Priority);
|
*/
|
||||||
}
|
getAllPriorities(): Priority[] {
|
||||||
|
return Object.values(Priority);
|
||||||
|
}
|
||||||
|
|
||||||
// necessary?????????????????????????????????????????????????????
|
// necessary?????????????????????????????????????????????????????
|
||||||
getUserstoryTitleById(id: number): string {
|
/**
|
||||||
if (!id) {
|
* Shows the before choosen userstory in the userstory-field in the popup window
|
||||||
return null;
|
* @param id reference to the userstory object
|
||||||
}
|
*/
|
||||||
var story = this.userstories.find((x) => x.id === id);
|
getUserstoryTitleById(id: number): string {
|
||||||
if (!story) {
|
if (!id) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return story.title;
|
var story = this.userstories.find((x) => x.id === id);
|
||||||
}
|
if (!story) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return story.title;
|
||||||
|
}
|
||||||
|
|
||||||
// Shows the before choosen status in the status-field in the popup window.
|
/**
|
||||||
getStatusTitleById(id: number): string {
|
* Shows the before choosen status in the status-field in the popup window.
|
||||||
if (!id) {
|
* @param id reference to the status object
|
||||||
return null;
|
*/
|
||||||
}
|
getStatusTitleById(id: number): string {
|
||||||
var status = this.allStatus.find((x) => x.id === id);
|
if (!id) {
|
||||||
if (!status) {
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
var status = this.allStatus.find((x) => x.id === id);
|
||||||
return status.title;
|
if (!status) {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
return status.title;
|
||||||
|
}
|
||||||
|
|
||||||
// Getting all taskboard users from backend to show in a dropdown in popup window.
|
/**
|
||||||
getAllUsers() {
|
* Getting all taskboard users from the backend to show in a dropdown in popup window.
|
||||||
this.backendService.getUsers().subscribe((response) => {
|
*/
|
||||||
if (response.status > 399) {
|
getAllUsers() {
|
||||||
alert('Fehler');
|
this.backendService.getUsers().subscribe((response) => {
|
||||||
} else {
|
if (response.status > 399) {
|
||||||
this.allUser.push(...response.body);
|
alert('Fehler');
|
||||||
}
|
} else {
|
||||||
});
|
this.allUser.push(...response.body);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Shows the before assigned user in the author-field in the popup window.
|
/**
|
||||||
getAuthorById(id: number): string {
|
* Shows the before assigned user in the author-field in the popup window.
|
||||||
if (!id) {
|
* @param id reference to the author object
|
||||||
return null;
|
*/
|
||||||
}
|
getAuthorById(id: number): string {
|
||||||
var user = this.allUser.find((x) => x.id === id);
|
if (!id) {
|
||||||
if (!user) {
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
var user = this.allUser.find((x) => x.id === id);
|
||||||
return user.name;
|
if (!user) {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
return user.name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,215 +1,239 @@
|
|||||||
// 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 { BackendService, ScrumUserstory, Priority } from '../../services/backend.service';
|
||||||
BackendService,
|
import { ScrumTask, ScrumStatus, ScrumCategory, ScrumUser, ScrumProject } from '../../services/backend.service';
|
||||||
ScrumUserstory,
|
|
||||||
Priority,
|
|
||||||
} from '../../services/backend.service';
|
|
||||||
import {
|
|
||||||
ScrumTask,
|
|
||||||
ScrumStatus,
|
|
||||||
ScrumCategory,
|
|
||||||
ScrumUser,
|
|
||||||
ScrumProject,
|
|
||||||
} from '../../services/backend.service';
|
|
||||||
|
|
||||||
@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 {
|
||||||
|
@Input() public userstory: ScrumUserstory;
|
||||||
|
public allStatus: any[] = [];
|
||||||
|
public status: ScrumStatus = { title: '', description: '' };
|
||||||
|
public allUser: any[] = [];
|
||||||
|
public user: ScrumUser = { name: '' };
|
||||||
|
public allCategories: any[] = [];
|
||||||
|
public category: ScrumCategory = { title: '' };
|
||||||
|
public editing: boolean;
|
||||||
|
|
||||||
// Class implements the logic for a popup window form to create and modify userstories.
|
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {
|
||||||
export class UserstoryFormComponent implements OnInit {
|
this.getUserstoryStatus();
|
||||||
@Input() public userstory: ScrumUserstory;
|
this.getAllUsers();
|
||||||
public allStatus: any[] = [];
|
this.getUserstoryCategory();
|
||||||
public status: ScrumStatus = { title: '', description: '' };
|
}
|
||||||
public allUser: any[] = [];
|
|
||||||
public user: ScrumUser = { name: '' };
|
|
||||||
public allCategories: any[] = [];
|
|
||||||
public category: ScrumCategory = { title: '' };
|
|
||||||
public editing: boolean;
|
|
||||||
|
|
||||||
constructor(
|
/**
|
||||||
private backendService: BackendService,
|
* If no userstory exists a new one will be created.
|
||||||
private activeModalService: NgbActiveModal
|
* In other cases the userstory exists and gets modifiable.
|
||||||
) {
|
*/
|
||||||
this.getUserstoryStatus();
|
ngOnInit(): void {
|
||||||
this.getAllUsers();
|
if (this.userstory === null || this.userstory === undefined) {
|
||||||
this.getUserstoryCategory();
|
this.userstory = { title: '' };
|
||||||
}
|
this.editing = false;
|
||||||
|
} else {
|
||||||
|
this.editing = true;
|
||||||
|
}
|
||||||
|
document.getElementById('titleField').focus();
|
||||||
|
}
|
||||||
|
|
||||||
// If no userstory exists a new one will be created.
|
/**
|
||||||
// In other cases the userstory exists and gets modifiable.
|
* A new created userstory will be saved in the backend (POST).
|
||||||
ngOnInit(): void {
|
* If a userstory already exists, modifying results an update (PUT) to the backend.
|
||||||
if (this.userstory === null || this.userstory === undefined) {
|
*/
|
||||||
this.userstory = { title: '' };
|
onSubmit() {
|
||||||
this.editing = false;
|
if (this.editing) {
|
||||||
} else {
|
this.backendService.putUserstory(this.userstory).subscribe((response) => {
|
||||||
this.editing = true;
|
if (response.status > 399) {
|
||||||
}
|
alert('Fehler');
|
||||||
document.getElementById('titleField').focus();
|
}
|
||||||
}
|
});
|
||||||
|
} else {
|
||||||
|
this.backendService.postUserstory(this.userstory).subscribe((response) => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
} else {
|
||||||
|
// Copy properties returned by the API
|
||||||
|
Object.assign(this.userstory, response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Closes the popup window after submitting/canceling.
|
||||||
|
this.activeModalService.close(this.userstory);
|
||||||
|
}
|
||||||
|
|
||||||
// A new created userstory will be saved in backend (POST).
|
/**
|
||||||
// If a userstory already exists, modifying results an update (PUT) to the backend.
|
* Closes the popup form window (by clicking "close button").
|
||||||
onSubmit() {
|
*/
|
||||||
if (this.editing) {
|
onClose() {
|
||||||
this.backendService.putUserstory(this.userstory).subscribe((response) => {
|
this.activeModalService.dismiss(this.userstory);
|
||||||
if (response.status > 399) {
|
}
|
||||||
alert('Fehler');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.backendService
|
|
||||||
.postUserstory(this.userstory)
|
|
||||||
.subscribe((response) => {
|
|
||||||
if (response.status > 399) {
|
|
||||||
alert('Fehler');
|
|
||||||
} else {
|
|
||||||
// Copy properties returned by the API
|
|
||||||
Object.assign(this.userstory, response.body);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Closes the popup window after submitting/canceling.
|
|
||||||
this.activeModalService.close(this.userstory);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Closes the popup form window (by clicking "close button").
|
/**
|
||||||
onClose() {
|
* Getting all available status from backend to list it in status-dropdown in popup window.
|
||||||
this.activeModalService.dismiss(this.userstory);
|
*/
|
||||||
}
|
getUserstoryStatus() {
|
||||||
|
this.backendService.getAllStatus().subscribe((response) => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
} else {
|
||||||
|
this.allStatus.push(...response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Getting all available status from backend to list it in status-dropdown in popup window.
|
/**
|
||||||
getUserstoryStatus() {
|
* If desired a new arbitrary status (such as "Waiting") can be created, which will be stored in an array.
|
||||||
this.backendService.getAllStatus().subscribe((response) => {
|
* The new status is available to all userstories.
|
||||||
if (response.status > 399) {
|
* @param status the status object which will be created
|
||||||
alert('Fehler');
|
*/
|
||||||
} else {
|
createUserstoryStatus(status: ScrumStatus) {
|
||||||
this.allStatus.push(...response.body);
|
this.backendService.postStatus(status).subscribe((response) => {
|
||||||
}
|
if (response.status > 399) {
|
||||||
});
|
alert('Fehler');
|
||||||
}
|
} else {
|
||||||
|
this.allStatus.push(response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// If desired a new arbitrary status (such as "Waiting") can be created, which will be stored in an array.
|
/**
|
||||||
// The new status is available to all userstories.
|
* A custom status can even be deleted if not used anymore.
|
||||||
createUserstoryStatus(status: ScrumStatus) {
|
* This will remove the status from status-array
|
||||||
this.backendService.postStatus(status).subscribe((response) => {
|
* @param id reference to the deletable status object
|
||||||
if (response.status > 399) {
|
*/
|
||||||
alert('Fehler');
|
deleteStatus(id: number) {
|
||||||
} else {
|
var status = this.allStatus.find((x) => x.id === id);
|
||||||
this.allStatus.push(response.body);
|
this.backendService.deleteStatus(status).subscribe((response) => {
|
||||||
}
|
if (response.status > 399) {
|
||||||
});
|
alert('Fehler');
|
||||||
}
|
} else {
|
||||||
|
const index = this.allStatus.indexOf(status);
|
||||||
|
if (index !== -1) {
|
||||||
|
this.allStatus.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.userstory.statusId = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// A custom status can even be deleted if not used anymore.
|
/**
|
||||||
// This will remove the status from status-array.
|
* Getting the values of the Priority enum to be shown in a dropdown in popup window.
|
||||||
deleteStatus(id: number) {
|
*/
|
||||||
var status = this.allStatus.find((x) => x.id === id);
|
getAllPriorities(): Priority[] {
|
||||||
this.backendService.deleteStatus(status).subscribe((response) => {
|
return Object.values(Priority);
|
||||||
if (response.status > 399) {
|
}
|
||||||
alert('Fehler');
|
|
||||||
} else {
|
|
||||||
const index = this.allStatus.indexOf(status);
|
|
||||||
if (index !== -1) {
|
|
||||||
this.allStatus.splice(index, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.userstory.statusId = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getting the values of the Priority enum to be shown in a dropdown in popup window.
|
/**
|
||||||
getAllPriorities(): Priority[] {
|
* Shows the before choosen status in the status-field in the popup window.
|
||||||
return Object.values(Priority);
|
* @param id reference to the status object
|
||||||
}
|
*/
|
||||||
|
getStatusTitleById(id: number): string {
|
||||||
|
if (!id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var status = this.allStatus.find((x) => x.id === id);
|
||||||
|
if (!status) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return status.title;
|
||||||
|
}
|
||||||
|
|
||||||
// Shows the before choosen status in the status-field in the popup window.
|
/**
|
||||||
getStatusTitleById(id: number): string {
|
* Getting all taskboard users from backend to show in a dropdown in popup window.
|
||||||
if (!id) {
|
*/
|
||||||
return null;
|
getAllUsers() {
|
||||||
}
|
this.backendService.getUsers().subscribe((response) => {
|
||||||
var status = this.allStatus.find((x) => x.id === id);
|
if (response.status > 399) {
|
||||||
if (!status) {
|
alert('Fehler');
|
||||||
return null;
|
} else {
|
||||||
}
|
this.allUser.push(...response.body);
|
||||||
return status.title;
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Getting all taskboard users from backend to show in a dropdown in popup window.
|
/**
|
||||||
getAllUsers() {
|
* Shows the before assigned user in the author-field in the popup window.
|
||||||
this.backendService.getUsers().subscribe((response) => {
|
* @param id reference to the author object
|
||||||
if (response.status > 399) {
|
*/
|
||||||
alert('Fehler');
|
getAuthorById(id: number): string {
|
||||||
} else {
|
if (!id) {
|
||||||
this.allUser.push(...response.body);
|
return null;
|
||||||
}
|
}
|
||||||
});
|
var user = this.allUser.find((x) => x.id === id);
|
||||||
}
|
if (!user) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return user.name;
|
||||||
|
}
|
||||||
|
|
||||||
// Shows the before assigned user in the author-field in the popup window.
|
/**
|
||||||
getAuthorById(id: number): string {
|
* Getting all available categories from backend to list it in status-dropdown in popup window.
|
||||||
if (!id) {
|
*/
|
||||||
return null;
|
getUserstoryCategory() {
|
||||||
}
|
this.backendService.getCategories().subscribe((response) => {
|
||||||
var user = this.allUser.find((x) => x.id === id);
|
if (response.status > 399) {
|
||||||
if (!user) {
|
alert('Fehler');
|
||||||
return null;
|
} else {
|
||||||
}
|
this.allCategories.push(...response.body);
|
||||||
return user.name;
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Getting all available categories from backend to list it in status-dropdown in popup window.
|
// If desired a new arbitrary category can be created, which will be stored in an array.
|
||||||
getUserstoryCategory() {
|
// The new category is available to all userstories.
|
||||||
this.backendService.getCategories().subscribe((response) => {
|
/**
|
||||||
if (response.status > 399) {
|
* If desired a new arbitrary category can be created, which will be stored in an array.
|
||||||
alert('Fehler');
|
* The new category is available to all userstories.
|
||||||
} else {
|
* @param category the category object which will be created
|
||||||
this.allCategories.push(...response.body);
|
*/
|
||||||
}
|
createUserstoryCategory(category: ScrumCategory) {
|
||||||
});
|
this.backendService.postCategory(category).subscribe((response) => {
|
||||||
}
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
} else {
|
||||||
|
this.allCategories.push(response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// If desired a new arbitrary category can be created, which will be stored in an array.
|
// A custom category can even be deleted if not used anymore.
|
||||||
// The new category is available to all userstories.
|
// This will remove the category from category-array.
|
||||||
createUserstoryCategory(category: ScrumCategory) {
|
/**
|
||||||
this.backendService.postCategory(category).subscribe((response) => {
|
* A custom category can even be deleted if not used anymore.
|
||||||
if (response.status > 399) {
|
* This will remove the category from category-array.
|
||||||
alert('Fehler');
|
* @param id reference to the deletable category
|
||||||
} else {
|
*/
|
||||||
this.allCategories.push(response.body);
|
deleteCategory(id: number) {
|
||||||
}
|
var category = this.allCategories.find((x) => x.id === id);
|
||||||
});
|
this.backendService.deleteCategory(category).subscribe((response) => {
|
||||||
}
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
} else {
|
||||||
|
const index = this.allCategories.indexOf(category);
|
||||||
|
if (index !== -1) {
|
||||||
|
this.allCategories.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.userstory.categoryId = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// A custom category can even be deleted if not used anymore.
|
/**
|
||||||
// This will remove the category from category-array.
|
* Shows the before choosen category in the category-field in the popup window.
|
||||||
deleteCategory(id: number) {
|
* @param id reference to the category
|
||||||
var category = this.allCategories.find((x) => x.id === id);
|
*/
|
||||||
this.backendService.deleteCategory(category).subscribe((response) => {
|
getCategoryById(id: number): string {
|
||||||
if (response.status > 399) {
|
if (!id) {
|
||||||
alert('Fehler');
|
return null;
|
||||||
} else {
|
}
|
||||||
const index = this.allCategories.indexOf(category);
|
var category = this.allCategories.find((x) => x.id === id);
|
||||||
if (index !== -1) {
|
if (!category) {
|
||||||
this.allCategories.splice(index, 1);
|
return null;
|
||||||
}
|
}
|
||||||
}
|
return category.title;
|
||||||
this.userstory.categoryId = null;
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
// Shows the before choosen category in the category-field in the popup window.
|
|
||||||
getCategoryById(id: number): string {
|
|
||||||
if (!id) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var category = this.allCategories.find((x) => x.id === id);
|
|
||||||
if (!category) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return category.title;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user