All files / src/app/components/forced-signals forced-signals.component.html

93.65% Statements 59/63
75% Branches 3/4
50% Functions 2/4
100% Lines 29/29

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  104x 1x 1x 1x   1x 1x   1x 104x 1x 2x     20x 1x     1x 1x       1x 1x 1x 1x 1x 1x   1x   42x 42x 42x 42x 2x 2x   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">Forced signals</span>
</div>
 
<div class="container">
    @if (forcedSignals) {
        <p-table [value]="forcedSignals.items" [tableStyle]="{ 'min-width': '50rem' }" [paginator]="true" [rows]="rows"
        [lazy]="true" (onLazyLoad)="loadForcedSignals($event)"
        [rowsPerPageOptions]="defaultRowOptions" [showCurrentPageReport]="true"
        [totalRecords]="forcedSignals.total"
        currentPageReportTemplate="Showing {first} - {last} of {totalRecords} forced signals" [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="signal_id">Signal ID <p-sortIcon field="signal_id"></p-sortIcon></th>
                    <th pSortableColumn="forced_at">Forced at <p-sortIcon field="forced_at"></p-sortIcon></th>
                    <th pSortableColumn="value">Forced value <p-sortIcon field="value"></p-sortIcon></th>
                    <th></th>
                </tr>
            </ng-template>
            <ng-template #body let-forcedSignal>
                <tr>
                    <td>{{ userNamesById.get(forcedSignal.forcing_user_id) ?? "User not found" }}</td>
                    <td>{{ forcedSignal.signal_id }}</td>
                    <td>{{ forcedSignal.forced_at * 1000 | date: 'yyyy/MM/dd HH:mm' }}</td>
                    <td>{{ forcedSignal.value }}</td>
                    <td><button (click)="unForceSignal(forcedSignal.signal_id)" class="button is-inline-flex is-danger is-small" id="unForceSignal">Unforce signal</button></td>
                </tr>
            </ng-template>
        </p-table>
    }
</div>