App metrics visualization manage
[portal/ric-dashboard.git] / dashboard / webapp-frontend / src / app / stats / stats.component.html
index 798d557..4a2ddc9 100644 (file)
@@ -7,9 +7,9 @@
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
-  
+
        http://www.apache.org/licenses/LICENSE-2.0
-  
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   limitations under the License.
   ========================LICENSE_END===================================
   -->
-<div class="stats__section">
-
-       <h3 class="rd-global-page-title">Platform stats</h3>
-
-       <mat-tab-group>
-               <mat-tab label="MC xApp">
-                       <mat-grid-list cols="3" rowHeight="3:2">
-                               <mat-grid-tile>
-                                       <mat-card>
-                                               <iframe [src]="metricsUrlMc"></iframe>
-                                       </mat-card>
-                               </mat-grid-tile>
-                       </mat-grid-list>
-               </mat-tab>
-               <mat-tab label="ML xApp">
-                       <mat-grid-list cols="3" rowHeight="3:2">
-                               <mat-grid-tile>
-                                       <mat-card>
-                                               <iframe [src]="metricsUrlMl"></iframe>
-                                       </mat-card>
-                               </mat-grid-tile>
-                       </mat-grid-list>
-               </mat-tab>
-       </mat-tab-group>
-
-</div>
+  <div class="stats__section">
+    <h3 class="rd-global-page-title">Platform stats</h3>
+    <button mat-raised-button (click)="setupAppMetrics()">Add App Metrics..</button>
+    <table mat-table class="stats-table mat-elevation-z8" [dataSource]="dataSource">
+      <ng-template #noValue></ng-template>
+
+
+      <ng-container matColumnDef="appName">
+        <mat-header-cell *matHeaderCellDef>App Name</mat-header-cell>
+        <mat-cell *matCellDef="let stats">
+          <div *ngIf="stats.statsDetails.appName; else noValue">{{stats.statsDetails.appName}}</div>
+        </mat-cell>
+      </ng-container>
+
+      <ng-container matColumnDef="metricUrl">
+        <mat-header-cell *matHeaderCellDef>Metrics Url</mat-header-cell>
+        <mat-cell *matCellDef="let stats">
+          <div *ngIf="stats.statsDetails.metricUrl; else noValue">{{stats.statsDetails.metricUrl}}</div>
+        </mat-cell>
+      </ng-container>
+
+      <ng-container matColumnDef="editmetricUrl">
+        <mat-header-cell *matHeaderCellDef>Action</mat-header-cell>
+        <mat-cell *matCellDef="let stats">
+          <div *ngIf="stats; else noValue"><button mat-icon-button (click)="editAppMetrics(stats)">
+            <mat-icon matTooltip="Edit name, url">edit</mat-icon>
+          </button></div>
+          <div *ngIf="stats; else noValue"><button mat-icon-button (click)="viewAppMetrics(stats)">
+            <mat-icon matTooltip="View metrics">pageview</mat-icon>
+          </button></div>
+          <div *ngIf="stats; else noValue"><button mat-icon-button (click)="deleteAppMetrics(stats)">
+            <mat-icon matTooltip="Delete metrics">delete</mat-icon>
+          </button></div>
+        </mat-cell>
+      </ng-container>
+
+      <ng-container matColumnDef="noRecordsFound">
+        <mat-footer-cell *matFooterCellDef>No records found.</mat-footer-cell>
+      </ng-container>
+
+      <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
+      <mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
+      <mat-footer-row *matFooterRowDef="['noRecordsFound']" [ngClass]="{'display-none': dataSource.rowCount > 0}">
+      </mat-footer-row>
+
+    </table>
+    <div class="spinner-container" *ngIf="dataSource.loading$ | async">
+      <mat-spinner diameter=50></mat-spinner>
+    </div>
+
+    <mat-form-field [hidden]="true">
+      <input matInput type="number" [formControl]="selected">
+    </mat-form-field>
+
+    <mat-tab-group [selectedIndex]="selected.value" (selectedIndexChange)="selected.setValue($event)" (selectedTabChange)="onTabChanged($event)">
+      <mat-tab *ngFor="let tab of tabs; let index = index" [label]="tab.statsDetails.appName">
+        <iframe [src]="metricsUrl"></iframe>
+      </mat-tab>
+    </mat-tab-group>
+  </div>