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=8fa4b063501610af16c0c6b550c4f06e8cee3d43;hpb=67ed6552b831df66713bac9e672738796128d33f;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 8fa4b0635..af5e674a7 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -1,18 +1,22 @@ -import { OnInit } from '@angular/core' +import { Directive, OnInit } from '@angular/core' 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 { ServerConfig, USER_ROLE_LABELS, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' +import { USER_ROLE_LABELS } from '@shared/core-utils/users' +import { HTMLServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' +import { SelectOptionsItem } from '../../../../types/select-options-item.model' +@Directive() +// 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 @@ -22,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() } @@ -39,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 } @@ -89,24 +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 - })) - - console.log( - this.videoQuotaOptions, - this.videoQuotaDailyOptions - ) + this.videoQuotaOptions = this.configService.videoQuotaOptions + this.videoQuotaDailyOptions = this.configService.videoQuotaDailyOptions } }