Status dropdown now w/ add and delete working
This commit is contained in:
@@ -25,7 +25,7 @@ export class TaskFormComponent implements OnInit {
|
||||
public userstoryId: string;
|
||||
public userstories: any[] = [];
|
||||
public allStatus: any[] = [];
|
||||
public status: ScrumStatus = { title: '', description: '' };
|
||||
public status: ScrumStatus = {title: "", description: ""};
|
||||
|
||||
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {
|
||||
this.getUserStories();
|
||||
@@ -97,19 +97,32 @@ export class TaskFormComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createTaskStatus() {
|
||||
this.backendService.postStatus(this.status).subscribe((response) => {
|
||||
createTaskStatus(status:ScrumStatus) {
|
||||
this.backendService.postStatus(status).subscribe((response) => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
else
|
||||
{
|
||||
this.allStatus.push(response.body);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deleteStatus() {
|
||||
this.backendService.deleteStatus(this.status).subscribe((response) => {
|
||||
deleteStatus(id: number) {
|
||||
var status = this.allStatus.find((x) => x.id === id);
|
||||
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.task.statusid=null;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user