Created new table for backlog.
This commit is contained in:
parent
c393afb7b8
commit
dd4112f5bc
3
src/app/backlog-table copy/backlog-table.component.css
Normal file
3
src/app/backlog-table copy/backlog-table.component.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
th.sortable:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
229
src/app/backlog-table copy/backlog-table.component.html
Normal file
229
src/app/backlog-table copy/backlog-table.component.html
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<h3>Backlog</h3>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 container-fluid">
|
||||||
|
</div>
|
||||||
|
<div align="right" class="col-lg-6 container-fluid">
|
||||||
|
<button class="btn btn-secondary" (click)="openSprintForm()">Neuer Sprint</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 container-fluid">
|
||||||
|
<h4>Verfügbare Userstories</h4>
|
||||||
|
<table class="table">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th (click)="sortById()" class="sortable">
|
||||||
|
<span>ID</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'id'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'id'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'id'"><i class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th (click)="sortByTitle()" class="sortable">
|
||||||
|
<span>Titel</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'title'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'title'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'title'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th (click)="sortByTasks()" class="sortable">
|
||||||
|
<span>Tasks</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'tasks'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'tasks'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'tasks'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th (click)="sortByStatus()" class="sortable">
|
||||||
|
<span>Status</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'statusid'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'statusid'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'statusid'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th class="sortable">
|
||||||
|
<div class="d-inline-block">
|
||||||
|
<div class="d-inline-block">
|
||||||
|
<span (click)="sortByPrio()">Priorität: </span>
|
||||||
|
<div ngbDropdown class="d-inline-block">
|
||||||
|
<span id="dropdownBasic1" ngbDropdownToggle>{{filterPriority || "All"}}</span>
|
||||||
|
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
|
||||||
|
<option ngbDropdownItem (click)="filterPriority=null">All</option>
|
||||||
|
<option ngbDropdownItem *ngFor="let p of getAllPriorities()" (click)="filterPriority=p">{{p}}
|
||||||
|
</option>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span (click)="sortByPrio()">
|
||||||
|
<span *ngIf="sortBy != 'priority'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'priority'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'priority'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
<th (click)="sortByCategory()" class="sortable">
|
||||||
|
<span>Category</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'categoryid'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'categoryid'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'categoryid'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let userstory of filteredItems" [class.table-info]="userstory.id === highlightId">
|
||||||
|
<td>{{userstory.id}}</td>
|
||||||
|
<td>{{userstory.title}}</td>
|
||||||
|
<td>
|
||||||
|
<a [routerLink]="['/tasks', {userstoryId: userstory.id}]">
|
||||||
|
{{getNumberOfTasks(userstory)}} Tasks
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a [routerLink]="['/status', {id: userstory.statusid}]">
|
||||||
|
{{getStatusTitleById(userstory.statusid)}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{{userstory.priority}}</td>
|
||||||
|
<td>
|
||||||
|
<a [routerLink]="['/categories', {id: userstory.categoryid}]">
|
||||||
|
{{getCategoryTitleById(userstory.categoryid)}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<button type="button" rel="tooltip" (click)="addToSprintBacklog(userstory)"
|
||||||
|
class="btn btn-sm btn-success btn-icon">
|
||||||
|
<i class="fas fa-plus-square"></i>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div></div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 container-fluid">
|
||||||
|
|
||||||
|
<h4>Sprint-Backlog</h4>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th (click)="sortById()" class="sortable">
|
||||||
|
<span>ID</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'id'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'id'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'id'"><i class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th (click)="sortByTitle()" class="sortable">
|
||||||
|
<span>Titel</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'title'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'title'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'title'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th (click)="sortByTasks()" class="sortable">
|
||||||
|
<span>Tasks</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'tasks'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'tasks'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'tasks'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th (click)="sortByStatus()" class="sortable">
|
||||||
|
<span>Status</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'statusid'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'statusid'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'statusid'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th class="sortable">
|
||||||
|
<div class="d-inline-block">
|
||||||
|
<div class="d-inline-block">
|
||||||
|
<span (click)="sortByPrio()">Priorität: </span>
|
||||||
|
<div ngbDropdown class="d-inline-block">
|
||||||
|
<span id="dropdownBasic1" ngbDropdownToggle>{{filterPriority || "All"}}</span>
|
||||||
|
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
|
||||||
|
<option ngbDropdownItem (click)="filterPriority=null">All</option>
|
||||||
|
<option ngbDropdownItem *ngFor="let p of getAllPriorities()" (click)="filterPriority=p">{{p}}
|
||||||
|
</option>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span (click)="sortByPrio()">
|
||||||
|
<span *ngIf="sortBy != 'priority'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'priority'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'priority'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
<th (click)="sortByCategory()" class="sortable">
|
||||||
|
<span>Category</span>
|
||||||
|
<span>
|
||||||
|
<span *ngIf="sortBy != 'categoryid'"><i class="fa fa-sort fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending && sortBy === 'categoryid'"><i class="fa fa-sort-up fa-lg"></i></span>
|
||||||
|
<span *ngIf="sortDescending === false && sortBy === 'categoryid'"><i
|
||||||
|
class="fa fa-sort-down fa-lg"></i></span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let userstory of choosen" [class.table-info]="userstory.id === highlightId">
|
||||||
|
<td>{{userstory.id}}</td>
|
||||||
|
<td>{{userstory.title}}</td>
|
||||||
|
<td>
|
||||||
|
<a [routerLink]="['/tasks', {userstoryId: userstory.id}]">
|
||||||
|
{{getNumberOfTasks(userstory)}} Tasks
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a [routerLink]="['/status', {id: userstory.statusid}]">
|
||||||
|
{{getStatusTitleById(userstory.statusid)}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{{userstory.priority}}</td>
|
||||||
|
<td>
|
||||||
|
<a [routerLink]="['/categories', {id: userstory.categoryid}]">
|
||||||
|
{{getCategoryTitleById(userstory.categoryid)}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" rel="tooltip" (click)="deleteFromSprintBacklog(userstory)"
|
||||||
|
class="btn btn-danger btn-sm btn-icon">
|
||||||
|
<i class="fa fa-trash"></i>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
185
src/app/backlog-table copy/backlog-table.component.ts
Normal file
185
src/app/backlog-table copy/backlog-table.component.ts
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {
|
||||||
|
BackendService,
|
||||||
|
ScrumTask,
|
||||||
|
ScrumUserstory,
|
||||||
|
ScrumStatus,
|
||||||
|
ScrumCategory,
|
||||||
|
ScrumSprint,
|
||||||
|
ScrumUser,
|
||||||
|
} from '../services/backend.service';
|
||||||
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { TableComponentBase } from '../services/table-component.base';
|
||||||
|
import { getNumberForPriority } from '../services/sorting.service';
|
||||||
|
import { UserstoryFormComponent } from '../userstory-form/userstory-form.component';
|
||||||
|
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
||||||
|
import { SprintFormComponent } from '../sprint-form/sprint-form.component';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-userstory-table',
|
||||||
|
templateUrl: './userstory-table.component.html',
|
||||||
|
styleUrls: ['./userstory-table.component.css'],
|
||||||
|
})
|
||||||
|
export class UserstoryTableComponent extends TableComponentBase<
|
||||||
|
ScrumUserstory
|
||||||
|
> {
|
||||||
|
public tasks: ScrumTask[] = [];
|
||||||
|
public filterPriority: string | null = null;
|
||||||
|
public highlightId: number;
|
||||||
|
public status: ScrumStatus[] = [];
|
||||||
|
public categories: ScrumCategory[] = [];
|
||||||
|
|
||||||
|
public choosen: ScrumUserstory[] = [];
|
||||||
|
|
||||||
|
public get filteredItems() {
|
||||||
|
return this.items.filter(
|
||||||
|
(task) =>
|
||||||
|
this.filterPriority === null || task.priority === this.filterPriority
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private backendService: BackendService,
|
||||||
|
private modalService: NgbModal,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.applyFilterParameters(this.route.snapshot.paramMap);
|
||||||
|
this.route.paramMap.subscribe((map) => this.applyFilterParameters(map));
|
||||||
|
|
||||||
|
backendService.getUserstories().subscribe((response) => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
} else {
|
||||||
|
this.items.push(...response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
backendService.getTasks().subscribe((response) => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
} else {
|
||||||
|
this.tasks.push(...response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
backendService.getAllStatus().subscribe((response) => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
} else {
|
||||||
|
this.status.push(...response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
backendService.getCategories().subscribe((response) => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
} else {
|
||||||
|
this.categories.push(...response.body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private applyFilterParameters(params: ParamMap) {
|
||||||
|
if (params.has('id')) {
|
||||||
|
this.highlightId = parseInt(params.get('id'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteUserstory(userstory: ScrumUserstory) {
|
||||||
|
this.backendService.deleteUserstory(userstory).subscribe((response) => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const index = this.items.indexOf(userstory);
|
||||||
|
if (index !== -1) {
|
||||||
|
this.items.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public openUserstoryForm(editUserstory?: ScrumUserstory) {
|
||||||
|
const modalRef = this.modalService.open(UserstoryFormComponent, {
|
||||||
|
backdrop: 'static',
|
||||||
|
keyboard: true,
|
||||||
|
size: 'lg'
|
||||||
|
});
|
||||||
|
if (editUserstory === null) {
|
||||||
|
modalRef.result.then((result) => {
|
||||||
|
this.items.push(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
modalRef.componentInstance.userstory = editUserstory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getNumberOfTasks(userstory: ScrumUserstory) {
|
||||||
|
return this.tasks.filter((t) => t.userstoryid === userstory.id).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public sortById() {
|
||||||
|
this.doNumericSort('id', (us) => us.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public sortByTitle() {
|
||||||
|
this.doStringSort('title', (us) => us.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
public sortByPrio() {
|
||||||
|
this.doNumericSort('priority', (us) => getNumberForPriority(us.priority));
|
||||||
|
}
|
||||||
|
|
||||||
|
public sortByTasks() {
|
||||||
|
this.doNumericSort('tasks', (us) => this.getNumberOfTasks(us));
|
||||||
|
}
|
||||||
|
|
||||||
|
sortByStatus() {
|
||||||
|
this.doNumericSort('statusid', (us) => us.statusid);
|
||||||
|
}
|
||||||
|
sortByCategory() {
|
||||||
|
this.doNumericSort('categoryid', (us) => us.categoryid);
|
||||||
|
}
|
||||||
|
|
||||||
|
getStatusTitleById(id) {
|
||||||
|
var status = this.status.find((x) => x.id === id);
|
||||||
|
if (!status) {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
return status.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCategoryTitleById(id) {
|
||||||
|
var category = this.categories.find((x) => x.id === id);
|
||||||
|
if (!category) {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
return category.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sprint-Backlog
|
||||||
|
|
||||||
|
public addToSprintBacklog(userstory: ScrumUserstory) {
|
||||||
|
this.choosen.push(userstory);
|
||||||
|
}
|
||||||
|
public deleteFromSprintBacklog(userstory: ScrumUserstory){
|
||||||
|
|
||||||
|
const index = this.choosen.indexOf(userstory);
|
||||||
|
this.choosen.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public addToSprint(choosen: ScrumUserstory[]){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public openSprintForm(editSprint?: ScrumSprint) {
|
||||||
|
const modalRef = this.modalService.open(SprintFormComponent, {
|
||||||
|
backdrop: 'static',
|
||||||
|
keyboard: true,
|
||||||
|
});
|
||||||
|
if (editSprint === null) {
|
||||||
|
modalRef.result.then(result => {
|
||||||
|
this.items.push(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
modalRef.componentInstance.sprint = editSprint;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user