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

95.94% Statements 71/74
84.21% Branches 32/38
77.77% Functions 7/9
100% Lines 31/31

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 5214x   3354x 213x     3354x   57x 57x 56x 57x   1x     3354x 1062x     3354x   773x 1x 1x 1x     3354x 10x   1444x 2888x 10x   1444x     14x 4x   233x     3354x 4x 204x 411x 3x   14x  
<div class="form-container">
 
  @if (signal.data_type === 'bool') {
    <p-toggleswitch [(ngModel)]="boolValue" />
  }
 
  @if (signal.data_type === 'float') {
    <p-inputgroup>
      <p-inputgroup-addon>{{signal.ticker}}</p-inputgroup-addon>
      <p-inputnumber [(ngModel)]="floatValue" [placeholder]="placeholder" [maxFractionDigits]="precisionNumber" />
      @if (signal.unit) {
        <p-inputgroup-addon>{{signal.unit}}</p-inputgroup-addon>
      }
    </p-inputgroup>
  }
 
  @if (signal.isEnum() && enumOptions.length > 0) {
    <p-select id="string-enum" [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>