<!--

    Copyright © 2016-2023 The Thingsboard Authors

    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.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<table mat-table [dataSource]="dataSource" matSort [matSortActive]="pageLink.sortOrder?.property"
       [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
  <ng-container matColumnDef="serviceId">
    <mat-header-cell *matHeaderCellDef style="width: 35%;" mat-sort-header>
      {{ 'widgets.cluster-info.service-id' | translate }}
    </mat-header-cell>
    <mat-cell *matCellDef="let serviceData">
      {{ serviceData.serviceId }}
    </mat-cell>
  </ng-container>
  <ng-container matColumnDef="serviceType">
    <mat-header-cell *matHeaderCellDef style="width: 35%;" mat-sort-header>
      {{ 'widgets.cluster-info.service-type' | translate }}
    </mat-header-cell>
    <mat-cell *matCellDef="let serviceData">
      {{ serviceData.serviceType }}
    </mat-cell>
  </ng-container>
  <ng-container matColumnDef="cpuUsage">
    <mat-header-cell *matHeaderCellDef style="width: 10%;" mat-sort-header>
      {{ 'widgets.system-info.cpu' | translate }}
    </mat-header-cell>
    <mat-cell *matCellDef="let serviceData"
              [matTooltip]="infoTooltip(serviceData, 'cpu')"
              matTooltipPosition="above"
              class="tb-resource-usage"
              [ngClass]="statusClass(serviceData.cpuUsage)">
      {{ serviceData.cpuUsage }}%
    </mat-cell>
  </ng-container>
  <ng-container matColumnDef="memoryUsage">
    <mat-header-cell *matHeaderCellDef style="width: 10%;" mat-sort-header>
      {{ 'widgets.system-info.ram' | translate }}
    </mat-header-cell>
    <mat-cell *matCellDef="let serviceData"
              [matTooltip]="infoTooltip(serviceData, 'ram')"
              matTooltipPosition="above"
              class="tb-resource-usage"
              [ngClass]="statusClass(serviceData.memoryUsage)">
      {{ serviceData.memoryUsage }}%
    </mat-cell>
  </ng-container>
  <ng-container matColumnDef="discUsage">
    <mat-header-cell *matHeaderCellDef style="width: 10%;" mat-sort-header>
      {{ 'widgets.system-info.disk' | translate }}
    </mat-header-cell>
    <mat-cell *matCellDef="let serviceData"
              [matTooltip]="infoTooltip(serviceData, 'disc')"
              matTooltipPosition="above"
              class="tb-resource-usage"
              [ngClass]="statusClass(serviceData.discUsage)">
      {{ serviceData.discUsage }}%
    </mat-cell>
  </ng-container>
  <mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></mat-header-row>
  <mat-row *matRowDef="let serviceData; columns: displayedColumns;"></mat-row>
</table>
<span [fxShow]="dataSource.isEmpty() | async"
      fxLayoutAlign="center center"
      class="no-data-found" translate>widgets.cluster-info.no-data</span>
