<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    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" class="gio-table-light <%= dasherize(name) %>" aria-label="<%= name %> list">
  <ng-container matColumnDef="name">
    <th mat-header-cell *matHeaderCellDef id="name">Name</th>
    <td mat-cell *matCellDef="let element">
      {{ element.name }}
    </td>
  </ng-container>

  <ng-container matColumnDef="actions">
    <th mat-header-cell *matHeaderCellDef id="actions">Action</th>
    <td mat-cell *matCellDef="let element">
      <div class="notifications__actions">
        <button
          mat-icon-button
          aria-label="Edit"
          matTooltip="Edit"
          (click)="edit.emit(element.id)"
        >
          <mat-icon svgIcon="gio:edit-pencil" />
        </button>

        <button
          mat-icon-button
          aria-label="Delete"
          matTooltip="Delete"
          (click)="delete.emit(element)"
        >
          <mat-icon svgIcon="gio:trash" />
        </button>
      </div>
    </td>
  </ng-container>

  <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
  <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>

  <!-- Row shown when there is no data -->
  <tr class="mat-mdc-row mdc-data-table__row" *matNoDataRow>
    <td class="mat-mdc-cell mdc-data-table__cell" [attr.colspan]="displayedColumns.length">
        @if (loading) {
          <gio-loader />
        } @else {
          No data to display.
        }
    </td>
  </tr>
</table>

