diff options
author | Chocobozzz <me@florianbigard.com> | 2022-09-28 13:59:23 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-09-28 14:04:06 +0200 |
commit | f67ac646a2c081e02b28a7ab1dc856db6ee20e2f (patch) | |
tree | 4bd19f2eb58d835aac0f58c44941197a402e5cab /client/src/app/+admin/config/edit-custom-config | |
parent | b0d6a800f84ac16fe541b1f098defe862d09069a (diff) | |
download | PeerTube-f67ac646a2c081e02b28a7ab1dc856db6ee20e2f.tar.gz PeerTube-f67ac646a2c081e02b28a7ab1dc856db6ee20e2f.tar.zst PeerTube-f67ac646a2c081e02b28a7ab1dc856db6ee20e2f.zip |
Put video quota info in its own component
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config')
3 files changed, 11 insertions, 26 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html index 728185195..43f1438e0 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html | |||
@@ -218,10 +218,7 @@ | |||
218 | [clearable]="false" | 218 | [clearable]="false" |
219 | ></my-select-custom-value> | 219 | ></my-select-custom-value> |
220 | 220 | ||
221 | <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()"> | 221 | <my-user-real-quota-info [videoQuota]="getUserVideoQuota()"></my-user-real-quota-info> |
222 | Transcoding is enabled. The video quota only takes into account <strong>original</strong> video size. <br /> | ||
223 | At most, a user could upload ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}. | ||
224 | </div> | ||
225 | 222 | ||
226 | <div *ngIf="formErrors.user.videoQuota" class="form-error">{{ formErrors.user.videoQuota }}</div> | 223 | <div *ngIf="formErrors.user.videoQuota" class="form-error">{{ formErrors.user.videoQuota }}</div> |
227 | </div> | 224 | </div> |
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 dc7802b2c..f7de4c7de 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 | |||
@@ -60,6 +60,10 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges { | |||
60 | return !!enabled.find((e: string) => e === algorithm) | 60 | return !!enabled.find((e: string) => e === algorithm) |
61 | } | 61 | } |
62 | 62 | ||
63 | getUserVideoQuota () { | ||
64 | return this.form.value['user']['videoQuota'] | ||
65 | } | ||
66 | |||
63 | isSignupEnabled () { | 67 | isSignupEnabled () { |
64 | return this.form.value['signup']['enabled'] === true | 68 | return this.form.value['signup']['enabled'] === true |
65 | } | 69 | } |
@@ -92,28 +96,6 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges { | |||
92 | return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true | 96 | return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true |
93 | } | 97 | } |
94 | 98 | ||
95 | computeQuotaWithTranscoding () { | ||
96 | const transcodingConfig = this.serverConfig.transcoding | ||
97 | |||
98 | const resolutions = transcodingConfig.enabledResolutions | ||
99 | const higherResolution = VideoResolution.H_4K | ||
100 | let multiplier = 0 | ||
101 | |||
102 | for (const resolution of resolutions) { | ||
103 | multiplier += resolution / higherResolution | ||
104 | } | ||
105 | |||
106 | if (transcodingConfig.hls.enabled) multiplier *= 2 | ||
107 | |||
108 | return multiplier * parseInt(this.form.value['user']['videoQuota'], 10) | ||
109 | } | ||
110 | |||
111 | isTranscodingInformationDisplayed () { | ||
112 | const formVideoQuota = parseInt(this.form.value['user']['videoQuota'], 10) | ||
113 | return this.serverConfig.transcoding.enabledResolutions.length !== 0 && | ||
114 | formVideoQuota > 0 | ||
115 | } | ||
116 | |||
117 | buildLandingPageOptions () { | 99 | buildLandingPageOptions () { |
118 | this.defaultLandingPageOptions = this.menuService.buildCommonLinks(this.serverConfig) | 100 | this.defaultLandingPageOptions = this.menuService.buildCommonLinks(this.serverConfig) |
119 | .links | 101 | .links |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss index dda5d0b5e..764e626ec 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss | |||
@@ -150,3 +150,9 @@ ngb-tabset:not(.previews) ::ng-deep { | |||
150 | padding: 0 .3em; | 150 | padding: 0 .3em; |
151 | } | 151 | } |
152 | } | 152 | } |
153 | |||
154 | my-user-real-quota-info { | ||
155 | display: block; | ||
156 | margin-top: 5px; | ||
157 | font-size: 11px; | ||
158 | } | ||