Improved sorting #130

This commit is contained in:
2023-02-17 19:15:03 +01:00
parent fea259fa3b
commit dfe4f28e24
20 changed files with 146 additions and 48 deletions

View File

@@ -1,4 +1,9 @@
export interface Sort {
sortColumn?: string;
sortDirection?: string;
sortDirection?: SortDirection;
}
export enum SortDirection {
ASC = "ASC",
DESC = "DESC",
}

View File

@@ -12,7 +12,7 @@ import { Server } from "../../../../../models/data/server.model";
import { catchError } from "rxjs/operators";
import { Queries } from "../../../../../models/graphql/queries.model";
import { Page } from "../../../../../models/graphql/filter/page.model";
import { Sort } from "../../../../../models/graphql/filter/sort.model";
import { Sort, SortDirection } from "../../../../../models/graphql/filter/sort.model";
import { Query } from "../../../../../models/graphql/query.model";
import { SidebarService } from "../../../../../services/sidebar/sidebar.service";
@@ -106,7 +106,7 @@ export class DashboardComponent implements OnInit {
this.sort = {
sortColumn: event.sortField ?? "",
sortDirection: event.sortOrder === 1 ? "asc" : event.sortOrder === -1 ? "desc" : "asc"
sortDirection: event.sortOrder === 1 ? SortDirection.ASC : event.sortOrder === -1 ? SortDirection.DESC: SortDirection.ASC
};
if (event.filters) {

View File

@@ -26,7 +26,7 @@
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="id">
<th class="table-header-small" pSortableColumn="id">
<div class="table-header-label">
<div class="table-header-text">{{'view.server.members.headers.id' | translate}}</div>
<p-sortIcon field="id" class="table-header-icon"></p-sortIcon>
@@ -61,10 +61,10 @@
</div>
</th>
<th class="table-header-small-dropdown" pSortableColumn="level">
<th class="table-header-small-dropdown" pSortableColumn="level.name">
<div class="table-header-label">
<div class="table-header-text">{{'view.server.members.headers.level' | translate}}</div>
<p-sortIcon field="level" class="table-header-icon"></p-sortIcon>
<p-sortIcon field="level.name" class="table-header-icon"></p-sortIcon>
</div>
</th>