X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fconfig%2Fedit-custom-config%2Fedit-basic-configuration.component.ts;h=bac1015fc4e3b37174895f2a227209f0dc104716;hb=2989628b7913383b39ac34c7db8666a21f8e5037;hp=9a19c2913dfd602dbfad4fe4dcfa6280f1fbced7;hpb=5f46d28ccac4a20fcbb12c96a047a84a08e485ae;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts index 9a19c2913..bac1015fc 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts @@ -1,8 +1,9 @@ - import { pairwise } from 'rxjs/operators' -import { Component, Input, OnInit } from '@angular/core' +import { SelectOptionsItem } from 'src/types/select-options-item.model' +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' import { FormGroup } from '@angular/forms' -import { ServerConfig } from '@shared/models' +import { MenuService } from '@app/core' +import { HTMLServerConfig } from '@shared/models' import { ConfigService } from '../shared/config.service' @Component({ @@ -10,22 +11,31 @@ import { ConfigService } from '../shared/config.service' templateUrl: './edit-basic-configuration.component.html', styleUrls: [ './edit-custom-config.component.scss' ] }) -export class EditBasicConfigurationComponent implements OnInit { +export class EditBasicConfigurationComponent implements OnInit, OnChanges { @Input() form: FormGroup @Input() formErrors: any - @Input() serverConfig: ServerConfig + @Input() serverConfig: HTMLServerConfig signupAlertMessage: string + defaultLandingPageOptions: SelectOptionsItem[] = [] constructor ( - private configService: ConfigService + private configService: ConfigService, + private menuService: MenuService ) { } ngOnInit () { + this.buildLandingPageOptions() this.checkSignupField() } + ngOnChanges (changes: SimpleChanges) { + if (changes['serverConfig']) { + this.buildLandingPageOptions() + } + } + getVideoQuotaOptions () { return this.configService.videoQuotaOptions } @@ -50,14 +60,35 @@ export class EditBasicConfigurationComponent implements OnInit { return this.form.value['signup']['enabled'] === true } + getDisabledSignupClass () { + return { 'disabled-checkbox-extra': !this.isSignupEnabled() } + } + + hasUnlimitedSignup () { + return this.form.value['signup']['limit'] === -1 + } + isSearchIndexEnabled () { return this.form.value['search']['searchIndex']['enabled'] === true } + getDisabledSearchIndexClass () { + return { 'disabled-checkbox-extra': !this.isSearchIndexEnabled() } + } + isAutoFollowIndexEnabled () { return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true } + buildLandingPageOptions () { + this.defaultLandingPageOptions = this.menuService.buildCommonLinks(this.serverConfig) + .map(o => ({ + id: o.path, + label: o.label, + description: o.path + })) + } + private checkSignupField () { const signupControl = this.form.get('signup.enabled')