add column sorting
[portal/ric-dashboard.git] / webapp-frontend / src / app / control / control.component.html
index d29191c..5ae35aa 100644 (file)
   <div class="spinner-container" *ngIf="dataSource.loading$ | async">
     <mat-spinner></mat-spinner>
   </div>
-  <table mat-table [dataSource]="dataSource" multiTemplateDataRows class="control-table mat-elevation-z8">
+  <table mat-table [dataSource]="dataSource" matSort multiTemplateDataRows class="control-table mat-elevation-z8">
 
     <ng-container matColumnDef="xapp">
-      <mat-header-cell *matHeaderCellDef> xApp Name </mat-header-cell>
+      <mat-header-cell *matHeaderCellDef mat-sort-header> xApp Name </mat-header-cell>
       <mat-cell *matCellDef="let element"> {{element.xapp}} </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="name">
-      <mat-header-cell *matHeaderCellDef> Instance Name</mat-header-cell>
+      <mat-header-cell *matHeaderCellDef mat-sort-header> Instance Name</mat-header-cell>
       <mat-cell *matCellDef="let element"> {{element.instance.name}} </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="status">
-      <mat-header-cell *matHeaderCellDef> Status </mat-header-cell>
+      <mat-header-cell *matHeaderCellDef mat-sort-header> Status </mat-header-cell>
       <mat-cell *matCellDef="let element"> {{element.instance.status}} </mat-cell>
     </ng-container>
 
-    <ng-container matColumnDef="ip">
-      <mat-header-cell *matHeaderCellDef> IP </mat-header-cell>
+    <ng-container matColumnDef="ip" >
+      <mat-header-cell *matHeaderCellDef mat-sort-header> IP </mat-header-cell>
       <mat-cell *matCellDef="let element"> {{element.instance.ip}} </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="port">
-      <mat-header-cell *matHeaderCellDef> Port </mat-header-cell>
+      <mat-header-cell *matHeaderCellDef mat-sort-header> Port </mat-header-cell>
       <mat-cell *matCellDef="let element"> {{element.instance.port}} </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="action">
       <mat-header-cell *matHeaderCellDef> Action </mat-header-cell>
-      <mat-cell *matCellDef="let element">
-        <button mat-icon-button
-                (click)="view()">
+      <!-- click on button should not expand/collapse the row -->
+      <mat-cell *matCellDef="let element" (click)="$event.stopPropagation()">
+        <button mat-icon-button (click)="controlApp(element)">
           <mat-icon>settings</mat-icon>
         </button>
-        <button mat-icon-button
-                color="warn"
-                (click)="undeploy(element.xapp)">
+        <button mat-icon-button color="warn" (click)="undeployApp(element)">
           <mat-icon>delete</mat-icon>
         </button>
       </mat-cell>
@@ -85,8 +83,8 @@
 
     <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
     <mat-row *matRowDef="let element; columns: displayedColumns;"
-             [class.example-expanded-row]="expandedElement === element"
-             (click)="expandedElement = expandedElement === element ? null : element"></mat-row>
+      [class.example-expanded-row]="expandedElement === element"
+      (click)="expandedElement = expandedElement === element ? null : element"></mat-row>
     <tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="message-row"></tr>
   </table>
-</div>
+</div>
\ No newline at end of file