From d11c51879eb0113f19858187d520f3009230f246 Mon Sep 17 00:00:00 2001
From: "michele.artini"
Date: Tue, 24 Jan 2023 10:38:39 +0100
Subject: [PATCH] sort
---
.../dnet-is-application/src/app/app.module.ts | 5 +++-
.../app/wf-history/wf-history.component.html | 22 +++++++++---------
.../app/wf-history/wf-history.component.ts | 23 ++++++++++++++++---
frontends/dnet-is-application/src/styles.css | 2 ++
4 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/frontends/dnet-is-application/src/app/app.module.ts b/frontends/dnet-is-application/src/app/app.module.ts
index 35ac35ef..29c4a6a1 100644
--- a/frontends/dnet-is-application/src/app/app.module.ts
+++ b/frontends/dnet-is-application/src/app/app.module.ts
@@ -25,6 +25,8 @@ import { MainMenuPanelsComponent } from './main-menu-panels/main-menu-panels.com
import { MatExpansionModule } from '@angular/material/expansion';
import { WfDialog, WfHistoryComponent } from './wf-history/wf-history.component';
import { MatDialogModule } from '@angular/material/dialog';
+import {MatSortModule} from '@angular/material/sort'
+
@NgModule({
declarations: [
@@ -55,7 +57,8 @@ import { MatDialogModule } from '@angular/material/dialog';
MatInputModule,
MatTableModule,
MatExpansionModule,
- MatDialogModule
+ MatDialogModule,
+ MatSortModule
],
providers: [],
bootstrap: [AppComponent]
diff --git a/frontends/dnet-is-application/src/app/wf-history/wf-history.component.html b/frontends/dnet-is-application/src/app/wf-history/wf-history.component.html
index 7708ed95..87576383 100644
--- a/frontends/dnet-is-application/src/app/wf-history/wf-history.component.html
+++ b/frontends/dnet-is-application/src/app/wf-history/wf-history.component.html
@@ -18,42 +18,42 @@
Count : {{historyDatasource.filteredData.length}}
-
+
- Process Id |
+ Process Id |
{{element.processId}}
|
- Workflow Name |
+ Workflow Name |
{{element.name}} |
- Workflow Family |
+ Workflow Family |
{{element.family}} |
- Datasource |
+ Datasource |
{{element.dsName}} |
-
- Status |
+
+ Status |
{{element.status}} |
-
- Start Date |
+
+ Start Date |
{{element.startDate}} |
-
- End Date |
+
+ End Date |
{{element.endDate}} |
diff --git a/frontends/dnet-is-application/src/app/wf-history/wf-history.component.ts b/frontends/dnet-is-application/src/app/wf-history/wf-history.component.ts
index 3bf70c43..081b5c4b 100644
--- a/frontends/dnet-is-application/src/app/wf-history/wf-history.component.ts
+++ b/frontends/dnet-is-application/src/app/wf-history/wf-history.component.ts
@@ -1,19 +1,21 @@
-import { Component, Inject } from '@angular/core';
+import { Component, Inject,AfterViewInit, ViewChild } from '@angular/core';
import { ISService } from '../is.service';
import { MatTableDataSource } from '@angular/material/table';
+import { MatSort, Sort } from '@angular/material/sort';
import { WfHistoryEntry } from '../model/controller.model';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { MatDialog, MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { KeyValue } from '../model/controller.model';
+import {LiveAnnouncer} from '@angular/cdk/a11y';
@Component({
selector: 'app-wf-history',
templateUrl: './wf-history.component.html',
styleUrls: ['./wf-history.component.css']
})
-export class WfHistoryComponent {
+export class WfHistoryComponent implements AfterViewInit {
historyDatasource: MatTableDataSource = new MatTableDataSource([]);
@@ -23,7 +25,7 @@ export class WfHistoryComponent {
from: 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 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) {
const filterValue = (event.target as HTMLInputElement).value.trim().toLowerCase();
this.historyDatasource.filter = filterValue;
@@ -50,6 +59,14 @@ export class WfHistoryComponent {
data: wf
});
}
+
+ updateSort(sortState: Sort) {
+ if (sortState.direction) {
+ this._liveAnnouncer.announce(`Sorted ${sortState.direction}ending`);
+ } else {
+ this._liveAnnouncer.announce('Sorting cleared');
+ }
+ }
}
@Component({
diff --git a/frontends/dnet-is-application/src/styles.css b/frontends/dnet-is-application/src/styles.css
index 642ee400..91fc6ab2 100644
--- a/frontends/dnet-is-application/src/styles.css
+++ b/frontends/dnet-is-application/src/styles.css
@@ -33,6 +33,8 @@ tr {
height: auto !important;
}
+th.mat-sort-header-sorted { color: black !important; }
+
th, td {
white-space: nowrap !important;
overflow: hidden !important;