sort
This commit is contained in:
parent
4a41d8cf84
commit
d11c51879e
|
@ -25,6 +25,8 @@ import { MainMenuPanelsComponent } from './main-menu-panels/main-menu-panels.com
|
||||||
import { MatExpansionModule } from '@angular/material/expansion';
|
import { MatExpansionModule } from '@angular/material/expansion';
|
||||||
import { WfDialog, WfHistoryComponent } from './wf-history/wf-history.component';
|
import { WfDialog, WfHistoryComponent } from './wf-history/wf-history.component';
|
||||||
import { MatDialogModule } from '@angular/material/dialog';
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
|
import {MatSortModule} from '@angular/material/sort'
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -55,7 +57,8 @@ import { MatDialogModule } from '@angular/material/dialog';
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
MatTableModule,
|
MatTableModule,
|
||||||
MatExpansionModule,
|
MatExpansionModule,
|
||||||
MatDialogModule
|
MatDialogModule,
|
||||||
|
MatSortModule
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
|
|
|
@ -18,42 +18,42 @@
|
||||||
<span><b>Count :</b> {{historyDatasource.filteredData.length}}</span>
|
<span><b>Count :</b> {{historyDatasource.filteredData.length}}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table mat-table [dataSource]="historyDatasource" class="mat-elevation-z8">
|
<table mat-table [dataSource]="historyDatasource" matSort (matSortChange)="updateSort($event)" class="mat-elevation-z8">
|
||||||
|
|
||||||
<ng-container matColumnDef="processId">
|
<ng-container matColumnDef="processId">
|
||||||
<th mat-header-cell *matHeaderCellDef style="width: 15%;"> Process Id </th>
|
<th mat-header-cell *matHeaderCellDef style="width: 15%;" mat-sort-header sortActionDescription="Sort by Process ID"> Process Id </th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element">
|
||||||
<a (click)="openWfDialog(element)">{{element.processId}}</a>
|
<a (click)="openWfDialog(element)">{{element.processId}}</a>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="name">
|
<ng-container matColumnDef="name">
|
||||||
<th mat-header-cell *matHeaderCellDef style="width: 15%;"> Workflow Name </th>
|
<th mat-header-cell *matHeaderCellDef style="width: 15%;" mat-sort-header sortActionDescription="Sort by WF Name"> Workflow Name </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.name}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.name}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="family">
|
<ng-container matColumnDef="family">
|
||||||
<th mat-header-cell *matHeaderCellDef style="width: 10%;"> Workflow Family </th>
|
<th mat-header-cell *matHeaderCellDef style="width: 10%;" mat-sort-header sortActionDescription="Sort by WF Family"> Workflow Family </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.family}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.family}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="dsName">
|
<ng-container matColumnDef="dsName">
|
||||||
<th mat-header-cell *matHeaderCellDef style="width: 20%;"> Datasource </th>
|
<th mat-header-cell *matHeaderCellDef style="width: 20%;" mat-sort-header sortActionDescription="Sort by Datasource"> Datasource </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.dsName}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.dsName}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="status" style="width: 10%;">
|
<ng-container matColumnDef="status">
|
||||||
<th mat-header-cell *matHeaderCellDef> Status </th>
|
<th mat-header-cell *matHeaderCellDef style="width: 10%;" mat-sort-header sortActionDescription="Sort by Status"> Status </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.status}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.status}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="startDate" style="width: 15%;">
|
<ng-container matColumnDef="startDate">
|
||||||
<th mat-header-cell *matHeaderCellDef> Start Date </th>
|
<th mat-header-cell *matHeaderCellDef style="width: 15%;" mat-sort-header sortActionDescription="Sort by Start Date"> Start Date </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.startDate}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.startDate}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="endDate" style="width: 15%;">
|
<ng-container matColumnDef="endDate">
|
||||||
<th mat-header-cell *matHeaderCellDef> End Date </th>
|
<th mat-header-cell *matHeaderCellDef style="width: 15%;" mat-sort-header sortActionDescription="Sort by End Date"> End Date </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.endDate}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.endDate}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject,AfterViewInit, ViewChild } from '@angular/core';
|
||||||
import { ISService } from '../is.service';
|
import { ISService } from '../is.service';
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
|
import { MatSort, Sort } from '@angular/material/sort';
|
||||||
import { WfHistoryEntry } from '../model/controller.model';
|
import { WfHistoryEntry } from '../model/controller.model';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { MatDialog, MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MatDialog, MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { KeyValue } from '../model/controller.model';
|
import { KeyValue } from '../model/controller.model';
|
||||||
|
import {LiveAnnouncer} from '@angular/cdk/a11y';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-wf-history',
|
selector: 'app-wf-history',
|
||||||
templateUrl: './wf-history.component.html',
|
templateUrl: './wf-history.component.html',
|
||||||
styleUrls: ['./wf-history.component.css']
|
styleUrls: ['./wf-history.component.css']
|
||||||
})
|
})
|
||||||
export class WfHistoryComponent {
|
export class WfHistoryComponent implements AfterViewInit {
|
||||||
|
|
||||||
historyDatasource: MatTableDataSource<WfHistoryEntry> = new MatTableDataSource<WfHistoryEntry>([]);
|
historyDatasource: MatTableDataSource<WfHistoryEntry> = new MatTableDataSource<WfHistoryEntry>([]);
|
||||||
|
|
||||||
|
@ -23,7 +25,7 @@ export class WfHistoryComponent {
|
||||||
from: number = -1
|
from: number = -1
|
||||||
to: number = -1
|
to: number = -1
|
||||||
|
|
||||||
constructor(public service: ISService, public route: ActivatedRoute, public dialog: MatDialog) {
|
constructor(public service: ISService, public route: ActivatedRoute, public dialog: MatDialog, private _liveAnnouncer: LiveAnnouncer) {
|
||||||
|
|
||||||
let totalP = route.snapshot.paramMap.get('total');
|
let totalP = route.snapshot.paramMap.get('total');
|
||||||
let fromP = route.snapshot.queryParamMap.get('from');
|
let fromP = route.snapshot.queryParamMap.get('from');
|
||||||
|
@ -40,6 +42,13 @@ export class WfHistoryComponent {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewChild(MatSort) sort: MatSort | undefined
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
if(this.sort) this.historyDatasource.sort = this.sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
applyFilter(event: Event) {
|
applyFilter(event: Event) {
|
||||||
const filterValue = (event.target as HTMLInputElement).value.trim().toLowerCase();
|
const filterValue = (event.target as HTMLInputElement).value.trim().toLowerCase();
|
||||||
this.historyDatasource.filter = filterValue;
|
this.historyDatasource.filter = filterValue;
|
||||||
|
@ -50,6 +59,14 @@ export class WfHistoryComponent {
|
||||||
data: wf
|
data: wf
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSort(sortState: Sort) {
|
||||||
|
if (sortState.direction) {
|
||||||
|
this._liveAnnouncer.announce(`Sorted ${sortState.direction}ending`);
|
||||||
|
} else {
|
||||||
|
this._liveAnnouncer.announce('Sorting cleared');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -33,6 +33,8 @@ tr {
|
||||||
height: auto !important;
|
height: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
th.mat-sort-header-sorted { color: black !important; }
|
||||||
|
|
||||||
th, td {
|
th, td {
|
||||||
white-space: nowrap !important;
|
white-space: nowrap !important;
|
||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
|
|
Loading…
Reference in New Issue