Added comments and prettified
This commit is contained in:
parent
ce56cab766
commit
91e30ef491
@ -8,16 +8,23 @@ import { SprintFormComponent } from '../../sprint-form/sprint-form.component';
|
||||
@Component({
|
||||
selector: 'app-sprint',
|
||||
templateUrl: './sprint-table.component.html',
|
||||
styleUrls: ['./sprint-table.component.css']
|
||||
styleUrls: ['./sprint-table.component.css'],
|
||||
})
|
||||
export class SprintTableComponent extends TableComponentBase<ScrumSprint> {
|
||||
/**
|
||||
* Constructor that establishes the initial backend communication.
|
||||
* @param backendService backendService object for backend communication
|
||||
* @param modalService angular modalService to handle modals for the Form popups
|
||||
* @param route route object to extract parameters from
|
||||
*/
|
||||
constructor(
|
||||
private backendService: BackendService, private modalService: NgbModal,
|
||||
protected route: ActivatedRoute, private router: Router
|
||||
private backendService: BackendService,
|
||||
private modalService: NgbModal,
|
||||
protected route: ActivatedRoute
|
||||
) {
|
||||
super(route);
|
||||
|
||||
backendService.getSprints().subscribe(response => {
|
||||
backendService.getSprints().subscribe((response) => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
} else {
|
||||
@ -30,8 +37,12 @@ export class SprintTableComponent extends TableComponentBase<ScrumSprint> {
|
||||
//#endregion getters
|
||||
|
||||
//#region sprintTableFunctions
|
||||
/**
|
||||
* Deletes a sprint by calling the delete method via the backendService and removing it from the tabel's items array.
|
||||
* @param sprint sprint that will be deleted
|
||||
*/
|
||||
public deleteSprint(sprint: ScrumSprint) {
|
||||
this.backendService.deleteSprint(sprint).subscribe(response => {
|
||||
this.backendService.deleteSprint(sprint).subscribe((response) => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
@ -44,24 +55,34 @@ export class SprintTableComponent extends TableComponentBase<ScrumSprint> {
|
||||
//#endregion sprintTableFunctions
|
||||
|
||||
//#region sorters
|
||||
/**
|
||||
* Sorts the tabel's items by startDate
|
||||
*/
|
||||
sortByStartDate() {
|
||||
this.doStringSort('startDate', sprint => sprint.startDate);
|
||||
this.doStringSort('startDate', (sprint) => sprint.startDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the tabel's items by endDate
|
||||
*/
|
||||
sortByEndDate() {
|
||||
this.doStringSort('endDate', sprint => sprint.endDate);
|
||||
this.doStringSort('endDate', (sprint) => sprint.endDate);
|
||||
}
|
||||
//#endregion sorters
|
||||
|
||||
//#region modals
|
||||
/**
|
||||
* Opens a SprintForm popup for editing a existing sprint or creating a new one.
|
||||
* @param editSprint optional: sprint to edit (only needed if a task should be edited, not newly created)
|
||||
*/
|
||||
public openSprintForm(editSprint?: ScrumSprint) {
|
||||
const modalRef = this.modalService.open(SprintFormComponent, {
|
||||
backdrop: 'static',
|
||||
keyboard: true,
|
||||
size: "md",
|
||||
size: 'md',
|
||||
});
|
||||
if (editSprint === null) {
|
||||
modalRef.result.then(result => {
|
||||
modalRef.result.then((result) => {
|
||||
this.items.push(result);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user