All files / src/app/components/device-from-deployer device-from-deployer.component.html

95.91% Statements 94/98
93.75% Branches 15/16
85.71% Functions 6/7
98.14% Lines 53/54

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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75184x 1x   368x     368x         336x 2x 2x 2x 338x 2x 336x 2x 40x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x   2x   2x   336x     66x 66x 2x 2x 66x 2x 2x 66x 2x   2x     273x 1x 1x   273x 1x 1x   2x 272x 1x   1x     2x    
@if (!device&&!deviceError){
<app-loader elementName="device"></app-loader>
}
@if (deviceError){
<app-error [error]="deviceError"></app-error>
}
@if (device){
<div>
 
    <div class="level">
        <div class="level-right">
            <button [routerLink]="['/device-deployers/', deviceDeployerId]" class="button is-rounded">
                <i class="pi pi-chevron-left"></i>
                <span>Back to deployer</span>
            </button>
            <h1 class="title is-4">Device {{device.name}}</h1>
        </div>
        @if (deviceId !== 'new' && device.status){
        <div class="level-left">
            @if (device.status.includes('exited') || device.status.includes('created')){
            <button id="device-start" (click)="startDevice(device.device_id)" class="button is-rounded">
                <i class="pi pi-play-circle"></i>
                <span>Start</span>
            </button>
            <button id="device-stop" (click)="stopDevice(device.device_id)" class="button is-rounded">
                <i class="pi pi-stop-circle"></i>
                <span>Stop</span>
            </button>
            <button id="device-restart" (click)="restartDevice(device.device_id)" class="button is-rounded">
                <i class="pi pi-refresh"></i>
                <span>Restart</span>
            </button>
            <button id="device-delete" (click)="deleteDevice(device.device_id)" class="button is-rounded">
                <i class="pi pi-trash"></i>
                <span>Delete</span>
            </button>
            }
        </div>
        }
    </div>
 
    @if (deviceId !== 'new' && device){
 
    <div>
        <p class="subtitle is-6">device #{{deviceId.slice(8)}}</p>
        <span class="tag" [ngClass]="device.statusClass(device.status)">{{device.status}}</span>
        <h3 class="subtitle is-3">Description</h3>
        <p>
            {{device.description}}
        </p>
        <h3 class="subtitle is-3">Logs</h3>
        <pre>{{device.logs}}</pre>
    </div>
    }
    @else{
    <div>
        <p-floatlabel>
            <input id="name" pInputText [(ngModel)]="device.name" />
            <label for="name">Name</label>
        </p-floatlabel>
        <p-floatlabel>
            <input id="desc" pInputText [(ngModel)]="device.description" />
            <label for="desc">Description</label>
        </p-floatlabel>
 
        <button (click)="addDevice()" class="button" id="addDevice"
            [disabled]="!device.name">
            Add new device
        </button>
    </div>
    }
 
</div>
}