+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',
resolutions: { id: string, label: string, description?: string }[] = []
transcodingThreadOptions: { label: string, value: number }[] = []
- languageItems: SelectItem[] = []
- categoryItems: SelectItem[] = []
+ languageItems: SelectOptionsItem[] = []
+ categoryItems: SelectOptionsItem[] = []
private serverConfig: ServerConfig
indexUrl: this.customConfigValidatorsService.INDEX_URL
}
}
+ },
+ broadcastMessage: {
+ enabled: null,
+ 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
+ }
}
}
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
}
)
}
- 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'
([ 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