Chocobozzz/PeerTube

View on GitHub
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html

Summary

Maintainability
Test Coverage
<h1 class="visually-hidden" i18n>Configuration</h1>

<my-alert type="warning" *ngIf="!isUpdateAllowed()" i18n>
  Updating instance configuration from the web interface is disabled by the system administrator.
</my-alert>

<form [formGroup]="form">

  <div ngbNav #nav="ngbNav" [activeId]="activeNav" (activeIdChange)="onNavChange($event)" class="nav-tabs">

    <ng-container ngbNavItem="instance-homepage">
      <a ngbNavLink i18n>Homepage</a>

      <ng-template ngbNavContent>
        <my-edit-homepage [form]="form" [formErrors]="formErrors"></my-edit-homepage>
      </ng-template>
    </ng-container>

    <ng-container ngbNavItem="instance-information">
      <a ngbNavLink i18n>Information</a>

      <ng-template ngbNavContent>
        <my-edit-instance-information [form]="form" [formErrors]="formErrors" [languageItems]="languageItems" [categoryItems]="categoryItems">
        </my-edit-instance-information>
      </ng-template>
    </ng-container>

    <ng-container ngbNavItem="basic-configuration">
      <a ngbNavLink i18n>Basic</a>

      <ng-template ngbNavContent>
        <my-edit-basic-configuration [form]="form" [formErrors]="formErrors" [serverConfig]="serverConfig">
        </my-edit-basic-configuration>
      </ng-template>
    </ng-container>

    <ng-container ngbNavItem="transcoding">
      <a ngbNavLink i18n>VOD Transcoding</a>

      <ng-template ngbNavContent>
        <my-edit-vod-transcoding [form]="form" [formErrors]="formErrors" [serverConfig]="serverConfig">
        </my-edit-vod-transcoding>
      </ng-template>
    </ng-container>

    <ng-container ngbNavItem="live">
      <a ngbNavLink i18n>Live streaming</a>

      <ng-template ngbNavContent>
        <my-edit-live-configuration [form]="form" [formErrors]="formErrors" [serverConfig]="serverConfig">
        </my-edit-live-configuration>
      </ng-template>
    </ng-container>

    <ng-container ngbNavItem="advanced-configuration">
      <a ngbNavLink i18n>Advanced</a>

      <ng-template ngbNavContent>
        <my-edit-advanced-configuration [form]="form" [formErrors]="formErrors">
        </my-edit-advanced-configuration>
      </ng-template>
    </ng-container>
  </div>

  <div [ngbNavOutlet]="nav"></div>

  <div class="row mt-4"> <!-- submit placement block -->
    <div class="col-md-7 col-xl-5"></div>
    <div class="col-md-5 col-xl-5">

      <div role="alert" class="form-error submit-error" i18n *ngIf="!form.valid && isUpdateAllowed()">
        There are errors in the form:

        <ul>
          <li *ngFor="let error of grabAllErrors()">
            {{ error }}
          </li>
        </ul>
      </div>

      <span role="alert" class="form-error submit-error" i18n *ngIf="!hasLiveAllowReplayConsistentOptions()">
        You cannot allow live replay if you don't enable transcoding.
      </span>

      <span i18n *ngIf="!isUpdateAllowed()">
        You cannot change the server configuration because it's managed externally.
      </span>

      <input
        (click)="formValidated()" type="submit" i18n-value value="Update configuration"
        [disabled]="!form.valid || !hasConsistentOptions() || !isUpdateAllowed()"
      >
    </div>
  </div>
</form>