added related user story

This commit is contained in:
Michael 2020-06-22 17:12:09 +02:00
parent 3461103930
commit 8346801074
3 changed files with 66 additions and 65 deletions

View File

@ -1,4 +1,3 @@
<!-- <div class="modal-lg"> -->
<div class="modal-content p-3"> <div class="modal-content p-3">
<div class="modal-header"> <div class="modal-header">
<table> <table>
@ -6,7 +5,7 @@
<h4 class="modal-title">Neuen Task anlegen</h4> <h4 class="modal-title">Neuen Task anlegen</h4>
</tr> </tr>
<tr> <tr>
<h6 class="modal-caption text-muted"> Gehört zu Story: <a href="#"></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--> <!--getUserstory fehlt noch-->
</table> </table>
@ -59,11 +58,11 @@
</div> </div>
</div> </div>
</div> </div>
</form>
<div class="modal-footer"> <div class="modal-footer">
<button (click)="onClose()" type="dismiss" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button> <button (click)="onClose()" type="dismiss" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
<button type="submit" class="btn btn-primary">Erstellen</button> <button type="submit" class="btn btn-primary">Erstellen</button>
</div> </div>
</form>
</div> </div>
</div> </div>
<!-- </div> -->

View File

@ -1,70 +1,72 @@
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 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;
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {} constructor(
private backendService: BackendService,
private activeModalService: NgbActiveModal
) {}
ngOnInit(): void { ngOnInit(): void {
if (this.task === null || this.task === undefined) { if (this.task === null || this.task === undefined) {
this.task = { title: '' }; this.task = { title: '' };
this.editing = false; this.editing = false;
} else { } else {
this.editing = true; this.editing = true;
} }
document.getElementById('titleField').focus(); document.getElementById('titleField').focus();
this.getRelatedStory();
}
this.getRelatedStory(); 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() { onClose() {
if (this.editing) { this.activeModalService.dismiss(this.task);
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() { getRelatedStory() {
this.activeModalService.dismiss(this.task); this.backendService.getUserstory(2).subscribe((response) => {
} if (response.status > 399) {
alert('Fehler');
getRelatedStory(): any{ } else {
this.backendService.getUserstory(1).subscribe(response => { this.userstoryId = response.body.title;
if (response.status > 399) { }
alert('Fehler'); });
} }
else {
console.log(response);
}
});
}
} }

View File

@ -1,7 +1,7 @@
(function(window) { (function(window) {
window["env"] = window["env"] || {}; window['env'] = window['env'] || {};
// Environment variables // Environment variables
window["env"]["apiUrl"] = "http://localhost:5001"; window['env']['apiUrl'] = 'http://taskboard.dev.nig.gl/api';
window["env"]["debug"] = false; window['env']['debug'] = false;
})(this); })(this);