Add filters by priority + highlighting
This commit is contained in:
@@ -1,33 +1,38 @@
|
||||
import {sortByNumberAscending, sortByStringAscending} from './sorting.service';
|
||||
import {Priority} from './backend.service';
|
||||
|
||||
export abstract class TableComponentBase<T> {
|
||||
public sortBy: string;
|
||||
public sortDescending = false;
|
||||
public items: T[] = [];
|
||||
public sortBy: string;
|
||||
public sortDescending = false;
|
||||
public items: T[] = [];
|
||||
|
||||
protected doNumericSort(by: string, key: (ScrumTask) => number) {
|
||||
if (this.sortBy === by) {
|
||||
this.sortDescending = !this.sortDescending;
|
||||
} else {
|
||||
this.sortBy = by;
|
||||
}
|
||||
|
||||
this.items = sortByNumberAscending(this.items, key);
|
||||
if (this.sortDescending) {
|
||||
this.items = this.items.reverse();
|
||||
}
|
||||
protected doNumericSort(by: string, key: (item: T) => number) {
|
||||
if (this.sortBy === by) {
|
||||
this.sortDescending = !this.sortDescending;
|
||||
} else {
|
||||
this.sortBy = by;
|
||||
}
|
||||
|
||||
protected doStringSort(by: string, key: (ScrumTask) => string) {
|
||||
if (this.sortBy === by) {
|
||||
this.sortDescending = !this.sortDescending;
|
||||
} else {
|
||||
this.sortBy = by;
|
||||
}
|
||||
|
||||
this.items = sortByStringAscending(this.items, key);
|
||||
if (this.sortDescending) {
|
||||
this.items = this.items.reverse();
|
||||
}
|
||||
this.items = sortByNumberAscending(this.items, key);
|
||||
if (this.sortDescending) {
|
||||
this.items = this.items.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
protected doStringSort(by: string, key: (item: T) => string) {
|
||||
if (this.sortBy === by) {
|
||||
this.sortDescending = !this.sortDescending;
|
||||
} else {
|
||||
this.sortBy = by;
|
||||
}
|
||||
|
||||
this.items = sortByStringAscending(this.items, key);
|
||||
if (this.sortDescending) {
|
||||
this.items = this.items.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
public getAllPriorities(): string[] {
|
||||
return Object.values(Priority);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user