Renaming
This commit is contained in:
8
src/app/sprint-table/sprint-table.component.css
Normal file
8
src/app/sprint-table/sprint-table.component.css
Normal file
@@ -0,0 +1,8 @@
|
||||
table {
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
th.sortable:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
1
src/app/sprint-table/sprint-table.component.html
Normal file
1
src/app/sprint-table/sprint-table.component.html
Normal file
@@ -0,0 +1 @@
|
||||
<button class="btn btn-dark m-3" (click)="openUserstoryForm(null)">Neuer Sprint</button>
|
||||
79
src/app/sprint-table/sprint-table.component.ts
Normal file
79
src/app/sprint-table/sprint-table.component.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import {Component} from '@angular/core';
|
||||
import {BackendService, ScrumSprint} from '../services/backend.service';
|
||||
import {TableComponentBase} from '../services/table-component.base';
|
||||
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
|
||||
import {ActivatedRoute, ParamMap, Router} from '@angular/router';
|
||||
import { SprintFormComponent } from '../sprint-form/sprint-form.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sprint',
|
||||
templateUrl: './sprint-table.component.html',
|
||||
styleUrls: ['./sprint-table.component.css']
|
||||
})
|
||||
export class SprintTableComponent extends TableComponentBase<ScrumSprint> {
|
||||
public filterSprintId: number | null = null;
|
||||
public highlightId: number;
|
||||
|
||||
public get filteredItems() {
|
||||
return this.items.filter(sprint =>
|
||||
(this.filterSprintId === null || sprint.id === this.filterSprintId)
|
||||
);
|
||||
}
|
||||
|
||||
constructor(
|
||||
private backendService: BackendService, private modalService: NgbModal,
|
||||
private route: ActivatedRoute, private router: Router
|
||||
) {
|
||||
super();
|
||||
|
||||
this.applyFilterParameters(route.snapshot.paramMap);
|
||||
route.paramMap.subscribe(map => this.applyFilterParameters(map));
|
||||
|
||||
backendService.getSprints().subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
} else {
|
||||
this.items.push(...response.body);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private applyFilterParameters(params: ParamMap) {
|
||||
if (params.has('id')) {
|
||||
this.highlightId = parseInt(params.get('id'));
|
||||
}
|
||||
}
|
||||
|
||||
public deleteSprint(sprint: ScrumSprint) {
|
||||
this.backendService.deleteSprint(sprint).subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
});
|
||||
const index = this.items.indexOf(sprint);
|
||||
if (index !== -1) {
|
||||
this.items.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
sortById() {
|
||||
this.doNumericSort('id', sprint => sprint.id);
|
||||
}
|
||||
|
||||
sortByTitle() {
|
||||
this.doStringSort('title', sprint => sprint.title);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user