PluginSearchComponent,
PluginShowInstalledComponent
} from './plugins'
+import { SharedAdminModule } from './shared'
import { JobService, LogsComponent, LogsService } from './system'
import { DebugComponent, DebugService } from './system/debug'
import { JobsComponent } from './system/jobs/jobs.component'
SharedVideoMiniatureModule,
SharedTablesModule,
SharedUsersModule,
+ SharedAdminModule,
TableModule,
ChartModule
[clearable]="false"
></my-select-custom-value>
- <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()">
- Transcoding is enabled. The video quota only takes into account <strong>original</strong> video size. <br />
- At most, a user could upload ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}.
- </div>
+ <my-user-real-quota-info [videoQuota]="getUserVideoQuota()"></my-user-real-quota-info>
<div *ngIf="formErrors.user.videoQuota" class="form-error">{{ formErrors.user.videoQuota }}</div>
</div>
return !!enabled.find((e: string) => e === algorithm)
}
+ getUserVideoQuota () {
+ return this.form.value['user']['videoQuota']
+ }
+
isSignupEnabled () {
return this.form.value['signup']['enabled'] === true
}
return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true
}
- computeQuotaWithTranscoding () {
- const transcodingConfig = this.serverConfig.transcoding
-
- const resolutions = transcodingConfig.enabledResolutions
- const higherResolution = VideoResolution.H_4K
- let multiplier = 0
-
- for (const resolution of resolutions) {
- multiplier += resolution / higherResolution
- }
-
- if (transcodingConfig.hls.enabled) multiplier *= 2
-
- return multiplier * parseInt(this.form.value['user']['videoQuota'], 10)
- }
-
- isTranscodingInformationDisplayed () {
- const formVideoQuota = parseInt(this.form.value['user']['videoQuota'], 10)
- return this.serverConfig.transcoding.enabledResolutions.length !== 0 &&
- formVideoQuota > 0
- }
-
buildLandingPageOptions () {
this.defaultLandingPageOptions = this.menuService.buildCommonLinks(this.serverConfig)
.links
padding: 0 .3em;
}
}
+
+my-user-real-quota-info {
+ display: block;
+ margin-top: 5px;
+ font-size: 11px;
+}
[clearable]="false"
></my-select-custom-value>
- <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()">
- Transcoding is enabled. The video quota only takes into account <strong>original</strong> video size. <br />
- At most, this user could upload ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}.
- </div>
+ <my-user-real-quota-info [videoQuota]="getUserVideoQuota()"></my-user-real-quota-info>
<div *ngIf="formErrors.videoQuota" class="form-error">
{{ formErrors.videoQuota }}
margin-top: 10px;
}
-.transcoding-information {
+my-user-real-quota-info {
+ display: block;
margin-top: 5px;
font-size: 11px;
}
]
}
- isTranscodingInformationDisplayed () {
- const formVideoQuota = parseInt(this.form.value['videoQuota'], 10)
-
- return this.serverConfig.transcoding.enabledResolutions.length !== 0 &&
- formVideoQuota > 0
- }
-
- computeQuotaWithTranscoding () {
- const transcodingConfig = this.serverConfig.transcoding
-
- const resolutions = transcodingConfig.enabledResolutions
- const higherResolution = VideoResolution.H_4K
- let multiplier = 0
-
- for (const resolution of resolutions) {
- multiplier += resolution / higherResolution
- }
-
- if (transcodingConfig.hls.enabled) multiplier *= 2
-
- return multiplier * parseInt(this.form.value['videoQuota'], 10)
- }
-
resetPassword () {
return
}
+ getUserVideoQuota () {
+ return this.form.value['videoQuota']
+ }
+
protected buildAdminFlags (formValue: any) {
return formValue.byPassAutoBlock ? UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST : UserAdminFlag.NONE
}
--- /dev/null
+export * from './user-real-quota-info.component'
+
+export * from './shared-admin.module'
--- /dev/null
+import { NgModule } from '@angular/core'
+import { SharedMainModule } from '../../shared/shared-main/shared-main.module'
+import { UserRealQuotaInfoComponent } from './user-real-quota-info.component'
+
+@NgModule({
+ imports: [
+ SharedMainModule
+ ],
+
+ declarations: [
+ UserRealQuotaInfoComponent
+ ],
+
+ exports: [
+ UserRealQuotaInfoComponent
+ ],
+
+ providers: []
+})
+export class SharedAdminModule { }
--- /dev/null
+<div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()">
+ The video quota only takes into account <strong>original</strong> video size. <br />
+ Since transcoding is enabled, videos size can be at most ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}.
+</div>
--- /dev/null
+@use '_variables' as *;
+@use '_mixins' as *;
--- /dev/null
+import { Component, Input, OnInit } from '@angular/core'
+import { ServerService } from '@app/core'
+import { HTMLServerConfig, VideoResolution } from '@shared/models/index'
+
+@Component({
+ selector: 'my-user-real-quota-info',
+ templateUrl: './user-real-quota-info.component.html',
+ styleUrls: [ './user-real-quota-info.component.scss' ]
+})
+export class UserRealQuotaInfoComponent implements OnInit {
+ @Input() videoQuota: number | string
+
+ private serverConfig: HTMLServerConfig
+
+ constructor (private server: ServerService) { }
+
+ ngOnInit () {
+ this.serverConfig = this.server.getHTMLConfig()
+ }
+
+ isTranscodingInformationDisplayed () {
+ return this.serverConfig.transcoding.enabledResolutions.length !== 0 && this.getQuotaAsNumber() > 0
+ }
+
+ computeQuotaWithTranscoding () {
+ const transcodingConfig = this.serverConfig.transcoding
+
+ const resolutions = transcodingConfig.enabledResolutions
+ const higherResolution = VideoResolution.H_4K
+ let multiplier = 0
+
+ for (const resolution of resolutions) {
+ multiplier += resolution / higherResolution
+ }
+
+ if (transcodingConfig.hls.enabled) multiplier *= 2
+
+ return multiplier * this.getQuotaAsNumber()
+ }
+
+ private getQuotaAsNumber () {
+ return parseInt(this.videoQuota + '', 10)
+ }
+}