Chocobozzz/PeerTube

View on GitHub
client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html

Summary

Maintainability
Test Coverage
<div *ngIf="!isInUpdateForm" class="upload-video-container">
  <div class="first-step-block">
    <my-global-icon class="upload-icon" iconName="upload" aria-hidden="true"></my-global-icon>

    <div class="form-group">
      <label i18n for="first-step-channel">Channel</label>
      <my-select-channel inputId="first-step-channel" [items]="userVideoChannels" [(ngModel)]="firstStepChannelId"></my-select-channel>
    </div>

    <div class="form-group">
      <label i18n for="first-step-privacy">Privacy</label>
      <my-select-options inputId="first-step-privacy" [items]="videoPrivacies" [(ngModel)]="firstStepPrivacyId"></my-select-options>
    </div>

    <div class="form-group live-type">
      <div class="peertube-radio-container">
        <input type="radio" id="permanentLiveFalse" [(ngModel)]="firstStepPermanentLive" [value]="false">
        <label i18n for="permanentLiveFalse" class="radio">Normal live</label>

        <span class="form-group-description">{{ getNormalLiveDescription() }}</span>
      </div>

      <div class="peertube-radio-container">
        <input type="radio" id="permanentLiveTrue" [(ngModel)]="firstStepPermanentLive" [value]="true">
        <label i18n for="permanentLiveTrue" class="radio">Permanent/recurring live</label>

        <span class="form-group-description" i18n>{{ getPermanentLiveDescription() }}</span>
      </div>
    </div>

    <input
      [disabled]="firstStepPermanentLive !== true && firstStepPermanentLive !== false"
      type="button" i18n-value value="Go Live" (click)="goLive()"
    />
  </div>
</div>

<my-alert *ngIf="error" type="danger">
  <div i18n>Sorry, but something went wrong</div>

  {{ error }}
</my-alert>

<my-alert type="primary" i18n *ngIf="isInUpdateForm && getMaxLiveDuration() >= 0">
  Max live duration is {{ getMaxLiveDuration() | myTimeDurationFormatter }}.
  If your live reaches this limit, it will be automatically terminated.
</my-alert>

<!-- Hidden because we want to load the component -->
<form [hidden]="!isInUpdateForm" novalidate [formGroup]="form">
  <my-video-edit
    [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
    [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo"
    forbidScheduledPublication="true" hideWaitTranscoding="true" displayTranscriptionInfo="false"
    type="go-live"
  ></my-video-edit>

  <div class="submit-container">
    <my-button
      theme="orange" i18n-label label="Update" icon="circle-tick"
      (click)="updateSecondStep()" [disabled]="!form.valid || isUpdatingVideo === true"
    ></my-button>
  </div>
</form>