This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-web.git


The following commit(s) were added to refs/heads/master by this push:
     new 480e604  [YUNIKORN-2214] add sorting functionality to the Allocation 
view (#155)
480e604 is described below

commit 480e60428ddb9c7962b27052c342ddd352fa2e3a
Author: vinayak hegde <[email protected]>
AuthorDate: Tue Dec 19 23:17:38 2023 +0530

    [YUNIKORN-2214] add sorting functionality to the Allocation view (#155)
    
    Reviewers: Yu-Lin Chen <[email protected]>, Chia-Ping Tsai 
<[email protected]>
---
 src/app/components/apps-view/apps-view.component.html   | 6 +++---
 src/app/components/apps-view/apps-view.component.ts     | 4 +++-
 src/app/components/nodes-view/nodes-view.component.html | 6 +++---
 src/app/components/nodes-view/nodes-view.component.ts   | 5 ++++-
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/app/components/apps-view/apps-view.component.html 
b/src/app/components/apps-view/apps-view.component.html
index 3b66dfb..78f408a 100644
--- a/src/app/components/apps-view/apps-view.component.html
+++ b/src/app/components/apps-view/apps-view.component.html
@@ -57,7 +57,7 @@
 </div>
 <div class="apps-view">
   <div class="mat-elevation-z8">
-    <mat-table [dataSource]="appDataSource" matSort>
+    <mat-table [dataSource]="appDataSource" matSort #appSort="matSort">
       <ng-container [matColumnDef]="columnDef.colId" *ngFor="let columnDef of 
appColumnDef">
         <mat-header-cell *matHeaderCellDef mat-sort-header>{{ 
columnDef.colName }}</mat-header-cell>
 
@@ -142,9 +142,9 @@
     <mat-divider></mat-divider>
 
     <div class="mat-elevation-z8">
-      <mat-table [dataSource]="allocDataSource">
+      <mat-table [dataSource]="allocDataSource" matSort #allocSort="matSort">
         <ng-container [matColumnDef]="columnDef.colId" *ngFor="let columnDef 
of allocColumnDef">
-          <mat-header-cell *matHeaderCellDef>{{ columnDef.colName 
}}</mat-header-cell>
+          <mat-header-cell *matHeaderCellDef mat-sort-header>{{ 
columnDef.colName }}</mat-header-cell>
 
           <ng-container *ngIf="columnDef.colId === 'resource'; else 
renderNext_3">
             <mat-cell *matCellDef="let element">
diff --git a/src/app/components/apps-view/apps-view.component.ts 
b/src/app/components/apps-view/apps-view.component.ts
index 78d7d14..5bbcc96 100644
--- a/src/app/components/apps-view/apps-view.component.ts
+++ b/src/app/components/apps-view/apps-view.component.ts
@@ -43,7 +43,8 @@ import { QueueInfo } from '@app/models/queue-info.model';
 export class AppsViewComponent implements OnInit {
   @ViewChild('appsViewMatPaginator', { static: true }) appPaginator!: 
MatPaginator;
   @ViewChild('allocationMatPaginator', { static: true }) allocPaginator!: 
MatPaginator;
-  @ViewChild(MatSort, { static: true }) appSort!: MatSort;
+  @ViewChild('appSort', { static: true }) appSort!: MatSort;
+  @ViewChild('allocSort', { static: true }) allocSort!: MatSort;
   @ViewChild('searchInput', { static: true }) searchInput!: ElementRef;
 
   appDataSource = new MatTableDataSource<AppInfo>([]);
@@ -75,6 +76,7 @@ export class AppsViewComponent implements OnInit {
     this.appDataSource.paginator = this.appPaginator;
     this.allocDataSource.paginator = this.allocPaginator;
     this.appDataSource.sort = this.appSort;
+    this.allocDataSource.sort = this.allocSort;
     this.appSort.sort({ id: 'submissionTime', start: 'desc', disableClear: 
false });
 
     this.appColumnDef = [
diff --git a/src/app/components/nodes-view/nodes-view.component.html 
b/src/app/components/nodes-view/nodes-view.component.html
index 076e283..c7ead42 100644
--- a/src/app/components/nodes-view/nodes-view.component.html
+++ b/src/app/components/nodes-view/nodes-view.component.html
@@ -38,7 +38,7 @@
 </div>
 <div class="nodes-view">
   <div class="mat-elevation-z8">
-    <mat-table [dataSource]="nodeDataSource" matSort>
+    <mat-table [dataSource]="nodeDataSource" matSort #nodeSort="matSort">
       <ng-container [matColumnDef]="columnDef.colId" *ngFor="let columnDef of 
nodeColumnDef">
         <mat-header-cell *matHeaderCellDef mat-sort-header>{{ 
columnDef.colName }}</mat-header-cell>
 
@@ -118,9 +118,9 @@
     <mat-divider></mat-divider>
 
     <div class="mat-elevation-z8">
-      <mat-table [dataSource]="allocDataSource">
+      <mat-table [dataSource]="allocDataSource" matSort #allocSort="matSort">
         <ng-container [matColumnDef]="columnDef.colId" *ngFor="let columnDef 
of allocColumnDef">
-          <mat-header-cell *matHeaderCellDef>{{ columnDef.colName 
}}</mat-header-cell>
+          <mat-header-cell *matHeaderCellDef mat-sort-header>{{ 
columnDef.colName }}</mat-header-cell>
 
           <ng-container *ngIf="columnDef.colId === 'resource'; else 
renderNext_2">
             <mat-cell *matCellDef="let element">
diff --git a/src/app/components/nodes-view/nodes-view.component.ts 
b/src/app/components/nodes-view/nodes-view.component.ts
index eb139d5..081dbb2 100644
--- a/src/app/components/nodes-view/nodes-view.component.ts
+++ b/src/app/components/nodes-view/nodes-view.component.ts
@@ -39,7 +39,9 @@ import { PartitionInfo } from 
'@app/models/partition-info.model';
 export class NodesViewComponent implements OnInit {
   @ViewChild('nodesViewMatPaginator', { static: true }) nodePaginator!: 
MatPaginator;
   @ViewChild('allocationMatPaginator', { static: true }) allocPaginator!: 
MatPaginator;
-  @ViewChild(MatSort, { static: true }) nodeSort!: MatSort;
+  @ViewChild('nodeSort', {static: true }) nodeSort!: MatSort;
+  @ViewChild('allocSort', {static: true }) allocSort!: MatSort;
+
 
   nodeDataSource = new MatTableDataSource<NodeInfo>([]);
   nodeColumnDef: ColumnDef[] = [];
@@ -61,6 +63,7 @@ export class NodesViewComponent implements OnInit {
     this.nodeDataSource.paginator = this.nodePaginator;
     this.allocDataSource.paginator = this.allocPaginator;
     this.nodeDataSource.sort = this.nodeSort;
+    this.allocDataSource.sort = this.allocSort;
 
     this.nodeColumnDef = [
       { colId: 'nodeId', colName: 'Node ID' },


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to