added userstory select for tasks

This commit is contained in:
Michael 2020-06-29 22:47:52 +02:00
parent 75b964402a
commit 74418ff0dd
3 changed files with 114 additions and 104 deletions

View File

@ -17,17 +17,14 @@ import { HttpResponse } from '@angular/common/http';
@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 SprintFormComponent implements OnInit { 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( constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {}
private backendService: BackendService,
private activeModalService: NgbActiveModal
) { }
ngOnInit(): void { ngOnInit(): void {
if (this.sprint === null || this.sprint === undefined) { if (this.sprint === null || this.sprint === undefined) {
@ -48,6 +45,7 @@ export class SprintFormComponent implements OnInit {
}); });
} else { } else {
this.backendService.postSprint(this.sprint).subscribe((response) => { this.backendService.postSprint(this.sprint).subscribe((response) => {
console.log('Sprint gespeichert!');
if (response.status > 399) { if (response.status > 399) {
alert('Fehler'); alert('Fehler');
} }

View File

@ -7,7 +7,10 @@
<tr> <tr>
<h6 class="modal-caption text-muted"> Gehört zu Story: <a href="#" id="userstoryTitle">{{this.userstoryId}}</a></h6> <h6 class="modal-caption text-muted"> Gehört zu Story: <a href="#" id="userstoryTitle">{{this.userstoryId}}</a></h6>
</tr> </tr>
<!--getUserstory fehlt noch--> <select class="form-control custom-select mr-sm-2" id="prio" required name="prio"
[(ngModel)]="task.priority" *ngFor="let userstory of userstories">
<option value="low">{{userstory}}</option>
</select>
</table> </table>
<button (click)="onClose()" type="button" class="close" aria-label="Close"> <button (click)="onClose()" type="button" class="close" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>

View File

@ -8,7 +8,7 @@ import {
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';
@ -16,17 +16,15 @@ 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 TaskFormComponent implements OnInit { export class TaskFormComponent implements OnInit {
@Input() public task: ScrumTask; @Input() public task: ScrumTask;
public editing: Boolean; public editing: Boolean;
public userstoryId: string; public userstoryId: string;
public userstories: any[];
constructor( constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {}
private backendService: BackendService,
private activeModalService: NgbActiveModal
) {}
ngOnInit(): void { ngOnInit(): void {
if (this.task === null || this.task === undefined) { if (this.task === null || this.task === undefined) {
@ -37,6 +35,7 @@ export class TaskFormComponent implements OnInit {
} }
document.getElementById('titleField').focus(); document.getElementById('titleField').focus();
this.getRelatedStory(); this.getRelatedStory();
this.getUserStories();
} }
onSubmit() { onSubmit() {
@ -69,4 +68,14 @@ export class TaskFormComponent implements OnInit {
} }
}); });
} }
getUserStories() {
this.backendService.getUserstories().subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
} else {
this.userstories.push(...response.body);
}
});
}
} }