-import { Component, OnInit, AfterViewChecked, ViewChild } from '@angular/core'
+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 { forkJoin } from 'rxjs'
import { ServerConfig } from '@shared/models'
import { ViewportScroller } from '@angular/common'
-import { NgbTabset } from '@ng-bootstrap/ng-bootstrap'
+import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
@Component({
selector: 'my-edit-custom-config',
styleUrls: [ './edit-custom-config.component.scss' ]
})
export class EditCustomConfigComponent extends FormReactive implements OnInit, AfterViewChecked {
- @ViewChild('tabs') tabs: NgbTabset
+ // FIXME: use built-in router
+ @ViewChild('nav') nav: NgbNav
initDone = false
customConfig: CustomConfig
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
}
}
gotoAnchor () {
- const hashToTab = {
+ const hashToNav = {
'customizations': 'advanced-configuration'
}
const hash = window.location.hash.replace('#', '')
- if (hash && Object.keys(hashToTab).includes(hash)) {
- this.tabs.select(hashToTab[hash])
+ if (hash && Object.keys(hashToNav).includes(hash)) {
+ this.nav.select(hashToNav[hash])
setTimeout(() => this.viewportScroller.scrollToAnchor(hash), 100)
}
}