X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fusers%2Fuser-edit%2Fuser-edit.ts;h=af5e674a7df718b6df9c282c44090f0ab16ebec5;hb=9df52d660feb722404be00a50f3c8a612bec1c15;hp=1613bb0d1f921655b684cc91d44ec1c1b9ed911a;hpb=1acb94750408490ce89264f92a14aceeffe81c96;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 1613bb0d1..af5e674a7 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -3,19 +3,20 @@ import { ConfigService } from '@app/+admin/config/shared/config.service' import { AuthService, ScreenService, ServerService, User } from '@app/core' import { FormReactive } from '@app/shared/shared-forms' import { USER_ROLE_LABELS } from '@shared/core-utils/users' -import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' +import { HTMLServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' +import { SelectOptionsItem } from '../../../../types/select-options-item.model' @Directive() -// tslint:disable-next-line: directive-class-suffix +// eslint-disable-next-line @angular-eslint/directive-class-suffix export abstract class UserEdit extends FormReactive implements OnInit { - videoQuotaOptions: { value: string, label: string, disabled?: boolean }[] = [] - videoQuotaDailyOptions: { value: string, label: string, disabled?: boolean }[] = [] + videoQuotaOptions: SelectOptionsItem[] = [] + videoQuotaDailyOptions: SelectOptionsItem[] = [] username: string user: User roles: { value: string, label: string }[] = [] - protected serverConfig: ServerConfig + protected serverConfig: HTMLServerConfig protected abstract serverService: ServerService protected abstract configService: ConfigService @@ -25,9 +26,7 @@ export abstract class UserEdit extends FormReactive implements OnInit { abstract getFormButtonTitle (): string ngOnInit (): void { - this.serverConfig = this.serverService.getTmpConfig() - this.serverService.getConfig() - .subscribe(config => this.serverConfig = config) + this.serverConfig = this.serverService.getHTMLConfig() this.buildRoles() } @@ -42,6 +41,11 @@ export abstract class UserEdit extends FormReactive implements OnInit { return forAccount + forChannels } + getAuthPlugins () { + return this.serverConfig.plugin.registeredIdAndPassAuths.map(p => p.npmName) + .concat(this.serverConfig.plugin.registeredExternalAuths.map(p => p.npmName)) + } + isInBigView () { return this.screenService.getWindowInnerWidth() > 1600 } @@ -92,19 +96,7 @@ export abstract class UserEdit extends FormReactive implements OnInit { } protected buildQuotaOptions () { - // These are used by a HTML select, so convert key into strings - this.videoQuotaOptions = this.configService - .videoQuotaOptions.map(q => ({ - value: q.value?.toString(), - label: q.label, - disabled: q.disabled - })) - - this.videoQuotaDailyOptions = this.configService - .videoQuotaDailyOptions.map(q => ({ - value: q.value?.toString(), - label: q.label, - disabled: q.disabled - })) + this.videoQuotaOptions = this.configService.videoQuotaOptions + this.videoQuotaDailyOptions = this.configService.videoQuotaDailyOptions } }