Merge branch 'feature/userstory-view' into 'master'
Feature/userstory view See merge request scrum-taskboard/frontend!3
This commit is contained in:
commit
ef23aa2e26
@ -1,8 +1,15 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { Routes, RouterModule } from '@angular/router';
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { TaskListComponent } from './task-list/task-list.component';
|
||||||
|
import { UserstoryListComponent } from './userstory-list/userstory-list.component';
|
||||||
|
|
||||||
const routes: Routes = [];
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{ path: 'tasks', component: TaskListComponent },
|
||||||
|
{ path: 'userstories', component: UserstoryListComponent },
|
||||||
|
{ path: '', redirectTo: '/tasks', pathMatch: 'full' },
|
||||||
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes)],
|
imports: [RouterModule.forRoot(routes)],
|
||||||
|
@ -1 +1 @@
|
|||||||
<app-task-list></app-task-list>
|
<router-outlet></router-outlet>
|
@ -6,16 +6,20 @@ import { HttpClientModule } from '@angular/common/http';
|
|||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
import { TaskListComponent } from './task-list/task-list.component';
|
|
||||||
import { BackendService } from './services/backend.service';
|
import { BackendService } from './services/backend.service';
|
||||||
|
import { TaskListComponent } from './task-list/task-list.component';
|
||||||
import { TaskFormComponent } from './task-form/task-form.component';
|
import { TaskFormComponent } from './task-form/task-form.component';
|
||||||
|
import { UserstoryListComponent } from './userstory-list/userstory-list.component';
|
||||||
|
import { UserstoryFormComponent } from './userstory-form/userstory-form.component';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
TaskListComponent,
|
TaskListComponent,
|
||||||
TaskFormComponent
|
TaskFormComponent,
|
||||||
|
UserstoryListComponent,
|
||||||
|
UserstoryFormComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -37,28 +37,28 @@ export class BackendService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public getTasks(): Observable<HttpResponse<ScrumTask[]>> {
|
public getUserstories(): Observable<HttpResponse<ScrumUserstory[]>> {
|
||||||
const url = `${environment.apiUrl}/tasks`;
|
const url = `${environment.apiUrl}/userstories`;
|
||||||
return this.httpClient.get<ScrumTask[]>(url, { observe: 'response' });
|
return this.httpClient.get<ScrumUserstory[]>(url, { observe: 'response' });
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTask(id: number): Observable<HttpResponse<ScrumTask>> {
|
public getUserstory(id: number): Observable<HttpResponse<ScrumUserstory>> {
|
||||||
const url = `${environment.apiUrl}/tasks/${id}`;
|
const url = `${environment.apiUrl}/userstories/${id}`;
|
||||||
return this.httpClient.get<ScrumTask>(url, { observe: 'response' });
|
return this.httpClient.get<ScrumUserstory>(url, { observe: 'response' });
|
||||||
}
|
}
|
||||||
|
|
||||||
public postTask(task: ScrumTask): Observable<HttpResponse<ScrumTask>> {
|
public postUserstory(userstory: ScrumUserstory): Observable<HttpResponse<ScrumUserstory>> {
|
||||||
const url = `${environment.apiUrl}/tasks`;
|
const url = `${environment.apiUrl}/userstories`;
|
||||||
return this.httpClient.post<ScrumTask>(url, task, { observe: 'response' });
|
return this.httpClient.post<ScrumUserstory>(url, userstory, { observe: 'response' });
|
||||||
}
|
}
|
||||||
|
|
||||||
public putTask(task: ScrumTask): Observable<HttpResponse<any>> {
|
public putUserstory(userstory: ScrumUserstory): Observable<HttpResponse<any>> {
|
||||||
const url = `${environment.apiUrl}/tasks/${task.id}`;
|
const url = `${environment.apiUrl}/userstories/${userstory.id}`;
|
||||||
return this.httpClient.put(url, task, { observe: 'response' });
|
return this.httpClient.put(url, userstory, { observe: 'response' });
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteTask(task: ScrumTask): Observable<HttpResponse<any>> {
|
public deleteUserstory(userstory: ScrumUserstory): Observable<HttpResponse<any>> {
|
||||||
const url = `${environment.apiUrl}/tasks/${task.id}`;
|
const url = `${environment.apiUrl}/userstories/${userstory.id}`;
|
||||||
return this.httpClient.delete(url, {observe: 'response'});
|
return this.httpClient.delete(url, {observe: 'response'});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,6 @@ export class TaskFormComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.submitted = true;
|
this.submitted = true;
|
||||||
this.activeModalService.close();
|
this.activeModalService.close(this.task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,11 @@ export class TaskListComponent implements OnInit {
|
|||||||
backdrop: 'static',
|
backdrop: 'static',
|
||||||
keyboard: true,
|
keyboard: true,
|
||||||
});
|
});
|
||||||
|
if (editTask === null) {
|
||||||
|
modalRef.result.then(result => {
|
||||||
|
this.tasks.push(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
modalRef.componentInstance.task = editTask;
|
modalRef.componentInstance.task = editTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
0
src/app/userstory-form/userstory-form.component.css
Normal file
0
src/app/userstory-form/userstory-form.component.css
Normal file
25
src/app/userstory-form/userstory-form.component.html
Normal file
25
src/app/userstory-form/userstory-form.component.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<div class="modal-content p-3">
|
||||||
|
<form (ngSubmit)="onSubmit()">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="Title">Titel</label>
|
||||||
|
<input type="text" class="form-control" id="Title" required name="title" [(ngModel)]="title">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="Inhalt">Inhalt</label>
|
||||||
|
<input type="text" class="form-control" id="Content" required name="content" [(ngModel)]="content">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="Prio">Prio</label>
|
||||||
|
<select class="form-control" id="prio" required name="prio" [(ngModel)]="prio">
|
||||||
|
<option value="low">Low</option>
|
||||||
|
<option value="medium">Medium</option>
|
||||||
|
<option value="high">High</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-success">Submit</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
52
src/app/userstory-form/userstory-form.component.ts
Normal file
52
src/app/userstory-form/userstory-form.component.ts
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { BackendService, ScrumUserstory, Priority } from '../services/backend.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-userstory-form',
|
||||||
|
templateUrl: './userstory-form.component.html',
|
||||||
|
styleUrls: ['./userstory-form.component.css']
|
||||||
|
})
|
||||||
|
export class UserstoryFormComponent implements OnInit {
|
||||||
|
|
||||||
|
public title: string;
|
||||||
|
public content: string;
|
||||||
|
public prio: Priority;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
public userstory: ScrumUserstory;
|
||||||
|
private submitted: boolean;
|
||||||
|
|
||||||
|
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
if (this.userstory !== null && this.userstory !== undefined) {
|
||||||
|
this.title = this.userstory.title;
|
||||||
|
this.content = this.userstory.content;
|
||||||
|
this.prio = this.userstory.priority;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if (this.userstory !== null && this.userstory !== undefined) {
|
||||||
|
this.userstory.title = this.title;
|
||||||
|
this.userstory.content = this.content;
|
||||||
|
this.userstory.priority = this.prio;
|
||||||
|
this.backendService.putUserstory(this.userstory).subscribe(response => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.userstory = { title: this.title, content: this.content, priority: this.prio };
|
||||||
|
this.backendService.postUserstory(this.userstory).subscribe(response => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.submitted = true;
|
||||||
|
this.activeModalService.close(this.userstory);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
<button class="btn btn-dark m-3" (click)="openUserstoryForm(null)">Neu</button>
|
||||||
|
|
||||||
|
<ul class="list-group m-3">
|
||||||
|
<li *ngFor="let userstory of userstories" class="list-group-item">
|
||||||
|
<span>Titel: {{userstory.title}}</span>
|
||||||
|
<br/>
|
||||||
|
<span>Inhalt: {{userstory.content}}</span>
|
||||||
|
<br/>
|
||||||
|
<span>Priotität: {{userstory.priority}}</span>
|
||||||
|
<br>
|
||||||
|
<button class="btn btn-secondary m-2" (click)="openUserstoryForm(userstory)">Bearbeiten</button>
|
||||||
|
<button class="btn btn-secondary m-2" (click)="deleteUserstory(userstory)">Löschen</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
@ -1,6 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { BackendService, ScrumUserstory } from '../services/backend.service';
|
import { BackendService, ScrumUserstory } from '../services/backend.service';
|
||||||
|
import { UserstoryFormComponent } from '../userstory-form/userstory-form.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-userstory-list',
|
selector: 'app-userstory-list',
|
||||||
@ -42,6 +43,11 @@ export class UserstoryListComponent implements OnInit {
|
|||||||
backdrop: 'static',
|
backdrop: 'static',
|
||||||
keyboard: true,
|
keyboard: true,
|
||||||
});
|
});
|
||||||
|
if (editUserstory === null) {
|
||||||
|
modalRef.result.then(result => {
|
||||||
|
this.userstories.push(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
modalRef.componentInstance.userstory = editUserstory;
|
modalRef.componentInstance.userstory = editUserstory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user