]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add ability to set a custom quota
authorChocobozzz <me@florianbigard.com>
Wed, 10 Feb 2021 08:05:29 +0000 (09:05 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 10 Feb 2021 10:36:40 +0000 (11:36 +0100)
21 files changed:
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
client/src/app/+admin/config/shared/config.service.ts
client/src/app/+admin/users/user-edit/user-create.component.ts
client/src/app/+admin/users/user-edit/user-edit.component.html
client/src/app/+admin/users/user-edit/user-edit.component.scss
client/src/app/+admin/users/user-edit/user-edit.ts
client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.ts
client/src/app/+videos/+video-edit/shared/video-edit.component.ts
client/src/app/+videos/+video-edit/video-add-components/video-send.ts
client/src/app/+videos/+video-edit/video-update.component.ts
client/src/app/helpers/utils.ts
client/src/app/shared/form-validators/form-validator.model.ts
client/src/app/shared/shared-forms/select/select-channel.component.ts
client/src/app/shared/shared-forms/select/select-checkbox.component.ts
client/src/app/shared/shared-forms/select/select-custom-value.component.html
client/src/app/shared/shared-forms/select/select-custom-value.component.ts
client/src/app/shared/shared-forms/select/select-options.component.ts
client/src/app/shared/shared-forms/select/select-shared.component.scss
client/src/app/shared/shared-user-settings/user-video-settings.component.ts
client/src/types/select-options-item.model.ts [new file with mode: 0644]

index 844620ca2f1cb5b6c4fa987bdff8913bb07afb4c..637203b96a0691104f9c6ad234f424d359fd2147 100644 (file)
             <ng-container formGroupName="user">
               <div class="form-group">
                 <label i18n for="userVideoQuota">Default video quota per user</label>
-                <div class="peertube-select-container">
-                  <select id="userVideoQuota" formControlName="videoQuota" class="form-control">
-                    <option *ngFor="let videoQuotaOption of videoQuotaOptions" [value]="videoQuotaOption.value" [disabled]="videoQuotaOption.disabled">
-                      {{ videoQuotaOption.label }}
-                    </option>
-                  </select>
-                </div>
+
+                <my-select-custom-value
+                  id="userVideoQuota"
+                  [items]="videoQuotaOptions"
+                  formControlName="videoQuota"
+                  i18n-inputSuffix inputSuffix="bytes" inputType="number"
+                  [clearable]="false"
+                ></my-select-custom-value>
+
                 <div *ngIf="formErrors.user.videoQuota" class="form-error">{{ formErrors.user.videoQuota }}</div>
               </div>
 
               <div class="form-group">
                 <label i18n for="userVideoQuotaDaily">Default daily upload limit per user</label>
-                <div class="peertube-select-container">
-                  <select id="userVideoQuotaDaily" formControlName="videoQuotaDaily" class="form-control">
-                    <option *ngFor="let videoQuotaDailyOption of videoQuotaDailyOptions" [value]="videoQuotaDailyOption.value" [disabled]="videoQuotaDailyOption.disabled">
-                      {{ videoQuotaDailyOption.label }}
-                    </option>
-                  </select>
-                </div>
+
+                <my-select-custom-value
+                  id="userVideoQuotaDaily"
+                  [items]="videoQuotaDailyOptions"
+                  formControlName="videoQuotaDaily"
+                  i18n-inputSuffix inputSuffix="bytes" inputType="number"
+                  [clearable]="false"
+                ></my-select-custom-value>
+
                 <div *ngIf="formErrors.user.videoQuotaDaily" class="form-error">{{ formErrors.user.videoQuotaDaily }}</div>
               </div>
             </ng-container>
index a9f72d7dbdd45e52534f206d1d366edbb2d63dd7..56be97e844cfecb6988e5bde0a45a158dccc8852 100644 (file)
@@ -19,9 +19,10 @@ import {
   TRANSCODING_THREADS_VALIDATOR
 } from '@app/shared/form-validators/custom-config-validators'
 import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators'
-import { FormReactive, FormValidatorService, SelectOptionsItem } from '@app/shared/shared-forms'
+import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
 import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
 import { CustomConfig, ServerConfig } from '@shared/models'
+import { SelectOptionsItem } from 'src/types/select-options-item.model'
 
 @Component({
   selector: 'my-edit-custom-config',
index 5f98aa5450e77f96db9a6d012577b8b1a5b8b471..d29b752f70f4988bbbccbaca86e1cb1a846ef57d 100644 (file)
@@ -3,43 +3,46 @@ import { HttpClient } from '@angular/common/http'
 import { Injectable } from '@angular/core'
 import { RestExtractor } from '@app/core'
 import { CustomConfig } from '@shared/models'
+import { SelectOptionsItem } from '../../../../types/select-options-item.model'
 import { environment } from '../../../../environments/environment'
 
 @Injectable()
 export class ConfigService {
   private static BASE_APPLICATION_URL = environment.apiUrl + '/api/v1/config'
 
-  videoQuotaOptions: { value: number, label: string, disabled?: boolean }[] = []
-  videoQuotaDailyOptions: { value: number, label: string, disabled?: boolean }[] = []
+  videoQuotaOptions: SelectOptionsItem[] = []
+  videoQuotaDailyOptions: SelectOptionsItem[] = []
 
   constructor (
     private authHttp: HttpClient,
     private restExtractor: RestExtractor
     ) {
     this.videoQuotaOptions = [
-      { value: undefined, label: 'Default quota', disabled: true },
-      { value: -1, label: $localize`Unlimited` },
-      { value: undefined, label: '─────', disabled: true },
-      { value: 0, label: $localize`None - no upload possible` },
-      { value: 100 * 1024 * 1024, label: $localize`100MB` },
-      { value: 500 * 1024 * 1024, label: $localize`500MB` },
-      { value: 1024 * 1024 * 1024, label: $localize`1GB` },
-      { value: 5 * 1024 * 1024 * 1024, label: $localize`5GB` },
-      { value: 20 * 1024 * 1024 * 1024, label: $localize`20GB` },
-      { value: 50 * 1024 * 1024 * 1024, label: $localize`50GB` }
+      { id: -1, label: $localize`Unlimited` },
+      { id: 0, label: $localize`None - no upload possible` },
+      { id: 100 * 1024 * 1024, label: $localize`100MB` },
+      { id: 500 * 1024 * 1024, label: $localize`500MB` },
+      { id: 1024 * 1024 * 1024, label: $localize`1GB` },
+      { id: 5 * 1024 * 1024 * 1024, label: $localize`5GB` },
+      { id: 20 * 1024 * 1024 * 1024, label: $localize`20GB` },
+      { id: 50 * 1024 * 1024 * 1024, label: $localize`50GB` },
+      { id: 100 * 1024 * 1024 * 1024, label: $localize`100GB` },
+      { id: 200 * 1024 * 1024 * 1024, label: $localize`200GB` },
+      { id: 500 * 1024 * 1024 * 1024, label: $localize`500GB` }
     ]
 
     this.videoQuotaDailyOptions = [
-      { value: undefined, label: 'Default daily upload limit', disabled: true },
-      { value: -1, label: $localize`Unlimited` },
-      { value: undefined, label: '─────', disabled: true },
-      { value: 0, label: $localize`None - no upload possible` },
-      { value: 10 * 1024 * 1024, label: $localize`10MB` },
-      { value: 50 * 1024 * 1024, label: $localize`50MB` },
-      { value: 100 * 1024 * 1024, label: $localize`100MB` },
-      { value: 500 * 1024 * 1024, label: $localize`500MB` },
-      { value: 2 * 1024 * 1024 * 1024, label: $localize`2GB` },
-      { value: 5 * 1024 * 1024 * 1024, label: $localize`5GB` }
+      { id: -1, label: $localize`Unlimited` },
+      { id: 0, label: $localize`None - no upload possible` },
+      { id: 10 * 1024 * 1024, label: $localize`10MB` },
+      { id: 50 * 1024 * 1024, label: $localize`50MB` },
+      { id: 100 * 1024 * 1024, label: $localize`100MB` },
+      { id: 500 * 1024 * 1024, label: $localize`500MB` },
+      { id: 2 * 1024 * 1024 * 1024, label: $localize`2GB` },
+      { id: 5 * 1024 * 1024 * 1024, label: $localize`5GB` },
+      { id: 10 * 1024 * 1024 * 1024, label: $localize`10GB` },
+      { id: 20 * 1024 * 1024 * 1024, label: $localize`20GB` },
+      { id: 50 * 1024 * 1024 * 1024, label: $localize`50GB` }
     ]
   }
 
index d0aac1cb93f9185f2d9c6b288b47c9c0c9cc3215..da333240cf050265326bf41a668576358f2a63dc 100644 (file)
@@ -45,8 +45,8 @@ export class UserCreateComponent extends UserEdit implements OnInit {
 
     const defaultValues = {
       role: UserRole.USER.toString(),
-      videoQuota: '-1',
-      videoQuotaDaily: '-1'
+      videoQuota: -1,
+      videoQuotaDaily: -1
     }
 
     this.buildForm({
index fb34d6b226367768b787bee24f2d9af603f05fcb..243c6556a5dd9bfd978c6214d2a5e198112771c1 100644 (file)
 
       <div class="form-group">
         <label i18n for="videoQuota">Video quota</label>
-        <div class="peertube-select-container">
-          <select id="videoQuota" formControlName="videoQuota" class="form-control">
-            <option *ngFor="let videoQuotaOption of videoQuotaOptions" [value]="videoQuotaOption.value" [disabled]="videoQuotaOption.disabled">
-              {{ videoQuotaOption.label }}
-            </option>
-          </select>
-        </div>
+
+        <my-select-custom-value
+          id="videoQuota"
+          [items]="videoQuotaOptions"
+          formControlName="videoQuota"
+          i18n-inputSuffix inputSuffix="bytes" inputType="number"
+          [clearable]="false"
+        ></my-select-custom-value>
 
         <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()">
           Transcoding is enabled. The video quota only takes into account <strong>original</strong> video size. <br />
           At most, this user could upload ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}.
         </div>
+
+        <div *ngIf="formErrors.videoQuota" class="form-error">
+          {{ formErrors.videoQuota }}
+        </div>
       </div>
 
       <div class="form-group">
         <label i18n for="videoQuotaDaily">Daily video quota</label>
-        <div class="peertube-select-container">
-          <select id="videoQuotaDaily" formControlName="videoQuotaDaily" class="form-control">
-            <option *ngFor="let videoQuotaDailyOption of videoQuotaDailyOptions" [value]="videoQuotaDailyOption.value" [disabled]="videoQuotaDailyOption.disabled">
-              {{ videoQuotaDailyOption.label }}
-            </option>
-          </select>
+
+        <my-select-custom-value
+          id="videoQuotaDaily"
+          [items]="videoQuotaDailyOptions"
+          formControlName="videoQuotaDaily"
+          i18n-inputSuffix inputSuffix="bytes" inputType="number"
+          [clearable]="false"
+        ></my-select-custom-value>
+
+        <div *ngIf="formErrors.videoQuotaDaily" class="form-error">
+          {{ formErrors.videoQuotaDaily }}
         </div>
       </div>
 
index 3b77150628983b48984f1a8073036bc29555128e..aa87b8d6d308d245123cd4c9d5e543ce25569396 100644 (file)
@@ -1,6 +1,8 @@
 @import '_variables';
 @import '_mixins';
 
+$form-base-input-width: 340px;
+
 label {
   font-weight: $font-regular;
   font-size: 100%;
@@ -15,18 +17,24 @@ label {
 }
 
 input:not([type=submit]) {
-  @include peertube-input-text(340px);
+  @include peertube-input-text($form-base-input-width);
   display: block;
 }
 
 my-input-toggle-hidden {
-  @include responsive-width(340px);
+  @include responsive-width($form-base-input-width);
 
   display: block;
 }
 
 .peertube-select-container {
-  @include peertube-select-container(340px);
+  @include peertube-select-container($form-base-input-width);
+}
+
+my-select-custom-value {
+  @include responsive-width($form-base-input-width);
+
+  display: block;
 }
 
 input[type=submit], button {
index faa2f5ad88c8124562552b1c269b2c21d0c445a2..2fc3c5d3b93330d61fc178b1f1a467abe5e7b05b 100644 (file)
@@ -4,12 +4,13 @@ import { AuthService, ScreenService, ServerService, User } from '@app/core'
 import { FormReactive } from '@app/shared/shared-forms'
 import { USER_ROLE_LABELS } from '@shared/core-utils/users'
 import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models'
+import { SelectOptionsItem } from '../../../../types/select-options-item.model'
 
 @Directive()
 // tslint:disable-next-line: directive-class-suffix
 export abstract class UserEdit extends FormReactive implements OnInit {
-  videoQuotaOptions: { value: string, label: string, disabled?: boolean }[] = []
-  videoQuotaDailyOptions: { value: string, label: string, disabled?: boolean }[] = []
+  videoQuotaOptions: SelectOptionsItem[] = []
+  videoQuotaDailyOptions: SelectOptionsItem[] = []
   username: string
   user: User
 
@@ -97,19 +98,7 @@ export abstract class UserEdit extends FormReactive implements OnInit {
   }
 
   protected buildQuotaOptions () {
-    // These are used by a HTML select, so convert key into strings
-    this.videoQuotaOptions = this.configService
-                                 .videoQuotaOptions.map(q => ({
-                                   value: q.value?.toString(),
-                                   label: q.label,
-                                   disabled: q.disabled
-                                 }))
-
-    this.videoQuotaDailyOptions = this.configService
-                                      .videoQuotaDailyOptions.map(q => ({
-                                        value: q.value?.toString(),
-                                        label: q.label,
-                                        disabled: q.disabled
-                                      }))
+    this.videoQuotaOptions = this.configService.videoQuotaOptions
+    this.videoQuotaDailyOptions = this.configService.videoQuotaDailyOptions
   }
 }
index 40ba23e754f02621de1359863ba0e5267f64bf27..71db0592ae8c471cd70c18c1eedfa2b1163c4ba6 100644 (file)
@@ -1,6 +1,7 @@
-import { FormReactive, SelectChannelItem } from '@app/shared/shared-forms'
+import { FormReactive } from '@app/shared/shared-forms'
 import { VideoConstant, VideoPlaylistPrivacy } from '@shared/models'
 import { VideoPlaylist } from '@shared/models/videos/playlist/video-playlist.model'
+import { SelectChannelItem } from '../../../types/select-options-item.model'
 
 export abstract class MyVideoPlaylistEdit extends FormReactive {
   // Declare it here to avoid errors in create template
index 80b5dce462ac78a4d2e9a0e5a33c04f6bcb32adb..f51f521606ef3c1a8b33d88df98b648ebcbcb118 100644 (file)
@@ -1,5 +1,6 @@
 import { forkJoin } from 'rxjs'
 import { map } from 'rxjs/operators'
+import { SelectChannelItem } from 'src/types/select-options-item.model'
 import { Component, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
 import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms'
 import { HooksService, PluginService, ServerService } from '@app/core'
@@ -17,10 +18,10 @@ import {
   VIDEO_SUPPORT_VALIDATOR,
   VIDEO_TAGS_ARRAY_VALIDATOR
 } from '@app/shared/form-validators/video-validators'
-import { FormReactiveValidationMessages, FormValidatorService, SelectChannelItem } from '@app/shared/shared-forms'
+import { FormReactiveValidationMessages, FormValidatorService } from '@app/shared/shared-forms'
 import { InstanceService } from '@app/shared/shared-instance'
 import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main'
-import { ServerConfig, VideoConstant, LiveVideo, VideoPrivacy } from '@shared/models'
+import { LiveVideo, ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
 import { RegisterClientFormFieldOptions, RegisterClientVideoFieldOptions } from '@shared/models/plugins/register-client-form-field.model'
 import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service'
 import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component'
index 812936d7a4d2549654c81c1e09325b54234c5690..9a22024e5003581b6fd1da8fb338ac223a261004 100644 (file)
@@ -1,8 +1,9 @@
 import { catchError, switchMap, tap } from 'rxjs/operators'
+import { SelectChannelItem } from 'src/types/select-options-item.model'
 import { Directive, EventEmitter, OnInit } from '@angular/core'
 import { AuthService, CanComponentDeactivateResult, Notifier, ServerService } from '@app/core'
 import { populateAsyncUserVideoChannels } from '@app/helpers'
-import { FormReactive, SelectChannelItem } from '@app/shared/shared-forms'
+import { FormReactive } from '@app/shared/shared-forms'
 import { VideoCaptionEdit, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
 import { LoadingBarService } from '@ngx-loading-bar/core'
 import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
index 654901798b8050641af6c4923d29eaee092ad20b..2973c6840619b6c0618b76ab710c3df9f25c627e 100644 (file)
@@ -1,9 +1,10 @@
 import { of } from 'rxjs'
 import { map, switchMap } from 'rxjs/operators'
+import { SelectChannelItem } from 'src/types/select-options-item.model'
 import { Component, HostListener, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
 import { Notifier } from '@app/core'
-import { FormReactive, FormValidatorService, SelectChannelItem } from '@app/shared/shared-forms'
+import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
 import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main'
 import { LiveVideoService } from '@app/shared/shared-video-live'
 import { LoadingBarService } from '@ngx-loading-bar/core'
index b4e26d792e07ea3c17acb5d6ea1f459be814137c..6d7e76b1168d7de3b20900ac61eecc0cb5826a04 100644 (file)
@@ -1,10 +1,10 @@
+import { SelectChannelItem } from 'src/types/select-options-item.model'
 import { DatePipe } from '@angular/common'
 import { HttpErrorResponse } from '@angular/common/http'
 import { Notifier } from '@app/core'
-import { SelectChannelItem } from '@app/shared/shared-forms'
+import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
 import { environment } from '../../environments/environment'
 import { AuthService } from '../core/auth'
-import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
 
 // Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
 function getParameterByName (name: string, url: string) {
index 248a3b1d32c0b22300809b1b39520e6bdf4dacc8..07b1ea075e58e5b5150777054f2aab2635358462 100644 (file)
@@ -10,5 +10,5 @@ export type BuildFormArgument = {
 }
 
 export type BuildFormDefaultValues = {
-  [ name: string ]: string | string[] | BuildFormDefaultValues
+  [ name: string ]: number | string | string[] | BuildFormDefaultValues
 }
index 1d91d59bcb798feac4151efb047627b2ee46435c..40a7c53bb96249cbfb6ce11fab9b47911df5f574 100644 (file)
@@ -1,13 +1,7 @@
-import { Component, forwardRef, Input } from '@angular/core'
+import { Component, forwardRef, Input, OnChanges } from '@angular/core'
 import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
 import { VideoChannel } from '@app/shared/shared-main'
-
-export type SelectChannelItem = {
-  id: number
-  label: string
-  support: string
-  avatarPath?: string
-}
+import { SelectChannelItem } from '../../../../types/select-options-item.model'
 
 @Component({
   selector: 'my-select-channel',
@@ -21,9 +15,10 @@ export type SelectChannelItem = {
     }
   ]
 })
-export class SelectChannelComponent implements ControlValueAccessor {
+export class SelectChannelComponent implements ControlValueAccessor, OnChanges {
   @Input() items: SelectChannelItem[] = []
 
+  channels: SelectChannelItem[] = []
   selectedId: number
 
   // ng-select options
@@ -32,10 +27,14 @@ export class SelectChannelComponent implements ControlValueAccessor {
   clearable = false
   searchable = false
 
-  get channels () {
-    return this.items.map(c => Object.assign(c, {
-      avatarPath: c.avatarPath ? c.avatarPath : VideoChannel.GET_DEFAULT_AVATAR_URL()
-    }))
+  ngOnChanges () {
+    this.channels = this.items.map(c => {
+      const avatarPath = c.avatarPath
+        ? c.avatarPath
+        : VideoChannel.GET_DEFAULT_AVATAR_URL()
+
+      return Object.assign({}, c, { avatarPath })
+    })
   }
 
   propagateChange = (_: any) => { /* empty */ }
index eb0c49034c126dbe4e0f7416d48c3fc68bf16bf4..c2523f15cdfa2ca6f5564559450ccda816326943 100644 (file)
@@ -1,6 +1,6 @@
 import { Component, forwardRef, Input, OnInit } from '@angular/core'
 import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
-import { SelectOptionsItem } from './select-options.component'
+import { SelectOptionsItem } from '../../../../types/select-options-item.model'
 
 export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string
 
index 5fdf432ffd5dd206924ca7e026dea8c628229777..9dc8c2ec20663a18f1ed70ed3b2a6808c7b89804 100644 (file)
@@ -10,5 +10,9 @@
     (ngModelChange)="onModelChange()"
   ></my-select-options>
 
-  <input *ngIf="isCustomValue()" [(ngModel)]="customValue" (ngModelChange)="onModelChange()" type="text" class="form-control" />
+  <ng-container *ngIf="isCustomValue()">
+    <input [(ngModel)]="customValue" (ngModelChange)="onModelChange()" [type]="inputType" class="form-control" />
+
+    <span *ngIf="inputSuffix" class="input-suffix">{{ inputSuffix }}</span>
+  </ng-container>
 </div>
index a8e5ad0d323e4ca0e384362382c42fbbc9853cd9..bc6b863c72a136dbfa8ed6452ca22aa1ca70d506 100644 (file)
@@ -1,6 +1,6 @@
 import { Component, forwardRef, Input, OnChanges } from '@angular/core'
 import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
-import { SelectOptionsItem } from './select-options.component'
+import { SelectOptionsItem } from '../../../../types/select-options-item.model'
 
 @Component({
   selector: 'my-select-custom-value',
@@ -20,6 +20,8 @@ export class SelectCustomValueComponent implements ControlValueAccessor, OnChang
   @Input() searchable = false
   @Input() groupBy: string
   @Input() labelForId: string
+  @Input() inputSuffix: string
+  @Input() inputType = 'text'
 
   customValue: number | string = ''
   selectedId: number | string
index 51a3f515da41de9edfc4b78cefd50310701871e3..2890670e5cda5881109cb54a3f31487b47be147c 100644 (file)
@@ -1,13 +1,6 @@
 import { Component, forwardRef, Input } from '@angular/core'
 import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
-
-export type SelectOptionsItem = {
-  id: string | number
-  label: string
-  description?: string
-  group?: string
-  groupLabel?: string
-}
+import { SelectOptionsItem } from '../../../../types/select-options-item.model'
 
 @Component({
   selector: 'my-select-options',
index 1a4192b55bbbbc7360debc5fbdc52feb7b9b8e03..80196b8df4d31735c0fe57080ffc092bdc54999e 100644 (file)
@@ -33,15 +33,20 @@ ng-select ::ng-deep {
 
 .root {
   display:flex;
+  align-items: center;
 
   > my-select-options {
     flex-grow: 1;
   }
 }
 
-input[type=text] {
+my-select-options + input {
   margin-left: 5px;
 
   @include peertube-input-text($form-base-input-width);
   display: block;
 }
+
+.input-suffix {
+  margin-left: 5px;
+}
index 2497e001c8872944ff87a2bd6746709aeef0bdf7..d74c2b2d827cef6149af754b32561e8bfe1dcf72 100644 (file)
@@ -3,9 +3,10 @@ import { forkJoin, Subject, Subscription } from 'rxjs'
 import { first } from 'rxjs/operators'
 import { Component, Input, OnDestroy, OnInit } from '@angular/core'
 import { AuthService, Notifier, ServerService, User, UserService } from '@app/core'
-import { FormReactive, FormValidatorService, ItemSelectCheckboxValue, SelectOptionsItem } from '@app/shared/shared-forms'
+import { FormReactive, FormValidatorService, ItemSelectCheckboxValue } from '@app/shared/shared-forms'
 import { UserUpdateMe } from '@shared/models'
 import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type'
+import { SelectOptionsItem } from '../../../types/select-options-item.model'
 
 @Component({
   selector: 'my-user-video-settings',
diff --git a/client/src/types/select-options-item.model.ts b/client/src/types/select-options-item.model.ts
new file mode 100644 (file)
index 0000000..895965a
--- /dev/null
@@ -0,0 +1,13 @@
+export interface SelectOptionsItem {
+  id: string | number
+  label: string
+  description?: string
+  group?: string
+  groupLabel?: string
+}
+
+export interface SelectChannelItem extends SelectOptionsItem {
+  id: number
+  support: string
+  avatarPath?: string
+}