minor changes

This commit is contained in:
test 2020-06-30 10:12:39 +02:00
commit e9e53c3056
3 changed files with 105 additions and 95 deletions

View File

@ -1,33 +1,30 @@
import { Component, OnInit, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import {
BackendService,
ScrumTask,
Priority,
ScrumStatus,
ScrumCategory,
ScrumUser,
ScrumProject,
ScrumUserstory,
ScrumSprint
BackendService,
ScrumTask,
Priority,
ScrumStatus,
ScrumCategory,
ScrumUser,
ScrumProject,
ScrumUserstory,
ScrumSprint
} from '../services/backend.service';
import { Observable } from 'rxjs';
import { HttpResponse } from '@angular/common/http';
@Component({
selector: 'app-task-form',
templateUrl: './sprint-form.component.html',
styleUrls: ['./sprint-form.component.css'],
selector: 'app-task-form',
templateUrl: './sprint-form.component.html',
styleUrls: [ './sprint-form.component.css' ]
})
export class SprintFormComponent implements OnInit {
@Input() public sprint: ScrumSprint;
public editing: Boolean;
public sprintid: string;
@Input() public sprint: ScrumSprint;
public editing: Boolean;
public sprintid: string;
constructor(
private backendService: BackendService,
private activeModalService: NgbActiveModal
) { }
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {}
ngOnInit(): void {
if (this.sprint === null || this.sprint === undefined) {
@ -39,24 +36,25 @@ export class SprintFormComponent implements OnInit {
document.getElementById('titleField').focus();
}
onSubmit() {
if (this.editing) {
this.backendService.putSprint(this.sprint).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
}
});
} else {
this.backendService.postSprint(this.sprint).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
}
});
}
this.activeModalService.close(this.sprint);
}
onSubmit() {
if (this.editing) {
this.backendService.putSprint(this.sprint).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
}
});
} else {
this.backendService.postSprint(this.sprint).subscribe((response) => {
console.log('Sprint gespeichert!');
if (response.status > 399) {
alert('Fehler');
}
});
}
this.activeModalService.close(this.sprint);
}
onClose() {
this.activeModalService.dismiss(this.sprint);
}
onClose() {
this.activeModalService.dismiss(this.sprint);
}
}

View File

@ -7,7 +7,10 @@
<tr>
<h6 class="modal-caption text-muted"> Gehört zu Story: <a href="#" id="userstoryTitle">{{this.userstoryId}}</a></h6>
</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>
<button (click)="onClose()" type="button" class="close" aria-label="Close">
<span aria-hidden="true">&times;</span>

View File

@ -1,72 +1,81 @@
import { Component, OnInit, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import {
BackendService,
ScrumTask,
Priority,
ScrumStatus,
ScrumCategory,
ScrumUser,
ScrumProject,
ScrumUserstory,
BackendService,
ScrumTask,
Priority,
ScrumStatus,
ScrumCategory,
ScrumUser,
ScrumProject,
ScrumUserstory
} from '../services/backend.service';
import { Observable } from 'rxjs';
import { HttpResponse } from '@angular/common/http';
@Component({
selector: 'app-task-form',
templateUrl: './task-form.component.html',
styleUrls: ['./task-form.component.css'],
selector: 'app-task-form',
templateUrl: './task-form.component.html',
styleUrls: [ './task-form.component.css' ]
})
export class TaskFormComponent implements OnInit {
@Input() public task: ScrumTask;
public editing: Boolean;
public userstoryId: string;
@Input() public task: ScrumTask;
public editing: Boolean;
public userstoryId: string;
public userstories: any[];
constructor(
private backendService: BackendService,
private activeModalService: NgbActiveModal
) {}
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {}
ngOnInit(): void {
if (this.task === null || this.task === undefined) {
this.task = { title: '' };
this.editing = false;
} else {
this.editing = true;
}
document.getElementById('titleField').focus();
this.getRelatedStory();
}
ngOnInit(): void {
if (this.task === null || this.task === undefined) {
this.task = { title: '' };
this.editing = false;
} else {
this.editing = true;
}
document.getElementById('titleField').focus();
this.getRelatedStory();
this.getUserStories();
}
onSubmit() {
if (this.editing) {
this.backendService.putTask(this.task).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
}
});
} else {
this.backendService.postTask(this.task).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
}
});
}
this.activeModalService.close(this.task);
}
onSubmit() {
if (this.editing) {
this.backendService.putTask(this.task).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
}
});
} else {
this.backendService.postTask(this.task).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
}
});
}
this.activeModalService.close(this.task);
}
onClose() {
this.activeModalService.dismiss(this.task);
}
onClose() {
this.activeModalService.dismiss(this.task);
}
getRelatedStory() {
this.backendService.getUserstory(2).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
} else {
this.userstoryId = response.body.title;
}
});
}
getRelatedStory() {
this.backendService.getUserstory(2).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
} else {
this.userstoryId = response.body.title;
}
});
}
getUserStories() {
this.backendService.getUserstories().subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
} else {
this.userstories.push(...response.body);
}
});
}
}