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

94.18% Statements 81/86
93.75% Branches 15/16
66.66% Functions 2/3
98.07% Lines 51/52

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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 943x 238x 2x     238x       190x 3x 3x 3x 190x 1x     3x 3x   3x 3x 190x 46x 3x 3x 3x     3x 3x 3x     3x   190x   3x 95x 3x     3x     99x 1x 1x   2x 98x 1x     1x       190x 3x   190x       3x 190x     8x       9x 9x 1x 9x   1x   1x 9x       1x       3x   3x  
<section class="container">
    @if (!deviceDeployer){
    <app-loader></app-loader>
    }
 
    @if (deviceDeployer){
    <div>
        <div class="level">
            <div class="level-left">
                <button [routerLink]="['/device-deployers']" class="button is-rounded">
                    <i class="pi pi-chevron-left"></i>
                    <span>Device deployers</span>
                </button>
                @if (deviceDeployerId === 'new'){
                    <h1 class="title is-4">Add new deployer</h1>
 
                }
                @else{
                    <h1 class="title is-4">Deployer</h1>
                }
            </div>
            <div class="level-right">
                @if (deviceDeployerId !== 'new'){
                <button class="button is-rounded" [routerLink]="['/device-deployers/', deviceDeployerId, 'devices', 'new']" id="addDevice">
                    <i class="pi pi-plus"></i>
                    <span>Add new device</span>
                </button>
                }
 
                <button class="button is-rounded" (click)="deleteDeployer()">
                    <i class="pi pi-trash"></i>
                    <span>Delete deployer</span>
                </button>
            </div>
        </div>
 
        @if (deviceDeployerId !== "new"){
        <div>
            <h1 class="title">Device deployer</h1>
            <p> url {{deviceDeployer.url}}</p>
        </div>
 
        }
        @else{
        <div>
            <p-floatlabel>
                <input id="url" pInputText [(ngModel)]="deviceDeployer.url" />
                <label for="username">URL</label>
            </p-floatlabel>
 
            <button (click)="addDeployer()" class="button" id="addDeployer"
                [disabled]="!deviceDeployer.url">
                Add new deployer
            </button>
 
        </div>
 
        }
 
        @if (devices === undefined){
        <app-loader elementName="devices"></app-loader>
        }
        @if (devicesError === true){
        <p >Cannot fetch devices. Is url correct?</p>
        }
        <div class="fixed-grid has-3-cols">
            <div class="grid">
                <div class="cell" *ngFor="let device of devices">
 
                    <div class="card"
                        [routerLink]="['/device-deployers/', deviceDeployer.id, 'devices', device.device_id]">
                        <div class="card-content">
                            <div class="media">
                                <div class="media-content">
                                    <p class="title is-4">{{device.name}}</p>
                                    <p class="subtitle is-6">device #{{device.device_id.slice(8)}}</p>
                                    <span class="tag"
                                        [ngClass]="device.statusClass(device.status)">{{device.status}}</span>
                                </div>
                            </div>
 
                            <div class="content">
                                {{ device.description }}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
 
    </div>
    }
</section>