All files / src/app/components/signal-command signal-command.component.html

95.94% Statements 71/74
79.54% Branches 35/44
77.77% Functions 7/9
100% Lines 33/33

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 5815x   3454x 225x     3454x   65x 2x 65x       32x   64x 65x   1x     3454x 1079x     3454x   809x 1x 1x 1x     3454x 11x   1474x 2948x 11x   1474x     15x 4x   253x     3454x 4x 228x 460x 4x   15x  
<div class="form-container">
 
  @if (signal.data_type === 'bool') {
    <p-toggleswitch [(ngModel)]="boolValue" />
  }
 
  @if (signal.data_type === 'float' || signal.data_type === 'int') {
    <p-inputgroup>
      <p-inputgroup-addon>{{signal.ticker}}</p-inputgroup-addon>
      <p-inputnumber
        [(ngModel)]="floatValue"
        [placeholder]="placeholder"
        [maxFractionDigits]="signal.data_type.toString() === 'int' ? 0 : precisionNumber"
        [min]="signal.transfer_function ? signal.transfer_function.intervals[0][1] : undefined"
        [max]="signal.transfer_function ? signal.transfer_function.intervals[1][1] : undefined"
      />
      @if (signal.unit) {
        <p-inputgroup-addon>{{signal.unit}}</p-inputgroup-addon>
      }
    </p-inputgroup>
  }
 
  @if (signal.isEnum() && enumOptions.length > 0) {
    <p-select id="string-enum" appendTo="body" [options]="enumOptions" [(ngModel)]="stringValue" placeholder="Select a command" />
  }
 
  @if (signal.data_type === 'epoch') {
    <p-floatLabel>
      <p-datepicker [(ngModel)]="dateValue" inputId="epoch" [showButtonBar]="true" [showTime]="true" [showSeconds]="true"
        todayButtonStyleClass="today-button" (onTodayClick)="setDatePickerToNow()" />
      <label for="epoch">Set Countdown</label>
    </p-floatLabel>
  }
 
  @if (signal.type === 'command' && signal.commandable) {
    <button class="button cmd" (click)="sendCommand()" [disabled]="!canControlSignal || (signal.data_type === 'float' && (floatValue === undefined || floatValue === null)) ||
                      (signal.isEnum() && enumOptions.length < 0)"
      [id]="signal.device_id + '_' + signal.ticker + '_command'" [title]="buttonsTooltip">Send command</button>
    @if (signal.forcible) {
      <button class="button cmd forced" (click)="forceCommand()"
        [id]="signal.device_id + '_' + signal.ticker + '_forced_command'" [disabled]="!canControlSignal"
        [title]="buttonsTooltip">Force command</button>
    }
  }
  @else if (signal.type !== 'command' && signal.forcible) {
    <button class="button cmd" (click)="forceSensor()" [disabled]="!canControlSignal || (signal.data_type === 'float' && (floatValue === undefined || floatValue === null)) ||
                      (signal.isEnum() && enumOptions.length < 0)" [id]="signal.device_id + '_' + signal.ticker + '_force'"
      [title]="buttonsTooltip">Force sensor</button>
  }
 
  @if (signal.forcible && canUnForce) {
    <button class="button cmd" (click)="unForce()" [id]="signal.device_id + '_' + signal.ticker + '_unforce'"
      [disabled]="!canControlSignal || this.commandPending" [title]="buttonsTooltip">
      {{ unForceButtonMessage }}
    </button>
  }
</div>