All files / src/app/components/configurations configurations.component.html

100% Statements 63/63
100% Branches 6/6
100% Functions 1/1
100% Lines 27/27

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 397x   698x 7x     7x   243x   243x     7x 7x 7x 7x 7x 7x 7x   7x 1339x 2783x 2783x 2783x 105x 1339x 105x   2783x 2783x 105x   7x 486x 7x    
<h1 class="title">Configurations</h1>
 
@if (!configurations) {
  <app-loader></app-loader>
}
 
@else {
  <div class="container">
    <p-table [value]="configurations" [tableStyle]="{ 'min-width': '50rem' }" [paginator]="true" [rows]="rows" [totalRecords]="total"
      [rowsPerPageOptions]="filteredRowsPerPageOptions" [showCurrentPageReport]="true" [first]="offset" [lazy]="true" [lazyLoadOnInit]="false"
      currentPageReportTemplate="{first} - {last} of {totalRecords} configurations" [rowHover]="true" (onLazyLoad)="onTableEvent($event)">
      <ng-template pTemplate="header">
        <tr>
          <th pSortableColumn="config.device_name">Device's name <p-sortIcon field="config.device_name"></p-sortIcon></th>
          <th pSortableColumn="config_name">Name <p-sortIcon field="config_name"></p-sortIcon></th>
          <th pSortableColumn="config.target_device_id">Devices' IDs <p-sortIcon field="config.target_device_id"></p-sortIcon></th>
          <th pSortableColumn="is_in_use">In use <p-sortIcon field="is_in_use"></p-sortIcon></th>
          <th pSortableColumn="generated_at">Generated at <p-sortIcon field="generated_at"></p-sortIcon></th>
          <th pSortableColumn="received_at">Received at <p-sortIcon field="received_at"></p-sortIcon></th>
        </tr>
      </ng-template>
      <ng-template pTemplate="body" let-configuration>
        <tr class="clickable" [routerLink]="['/configurations', configuration.id]">
          <td>{{ configuration.config.device_name }}</td>
          <td>{{ configuration.config_name }}</td>
          <td>#{{ configuration.device_ids.join(" #") }}</td>
          <td>
            <p-badge [value]="configuration.is_in_use ? 'yes' : 'no'" [severity]="configuration.is_in_use ? 'success' : 'danger' " />
          </td>
          <!-- This value is multiplied by 1000 to get javascript timestamps (otherway timestamp isn't converted to date correctly) -->
          <td>{{ (configuration.generated_at*1000) | date:'yyyy/MM/dd HH:mm:ss' }}</td>
          <td>{{ (configuration.received_at*1000) | date:'yyyy/MM/dd HH:mm:ss' }}</td>
        </tr>
      </ng-template>
    </p-table>
    <button class="button is-rounded" [routerLink]="['/configurations/new']" id="addConfig">Create new configuration</button>
  </div>
}