]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Improve remote runner config UX
authorChocobozzz <me@florianbigard.com>
Fri, 19 May 2023 12:05:14 +0000 (14:05 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 19 May 2023 12:11:22 +0000 (14:11 +0200)
client/src/app/+admin/config/edit-custom-config/edit-configuration.service.ts
client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html
client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts
client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html
client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts
server/tests/api/check-params/upload-quota.ts
server/tests/api/check-params/video-comments.ts
server/tests/api/videos/video-comments.ts

index 6c431ce644a64441f9324bda6a810421f25832ba..628c2d10268a6af664017211ec5486275aabb6ba 100644 (file)
@@ -61,6 +61,14 @@ export class EditConfigurationService {
     return form.value['transcoding']['enabled'] === true
   }
 
+  isRemoteRunnerVODEnabled (form: FormGroup) {
+    return form.value['transcoding']['remoteRunners']['enabled'] === true
+  }
+
+  isRemoteRunnerLiveEnabled (form: FormGroup) {
+    return form.value['live']['transcoding']['remoteRunners']['enabled'] === true
+  }
+
   isStudioEnabled (form: FormGroup) {
     return form.value['videoStudio']['enabled'] === true
   }
index 34ce8efa6cab3da192235ce4c7f9c120d9644766..e9919741fab8148fa14381c4de43f2fddefe447a 100644 (file)
             </my-peertube-checkbox>
           </div>
 
-          <div class="form-group" formGroupName="remoteRunners" [ngClass]="getDisabledLiveTranscodingClass()">
+          <div class="callout callout-light pt-2 mt-2 pb-0">
+            <label i18n>Output formats</label>
+
+            <div class="form-group" [ngClass]="getDisabledLiveTranscodingClass()">
+              <label i18n for="liveTranscodingThreads">Live resolutions to generate</label>
+
+              <div class="ms-2 mt-2 d-flex flex-column">
+
+                <ng-container formGroupName="resolutions">
+                  <div class="form-group" *ngFor="let resolution of liveResolutions">
+                    <my-peertube-checkbox
+                      [inputName]="getResolutionKey(resolution.id)" [formControlName]="resolution.id"
+                      labelText="{{resolution.label}}"
+                    >
+                      <ng-template *ngIf="resolution.description" ptTemplate="help">
+                        <div [innerHTML]="resolution.description"></div>
+                      </ng-template>
+                    </my-peertube-checkbox>
+                  </div>
+                </ng-container>
+
+                <div class="form-group">
+                  <my-peertube-checkbox
+                    inputName="transcodingAlwaysTranscodeOriginalResolution" formControlName="alwaysTranscodeOriginalResolution"
+                    i18n-labelText labelText="Also transcode original resolution"
+                  >
+                    <ng-container i18n ngProjectAs="description">
+                      Even if it's above your maximum enabled resolution
+                    </ng-container>
+                  </my-peertube-checkbox>
+                </div>
+              </div>
+            </div>
+          </div>
+
+          <div class="form-group mt-4" formGroupName="remoteRunners" [ngClass]="getDisabledLiveTranscodingClass()">
             <my-peertube-checkbox
               inputName="transcodingRemoteRunnersEnabled" formControlName="enabled"
-              i18n-labelText labelText="Enable remote runners"
+              i18n-labelText labelText="Enable remote runners for lives"
             >
               <ng-container ngProjectAs="description">
                 <span i18n>
             </my-peertube-checkbox>
           </div>
 
-          <div class="form-group" [ngClass]="getDisabledLiveTranscodingClass()">
-            <label i18n for="liveTranscodingThreads">Live resolutions to generate</label>
-
-            <div class="ms-2 mt-2 d-flex flex-column">
-
-              <ng-container formGroupName="resolutions">
-                <div class="form-group" *ngFor="let resolution of liveResolutions">
-                  <my-peertube-checkbox
-                    [inputName]="getResolutionKey(resolution.id)" [formControlName]="resolution.id"
-                    labelText="{{resolution.label}}"
-                  >
-                    <ng-template *ngIf="resolution.description" ptTemplate="help">
-                      <div [innerHTML]="resolution.description"></div>
-                    </ng-template>
-                  </my-peertube-checkbox>
-                </div>
-              </ng-container>
-
-              <div class="form-group">
-                <my-peertube-checkbox
-                  inputName="transcodingAlwaysTranscodeOriginalResolution" formControlName="alwaysTranscodeOriginalResolution"
-                  i18n-labelText labelText="Also transcode original resolution"
-                >
-                  <ng-container i18n ngProjectAs="description">
-                    Even if it's above your maximum enabled resolution
-                  </ng-container>
-                </my-peertube-checkbox>
-              </div>
-            </div>
-          </div>
-
-          <div class="form-group" [ngClass]="getDisabledLiveTranscodingClass()">
+          <div class="form-group" [ngClass]="getDisabledLiveLocalTranscodingClass()">
             <label i18n for="liveTranscodingThreads">Live transcoding threads</label>
 
             <span class="small muted ms-1">
             <div *ngIf="formErrors.live.transcoding.threads" class="form-error">{{ formErrors.live.transcoding.threads }}</div>
           </div>
 
-          <div class="form-group mt-4" [ngClass]="getDisabledLiveTranscodingClass()">
+          <div class="form-group mt-4" [ngClass]="getDisabledLiveLocalTranscodingClass()">
             <label i18n for="liveTranscodingProfile">Live transcoding profile</label>
             <span class="small muted ms-1" i18n>new live transcoding profiles can be added by PeerTube plugins</span>
 
index d4892a5715f182906b547c94e2d98e00f2f4c446..50b882cb8878123f28f0538ba3c2eba5df1b7e4a 100644 (file)
@@ -71,6 +71,10 @@ export class EditLiveConfigurationComponent implements OnInit, OnChanges {
     return this.editConfigurationService.isLiveEnabled(this.form)
   }
 
+  isRemoteRunnerLiveEnabled () {
+    return this.editConfigurationService.isRemoteRunnerLiveEnabled(this.form)
+  }
+
   getDisabledLiveClass () {
     return { 'disabled-checkbox-extra': !this.isLiveEnabled() }
   }
@@ -79,6 +83,10 @@ export class EditLiveConfigurationComponent implements OnInit, OnChanges {
     return { 'disabled-checkbox-extra': !this.isLiveEnabled() || !this.isLiveTranscodingEnabled() }
   }
 
+  getDisabledLiveLocalTranscodingClass () {
+    return { 'disabled-checkbox-extra': !this.isLiveEnabled() || !this.isLiveTranscodingEnabled() || this.isRemoteRunnerLiveEnabled() }
+  }
+
   isLiveTranscodingEnabled () {
     return this.editConfigurationService.isLiveTranscodingEnabled(this.form)
   }
index b17c51532c4475f9530f482c6c2a61df7dc4e67a..d3fc2e481743272621e87cae5038a743a7274f82 100644 (file)
 
             <ng-container ngProjectAs="extra">
 
-              <div class="form-group" formGroupName="remoteRunners" [ngClass]="getTranscodingDisabledClass()">
-                <my-peertube-checkbox
-                  inputName="transcodingRemoteRunnersEnabled" formControlName="enabled"
-                  i18n-labelText labelText="Enable remote runners"
-                >
-                  <ng-container ngProjectAs="description">
-                    <span i18n>
-                      Use <a routerLink="/admin/system/runners/runners-list">remote runners</a> to process VOD transcoding.
-                      Remote runners has to register on your instance first.
-                    </span>
-                  </ng-container>
-                </my-peertube-checkbox>
-              </div>
-
               <div class="callout callout-light pt-2 pb-0">
                 <label i18n>Input formats</label>
 
           </my-peertube-checkbox>
         </div>
 
-        <div class="form-group mt-4" [ngClass]="getTranscodingDisabledClass()">
+        <div class="form-group mt-4" formGroupName="remoteRunners" [ngClass]="getTranscodingDisabledClass()">
+          <my-peertube-checkbox
+            inputName="transcodingRemoteRunnersEnabled" formControlName="enabled"
+            i18n-labelText labelText="Enable remote runners for VOD"
+          >
+            <ng-container ngProjectAs="description">
+              <span i18n>
+                Use <a routerLink="/admin/system/runners/runners-list">remote runners</a> to process VOD transcoding.
+                Remote runners has to register on your instance first.
+              </span>
+            </ng-container>
+          </my-peertube-checkbox>
+        </div>
+
+        <div class="form-group mt-4" [ngClass]="getLocalTranscodingDisabledClass()">
           <label i18n for="transcodingThreads">Transcoding threads</label>
 
           <span class="small muted ms-1">
           <div *ngIf="formErrors.transcoding.threads" class="form-error">{{ formErrors.transcoding.threads }}</div>
         </div>
 
-        <div class="form-group" [ngClass]="getTranscodingDisabledClass()">
+        <div class="form-group" [ngClass]="getLocalTranscodingDisabledClass()">
           <label i18n for="transcodingConcurrency">Transcoding jobs concurrency</label>
           <span class="small muted ms-1" i18n>allows to transcode multiple files in parallel. ⚠️ Requires a PeerTube restart</span>
 
           <div *ngIf="formErrors.transcoding.concurrency" class="form-error">{{ formErrors.transcoding.concurrency }}</div>
         </div>
 
-        <div class="form-group" [ngClass]="getTranscodingDisabledClass()">
+        <div class="form-group" [ngClass]="getLocalTranscodingDisabledClass()">
           <label i18n for="transcodingProfile">Transcoding profile</label>
           <span class="small muted ms-1" i18n>new transcoding profiles can be added by PeerTube plugins</span>
 
         <div class="form-group" formGroupName="remoteRunners" [ngClass]="getStudioDisabledClass()">
           <my-peertube-checkbox
             inputName="videoStudioRemoteRunnersEnabled" formControlName="enabled"
-            i18n-labelText labelText="Enable remote runners"
+            i18n-labelText labelText="Enable remote runners for studio"
           >
             <ng-container ngProjectAs="description">
               <span i18n>
index e960533f9809db750b6d9743f533bbc04f0981d1..0a1ebe8e28e673bd0aac845c9eb58955bb3549e0 100644 (file)
@@ -58,6 +58,10 @@ export class EditVODTranscodingComponent implements OnInit, OnChanges {
     return 'transcoding.resolutions.' + resolution
   }
 
+  isRemoteRunnerVODEnabled () {
+    return this.editConfigurationService.isRemoteRunnerVODEnabled(this.form)
+  }
+
   isTranscodingEnabled () {
     return this.editConfigurationService.isTranscodingEnabled(this.form)
   }
@@ -70,6 +74,10 @@ export class EditVODTranscodingComponent implements OnInit, OnChanges {
     return { 'disabled-checkbox-extra': !this.isTranscodingEnabled() }
   }
 
+  getLocalTranscodingDisabledClass () {
+    return { 'disabled-checkbox-extra': !this.isTranscodingEnabled() || this.isRemoteRunnerVODEnabled() }
+  }
+
   getStudioDisabledClass () {
     return { 'disabled-checkbox-extra': !this.isStudioEnabled() }
   }
index fdc711bd52420b46f2f387e48e7801d09d59f0e1..00853752402649ca1ccff9f9e91c32679aac4fca 100644 (file)
@@ -39,7 +39,7 @@ describe('Test upload quota', function () {
   describe('When having a video quota', function () {
 
     it('Should fail with a registered user having too many videos with legacy upload', async function () {
-      this.timeout(30000)
+      this.timeout(120000)
 
       const user = { username: 'registered' + randomInt(1, 1500), password: 'password' }
       await server.registrations.register(user)
index 55019884487824479dfccc4327131e1a0ae7fbc9..9f497c0cfee34f84f3c4a0aa8df4f9cff16be279 100644 (file)
@@ -31,7 +31,7 @@ describe('Test video comments API validator', function () {
   // ---------------------------------------------------------------
 
   before(async function () {
-    this.timeout(30000)
+    this.timeout(120000)
 
     server = await createSingleServer(1)
 
index e35500b0befefdbb19d545d642617c6c532540b7..b7d5624a6b3c8f794928844af4451219084af380 100644 (file)
@@ -24,7 +24,7 @@ describe('Test video comments', function () {
   let command: CommentsCommand
 
   before(async function () {
-    this.timeout(30000)
+    this.timeout(120000)
 
     server = await createSingleServer(1)