-import { AuthService, ServerService } from '../../../core'
-import { FormReactive } from '../../../shared'
-import { ServerConfig, USER_ROLE_LABELS, UserRole, VideoResolution } from '../../../../../../shared'
+import { Directive, OnInit } from '@angular/core'
import { ConfigService } from '@app/+admin/config/shared/config.service'
-import { UserAdminFlag } from '@shared/models/users/user-flag.model'
-import { OnInit } from '@angular/core'
-import { User } from '@app/shared/users/user.model'
-import { ScreenService } from '@app/shared/misc/screen.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 { HTMLServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models'
+import { SelectOptionsItem } from '../../../../types/select-options-item.model'
+
+@Directive()
+// tslint:disable-next-line: 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
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()
}
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
}
}
protected buildAdminFlags (formValue: any) {
- return formValue.byPassAutoBlacklist ? UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST : UserAdminFlag.NONE
+ return formValue.byPassAutoBlock ? UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST : UserAdminFlag.NONE
}
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
}
}