All files / src/app/components/view-builder view-builder.component.html

91.5% Statements 97/106
81.25% Branches 13/16
100% Functions 7/7
92.68% Lines 38/41

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  2x 932x 1x   932x 301x   2x 932x   2x 2x 932x       934x 932x     932x       2x     8x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x   2x   934x 8x     2x 2x 932x 2x 2x 300x   2x 2x       2x  
<div class="container">
  <div class="title">
    @if (this.viewId === null) {
      <h1 class="title">Add new custom View</h1>
    }
    @if (this.viewId !== null) {
      <h1 class="title">Edit {{ buildedView.name }}</h1>
    }
  </div>
  <form [formGroup]="customViewForm">
    <div class="columns">
      <div class="column is-three-fifths">
        <input class="input" formControlName="customViewName" type="text" id="customViewName" placeholder="Enter a name to your custom view">
        @if (isNameErrorVisible) {
          <p class="has-text-danger" >You need to add at least one component</p>
        }
        <div class="pt-5">
          <textarea formControlName="customViewConfiguration" class="editor" rows="5" cols="30" [(ngModel)]="configurationText"></textarea>
          @if (isConfErrorVisible) {
            <p class="has-text-danger" >You need to add at least one component</p>
          }
          @if (isDataErrorVisible) {
            <p class="has-text-danger" >You need to specify required data for each component</p>
          }
        </div>
      </div>
      <div class="column">
        <div class="select maxwidth">
          <select class="maxwidth" name="componentSelector" (change)="newComponent($event)" >
            <option value="" disabled selected>Select component to add on the view</option>
            <option value="PidComponent">PidComponent</option>
            <option value="PetriComponent">PetriComponent</option>
            <option value="VideosComponent">VideosComponent</option>
            <option value="DeviceCardLogicComponent">DeviceCardLogicComponent</option>
            <option value="SignalsComponent">SignalsComponent</option>
            <option value="SignalCardComponent">SignalCardComponent</option>
            <option value="SignalsGraphsComponent">SignalsGraphsComponent</option>
            <option value="CommandCenterComponent">CommandCenterComponent</option>
            <option value="EventsComponent">EventsComponent</option>
            <option value="CountdownComponent">CountdownComponent</option>
          </select>
        </div>
        <div class="pt-5">
          <textarea formControlName="componentExample" class="editor" rows="5" cols="30" [(ngModel)]="componentText"></textarea>
          <button (click)="addToConfiguration()" class="button is-block is-info is-small" id="addToConfiguration">Add to custom view</button>
        </div>
      </div>
    </div>
    <div class="has-text-centered">
      @if (this.viewId !== null) {
        <button (click)="saveCustomView()" class="button is-primary" id="saveCustomView">Save custom view</button>
        <button (click)="deleteCustomView(this.viewId, this.buildedView.name)" class="button is-danger" id="deleteCustomView">Delete custom view</button>
        <button [routerLink]="['/custom-views', viewId]" class="button" id="saveCustomView">Go to view</button>
      }
      @else {
      <button (click)="saveCustomView()" class="button is-primary" id="saveCustomView">Create custom view</button>
    }
  </div>
</form>
</div>