aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-11 16:07:53 +0200
committerChocobozzz <me@florianbigard.com>2020-08-11 16:18:42 +0200
commit52c4976fcf4ee255a3af68ff9778e4f5c4f84bd4 (patch)
tree887d2b6106548ad23cf016d82baf1977198027d9 /client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
parent3d25d5de33d8aa0ba00d7514522b25d22bf0e0a1 (diff)
downloadPeerTube-52c4976fcf4ee255a3af68ff9778e4f5c4f84bd4.tar.gz
PeerTube-52c4976fcf4ee255a3af68ff9778e4f5c4f84bd4.tar.zst
PeerTube-52c4976fcf4ee255a3af68ff9778e4f5c4f84bd4.zip
Use ng select for multiselect
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts33
1 files changed, 11 insertions, 22 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
index 69629770f..00a0bfad2 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
@@ -1,11 +1,16 @@
1import { SelectItem } from 'primeng/api'
2import { forkJoin } from 'rxjs' 1import { forkJoin } from 'rxjs'
3import { ViewportScroller } from '@angular/common' 2import { ViewportScroller } from '@angular/common'
4import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' 3import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core'
5import { ConfigService } from '@app/+admin/config/shared/config.service' 4import { ConfigService } from '@app/+admin/config/shared/config.service'
6import { Notifier } from '@app/core' 5import { Notifier } from '@app/core'
7import { ServerService } from '@app/core/server/server.service' 6import { ServerService } from '@app/core/server/server.service'
8import { CustomConfigValidatorsService, FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' 7import {
8 CustomConfigValidatorsService,
9 FormReactive,
10 FormValidatorService,
11 SelectOptionsItem,
12 UserValidatorsService
13} from '@app/shared/shared-forms'
9import { NgbNav } from '@ng-bootstrap/ng-bootstrap' 14import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
10import { I18n } from '@ngx-translate/i18n-polyfill' 15import { I18n } from '@ngx-translate/i18n-polyfill'
11import { CustomConfig, ServerConfig } from '@shared/models' 16import { CustomConfig, ServerConfig } from '@shared/models'
@@ -25,8 +30,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
25 resolutions: { id: string, label: string, description?: string }[] = [] 30 resolutions: { id: string, label: string, description?: string }[] = []
26 transcodingThreadOptions: { label: string, value: number }[] = [] 31 transcodingThreadOptions: { label: string, value: number }[] = []
27 32
28 languageItems: SelectItem[] = [] 33 languageItems: SelectOptionsItem[] = []
29 categoryItems: SelectItem[] = [] 34 categoryItems: SelectOptionsItem[] = []
30 35
31 private serverConfig: ServerConfig 36 private serverConfig: ServerConfig
32 37
@@ -290,22 +295,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
290 ) 295 )
291 } 296 }
292 297
293 getSelectedLanguageLabel () {
294 return this.i18n('{{\'{0} languages selected')
295 }
296
297 getDefaultLanguageLabel () {
298 return this.i18n('No language')
299 }
300
301 getSelectedCategoryLabel () {
302 return this.i18n('{{\'{0} categories selected')
303 }
304
305 getDefaultCategoryLabel () {
306 return this.i18n('No category')
307 }
308
309 gotoAnchor () { 298 gotoAnchor () {
310 const hashToNav = { 299 const hashToNav = {
311 'customizations': 'advanced-configuration' 300 'customizations': 'advanced-configuration'
@@ -331,8 +320,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
331 ([ config, languages, categories ]) => { 320 ([ config, languages, categories ]) => {
332 this.customConfig = config 321 this.customConfig = config
333 322
334 this.languageItems = languages.map(l => ({ label: l.label, value: l.id })) 323 this.languageItems = languages.map(l => ({ label: l.label, id: l.id }))
335 this.categoryItems = categories.map(l => ({ label: l.label, value: l.id })) 324 this.categoryItems = categories.map(l => ({ label: l.label, id: l.id + '' }))
336 325
337 this.updateForm() 326 this.updateForm()
338 // Force form validation 327 // Force form validation