<!--
Copyright 2017 The Kubernetes 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.
-->

<kd-card [initialized]="initialized"
         role="table">
  <div title
       i18n>Resource Limits</div>

  <div description>
    <div class="kd-inline-property"
         *ngIf="limits?.length">
      <span class="kd-muted-light"
            i18n>Items:&nbsp;</span>
      <span>{{limits.length}}</span>
    </div>
  </div>

  <div content
       [hidden]="!limits?.length">
    <mat-table [dataSource]="getDataSource()"
               class="kd-table-no-footer">
      <ng-container [matColumnDef]="getColumnIds()[0]">
        <mat-header-cell *matHeaderCellDef
                         i18n>Resource name</mat-header-cell>
        <mat-cell *matCellDef="let limit">{{limit.resourceName}}</mat-cell>
      </ng-container>
      <ng-container [matColumnDef]="getColumnIds()[1]">
        <mat-header-cell *matHeaderCellDef
                         i18n>Resource type</mat-header-cell>
        <mat-cell *matCellDef="let limit">{{limit.resourceType}}</mat-cell>
      </ng-container>
      <ng-container [matColumnDef]="getColumnIds()[2]">
        <mat-header-cell *matHeaderCellDef
                         i18n>Default</mat-header-cell>
        <mat-cell *matCellDef="let limit">{{limit.default}}</mat-cell>
      </ng-container>
      <ng-container [matColumnDef]="getColumnIds()[3]">
        <mat-header-cell *matHeaderCellDef
                         i18n>Default request</mat-header-cell>
        <mat-cell *matCellDef="let limit">{{limit.defaultRequest}}</mat-cell>
      </ng-container>
      <mat-header-row *matHeaderRowDef="getColumnIds()"></mat-header-row>
      <mat-row *matRowDef="let row; columns: getColumnIds();"></mat-row>
    </mat-table>
  </div>

  <div content
       [hidden]="limits?.length">
    <kd-list-zero-state></kd-list-zero-state>
  </div>
</kd-card>
