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

90.72% Statements 88/97
80% Branches 16/20
57.14% Functions 4/7
96.07% Lines 49/51

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 73306x     612x     612x         612x 1x 1x 1x 613x 1x 612x   264x 1x 1x 1x 264x 1x 1x 1x 264x 1x 1x 1x 1x 1x 1x   1x   1x   612x     297x 297x 1x 1x 297x 1x 1x 297x 1x   1x     317x 1x 1x   317x 1x 1x   2x 316x 1x   1x     1x    
@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">
            <button id="device-start" (click)="startDevice(device.device_id)" class="button is-rounded" [disabled]="!device.status.includes('created') && !device.status.includes('exited')">
                <i class="pi pi-play-circle"></i>
                <span>Start</span>
            </button>
            <button id="device-stop" (click)="stopDevice(device.device_id)" class="button is-rounded" [disabled]="device.status.includes('exited') || device.status.includes('created')">
                <i class="pi pi-stop-circle"></i>
                <span>Stop</span>
            </button>
            <button id="device-restart" (click)="restartDevice(device.device_id)" class="button is-rounded" [disabled]="device.status.includes('created') || device.status.includes('exited')">
                <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>
}