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 5215x   3288x 217x     3288x   57x 57x 56x 57x   1x     3288x 1026x     3288x   773x 1x 1x 1x     3288x 11x   1419x 2838x 11x   1419x     15x 4x   225x     3288x 4x 218x 440x 4x   15x  
<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.ticker + '_command'" [title]="buttonsTooltip">Send command</button>
    @if (signal.forcible) {
      <button class="button cmd forced" (click)="forceCommand()"
        [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.ticker + '_force'"
      [title]="buttonsTooltip">Force sensor</button>
  }
 
  @if (signal.forcible && canUnForce) {
    <button class="button cmd" (click)="unForce()" [id]="signal.ticker + '_unforce'"
      [disabled]="!canControlSignal || this.commandPending" [title]="buttonsTooltip">
      {{ unForceButtonMessage }}
    </button>
  }
</div>