All files / src/app/components/commands-table commands-table.component.html

97.18% Statements 69/71
87.5% Branches 7/8
66.66% Functions 2/3
100% Lines 33/33

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  196x 1x 1x 1x   1x 1x   1x 196x 1x   4x     86x 1x     1x 1x       1x 1x 1x 1x 1x 1x 1x   1x   1760x 1760x 1760x 1760x 40x 860x 40x 1760x 40x   1x   1x  
<div>
  <button [routerLink]="['/admin']" class="button is-rounded">
    <i class="pi pi-chevron-left"></i>
    <span>Admin</span>
  </button>
 
  <span class="title margin-left">Commands</span>
</div>
 
<div class="container">
  @if (commands) {
    <p-table
      [value]="commands.items" [tableStyle]="{ 'min-width': '50rem' }" [paginator]="true" [rows]="rows"
      [lazy]="true" (onLazyLoad)="loadCommands($event)"
      [rowsPerPageOptions]="defaultRowOptions" [showCurrentPageReport]="true"
      [totalRecords]="commands.total"
      currentPageReportTemplate="Showing {first} - {last} of {totalRecords} commands" [rowHover]="true"
      (onPage)="onTableEvent($event)">
      <ng-template pTemplate="caption">
        <div class="flex align-items-center justify-content-between">
          <p-button icon="pi pi-refresh" (onClick)="getData()"></p-button>
        </div>
      </ng-template>
      <ng-template #header>
        <tr>
          <th pSortableColumn="user_id">User <p-sortIcon field="user_id"></p-sortIcon></th>
          <th pSortableColumn="command_type">Type <p-sortIcon field="command_type"></p-sortIcon></th>
          <th pSortableColumn="sent_at">Sent at <p-sortIcon field="sent_at"></p-sortIcon></th>
          <th pSortableColumn="response_time">Delay (s) <p-sortIcon field="response_time"></p-sortIcon></th>
          <th pSortableColumn="succeeded">Succeeded <p-sortIcon field="succeeded"></p-sortIcon></th>
          <th pSortableColumn="description">Description <p-sortIcon field="description"></p-sortIcon></th>
        </tr>
      </ng-template>
      <ng-template #body let-command>
        <tr>
          <td>{{ userNamesById.get(command.user_id) ?? "User not found" }}</td>
          <td>{{ command.command_type }}</td>
          <td>{{ command.sent_at * 1000 | date: 'yyyy/MM/dd HH:mm' }}</td>
          <td>{{ command.response_time.toFixed(3) }}</td>
          <td>
            <p-badge [value]="command.succeeded ? 'yes' : 'no'" [severity]="command.succeeded ? 'success' : 'danger'"/>
          </td>
          <td>{{ command.description }}</td>
        </tr>
      </ng-template>
    </p-table>
  }
</div>