Renaming
This commit is contained in:
parent
aa129218f0
commit
c7bb7c6116
@ -3,10 +3,12 @@ import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import {UserstoryTableComponent} from './userstory-table/userstory-table.component';
|
||||
import {TaskTableComponent} from './task-table/task-table.component';
|
||||
import { SprintTableComponent } from './sprint-table/sprint-table.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: 'tasks', component: TaskTableComponent },
|
||||
{ path: 'userstories', component: UserstoryTableComponent },
|
||||
{ path: 'sprints', component: SprintTableComponent },
|
||||
{ path: '', redirectTo: '/tasks', pathMatch: 'full' },
|
||||
];
|
||||
|
||||
|
@ -13,6 +13,7 @@ import { SprintFormComponent } from './sprint-form/sprint-form.component';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { UserstoryTableComponent } from './userstory-table/userstory-table.component';
|
||||
import { TaskTableComponent } from './task-table/task-table.component';
|
||||
import { SprintTableComponent } from './sprint-table/sprint-table.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -22,7 +23,8 @@ import { TaskTableComponent } from './task-table/task-table.component';
|
||||
UserstoryTableComponent,
|
||||
UserstoryFormComponent,
|
||||
UserstoryTableComponent,
|
||||
SprintFormComponent
|
||||
SprintFormComponent,
|
||||
SprintTableComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -1,54 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { BackendService, ScrumSprint } from '../services/backend.service';
|
||||
import { SprintFormComponent } from '../sprint-form/sprint-form.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sprint',
|
||||
templateUrl: './sprint-table.component.html',
|
||||
styleUrls: ['./sprint-table.component.css']
|
||||
})
|
||||
export class SprintComponent implements OnInit {
|
||||
|
||||
public sprints: ScrumSprint[] = [];
|
||||
|
||||
constructor(private backendService: BackendService, private modalService: NgbModal) {
|
||||
backendService.getSprints().subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
else {
|
||||
this.sprints.push(...response.body);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
public deleteSprint(sprint: ScrumSprint) {
|
||||
this.backendService.deleteSprint(sprint).subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
});
|
||||
const index = this.sprints.indexOf(sprint);
|
||||
if (index !== -1) {
|
||||
this.sprints.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.sprints.push(result);
|
||||
});
|
||||
}
|
||||
modalRef.componentInstance.userstory = editSprint;
|
||||
}
|
||||
|
||||
}
|
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;
|
||||
}
|
||||
|
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);
|
||||
}
|
||||
}
|
@ -5,8 +5,6 @@ import {TaskFormComponent} from '../task-form/task-form.component';
|
||||
import {TableComponentBase} from '../services/table-component.base';
|
||||
import {ActivatedRoute, ParamMap, Router} from '@angular/router';
|
||||
import {getNumberForPriority} from '../services/sorting.service';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { isNumber } from 'util';
|
||||
|
||||
@Component({
|
||||
selector: 'app-userstory-table',
|
||||
|
Loading…
x
Reference in New Issue
Block a user