X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fconfig%2Fedit-custom-config%2Fedit-custom-config.component.ts;h=00a0bfad201c47633630a8f31657ae52ab4a9423;hb=8c360747995e17eb5520e22fc3d7bd4c3d26eeee;hp=6d59494c88a7192ec8690a5747b24ffeb2a69726;hpb=35b30b643cf9870b0934f34253ffb23cf6a264b0;p=github%2FChocobozzz%2FPeerTube.git 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 6d59494c8..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,16 +1,19 @@ +import { forkJoin } from 'rxjs' +import { ViewportScroller } from '@angular/common' import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' import { ConfigService } from '@app/+admin/config/shared/config.service' -import { ServerService } from '@app/core/server/server.service' -import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared' import { Notifier } from '@app/core' -import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { SelectItem } from 'primeng/api' -import { forkJoin } from 'rxjs' -import { ServerConfig } from '@shared/models' -import { ViewportScroller } from '@angular/common' +import { ServerService } from '@app/core/server/server.service' +import { + CustomConfigValidatorsService, + FormReactive, + FormValidatorService, + SelectOptionsItem, + UserValidatorsService +} from '@app/shared/shared-forms' import { NgbNav } from '@ng-bootstrap/ng-bootstrap' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { CustomConfig, ServerConfig } from '@shared/models' @Component({ selector: 'my-edit-custom-config', @@ -27,8 +30,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A resolutions: { id: string, label: string, description?: string }[] = [] transcodingThreadOptions: { label: string, value: number }[] = [] - languageItems: SelectItem[] = [] - categoryItems: SelectItem[] = [] + languageItems: SelectOptionsItem[] = [] + categoryItems: SelectOptionsItem[] = [] private serverConfig: ServerConfig @@ -221,6 +224,18 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A level: null, dismissable: null, message: null + }, + search: { + remoteUri: { + users: null, + anonymous: null + }, + searchIndex: { + enabled: null, + url: this.customConfigValidatorsService.SEARCH_INDEX_URL, + disableLocalSearch: null, + isDefaultSearch: null + } } } @@ -254,6 +269,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A return this.form.value['signup']['enabled'] === true } + isSearchIndexEnabled () { + return this.form.value['search']['searchIndex']['enabled'] === true + } + isAutoFollowIndexEnabled () { return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true } @@ -276,22 +295,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A ) } - getSelectedLanguageLabel () { - return this.i18n('{{\'{0} languages selected') - } - - getDefaultLanguageLabel () { - return this.i18n('No language') - } - - getSelectedCategoryLabel () { - return this.i18n('{{\'{0} categories selected') - } - - getDefaultCategoryLabel () { - return this.i18n('No category') - } - gotoAnchor () { const hashToNav = { 'customizations': 'advanced-configuration' @@ -317,8 +320,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A ([ config, languages, categories ]) => { this.customConfig = config - this.languageItems = languages.map(l => ({ label: l.label, value: l.id })) - this.categoryItems = categories.map(l => ({ label: l.label, value: l.id })) + this.languageItems = languages.map(l => ({ label: l.label, id: l.id })) + this.categoryItems = categories.map(l => ({ label: l.label, id: l.id + '' })) this.updateForm() // Force form validation