Moved functions to regions
This commit is contained in:
parent
3f6682fd8a
commit
cd7221503d
@ -26,15 +26,6 @@ export class TaskTableComponent extends TableComponentBase<ScrumTask> {
|
|||||||
public users: ScrumUser[] = [];
|
public users: ScrumUser[] = [];
|
||||||
public categories: ScrumCategory[] = [];
|
public categories: ScrumCategory[] = [];
|
||||||
|
|
||||||
public get filteredItems() {
|
|
||||||
return this.items.filter(
|
|
||||||
(task) =>
|
|
||||||
(this.filterUserstoryId === null ||
|
|
||||||
task.userstoryid === this.filterUserstoryId) &&
|
|
||||||
(this.filterPriority === null || task.priority === this.filterPriority)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private backendService: BackendService,
|
private backendService: BackendService,
|
||||||
private modalService: NgbModal,
|
private modalService: NgbModal,
|
||||||
@ -76,67 +67,15 @@ export class TaskTableComponent extends TableComponentBase<ScrumTask> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private applyFilterParameters(params: ParamMap) {
|
//#region getters
|
||||||
if (params.has('userstoryId')) {
|
public get filteredItems() {
|
||||||
this.filterUserstoryId = parseInt(params.get('userstoryId'));
|
return this.items.filter(
|
||||||
} else {
|
(task) =>
|
||||||
this.filterUserstoryId = null;
|
(this.filterUserstoryId === null ||
|
||||||
}
|
task.userstoryid === this.filterUserstoryId) &&
|
||||||
if (params.has('id')) {
|
(this.filterPriority === null || task.priority === this.filterPriority)
|
||||||
this.highlightId = parseInt(params.get('id'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public deleteTask(task: ScrumTask) {
|
|
||||||
this.backendService.deleteTask(task).subscribe((response) => {
|
|
||||||
if (response.status > 399) {
|
|
||||||
alert('Fehler');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const index = this.items.indexOf(task);
|
|
||||||
if (index !== -1) {
|
|
||||||
this.items.splice(index, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public openTaskForm(editTask?: ScrumTask) {
|
|
||||||
const modalRef = this.modalService.open(TaskFormComponent, {
|
|
||||||
backdrop: 'static',
|
|
||||||
keyboard: true,
|
|
||||||
size: 'lg',
|
|
||||||
});
|
|
||||||
if (editTask === null) {
|
|
||||||
modalRef.result.then((result) => {
|
|
||||||
this.items.push(result);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
modalRef.componentInstance.task = editTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
sortByPrio() {
|
|
||||||
this.doNumericSort('priority', (task) =>
|
|
||||||
getNumberForPriority(task.priority)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sortByTasks() {
|
|
||||||
this.doNumericSort('userstory', (task) => task.userstoryid);
|
|
||||||
}
|
|
||||||
|
|
||||||
sortByStatus() {
|
|
||||||
this.doNumericSort('statusid', (task) => task.statusid);
|
|
||||||
}
|
|
||||||
sortByAssigned() {
|
|
||||||
this.doNumericSort('assignedtoid', (task) => task.assignedtoid);
|
|
||||||
}
|
|
||||||
sortByCategory() {
|
|
||||||
this.doNumericSort('categoryid', (task) => task.categoryid);
|
|
||||||
}
|
|
||||||
|
|
||||||
private findTaskById(id: number): ScrumTask {
|
|
||||||
return this.items.find((t) => t.id === id);
|
|
||||||
}
|
|
||||||
|
|
||||||
getStatusTitleById(id) {
|
getStatusTitleById(id) {
|
||||||
var status = this.status.find((x) => x.id === id);
|
var status = this.status.find((x) => x.id === id);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
@ -160,4 +99,70 @@ export class TaskTableComponent extends TableComponentBase<ScrumTask> {
|
|||||||
}
|
}
|
||||||
return category.title;
|
return category.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#endregion getters
|
||||||
|
|
||||||
|
//#region taskTableFunctions
|
||||||
|
public deleteTask(task: ScrumTask) {
|
||||||
|
this.backendService.deleteTask(task).subscribe((response) => {
|
||||||
|
if (response.status > 399) {
|
||||||
|
alert('Fehler');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const index = this.items.indexOf(task);
|
||||||
|
if (index !== -1) {
|
||||||
|
this.items.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private applyFilterParameters(params: ParamMap) {
|
||||||
|
if (params.has('userstoryId')) {
|
||||||
|
this.filterUserstoryId = parseInt(params.get('userstoryId'));
|
||||||
|
} else {
|
||||||
|
this.filterUserstoryId = null;
|
||||||
|
}
|
||||||
|
if (params.has('id')) {
|
||||||
|
this.highlightId = parseInt(params.get('id'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//#endregion taskTableFunctions
|
||||||
|
|
||||||
|
//#region sorters
|
||||||
|
sortByPrio() {
|
||||||
|
this.doNumericSort('priority', (task) =>
|
||||||
|
getNumberForPriority(task.priority)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
sortByTasks() {
|
||||||
|
this.doNumericSort('userstory', (task) => task.userstoryid);
|
||||||
|
}
|
||||||
|
|
||||||
|
sortByStatus() {
|
||||||
|
this.doNumericSort('statusid', (task) => task.statusid);
|
||||||
|
}
|
||||||
|
sortByAssigned() {
|
||||||
|
this.doNumericSort('assignedtoid', (task) => task.assignedtoid);
|
||||||
|
}
|
||||||
|
sortByCategory() {
|
||||||
|
this.doNumericSort('categoryid', (task) => task.categoryid);
|
||||||
|
}
|
||||||
|
//#endregion sorters
|
||||||
|
|
||||||
|
|
||||||
|
//#region modals
|
||||||
|
public openTaskForm(editTask?: ScrumTask) {
|
||||||
|
const modalRef = this.modalService.open(TaskFormComponent, {
|
||||||
|
backdrop: 'static',
|
||||||
|
keyboard: true,
|
||||||
|
size: 'lg',
|
||||||
|
});
|
||||||
|
if (editTask === null) {
|
||||||
|
modalRef.result.then((result) => {
|
||||||
|
this.items.push(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
modalRef.componentInstance.task = editTask;
|
||||||
|
}
|
||||||
|
//#endregion modals
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user