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/overview | |
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/overview')
3 files changed, 7 insertions, 28 deletions
diff --git a/client/src/app/+admin/overview/users/user-edit/user-edit.component.html b/client/src/app/+admin/overview/users/user-edit/user-edit.component.html index e484ab8b0..da5879a36 100644 --- a/client/src/app/+admin/overview/users/user-edit/user-edit.component.html +++ b/client/src/app/+admin/overview/users/user-edit/user-edit.component.html | |||
@@ -152,10 +152,7 @@ | |||
152 | [clearable]="false" | 152 | [clearable]="false" |
153 | ></my-select-custom-value> | 153 | ></my-select-custom-value> |
154 | 154 | ||
155 | <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()"> | 155 | <my-user-real-quota-info [videoQuota]="getUserVideoQuota()"></my-user-real-quota-info> |
156 | Transcoding is enabled. The video quota only takes into account <strong>original</strong> video size. <br /> | ||
157 | At most, this user could upload ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}. | ||
158 | </div> | ||
159 | 156 | ||
160 | <div *ngIf="formErrors.videoQuota" class="form-error"> | 157 | <div *ngIf="formErrors.videoQuota" class="form-error"> |
161 | {{ formErrors.videoQuota }} | 158 | {{ formErrors.videoQuota }} |
diff --git a/client/src/app/+admin/overview/users/user-edit/user-edit.component.scss b/client/src/app/+admin/overview/users/user-edit/user-edit.component.scss index 254286ae3..68fa1215f 100644 --- a/client/src/app/+admin/overview/users/user-edit/user-edit.component.scss +++ b/client/src/app/+admin/overview/users/user-edit/user-edit.component.scss | |||
@@ -41,7 +41,8 @@ button { | |||
41 | margin-top: 10px; | 41 | margin-top: 10px; |
42 | } | 42 | } |
43 | 43 | ||
44 | .transcoding-information { | 44 | my-user-real-quota-info { |
45 | display: block; | ||
45 | margin-top: 5px; | 46 | margin-top: 5px; |
46 | font-size: 11px; | 47 | font-size: 11px; |
47 | } | 48 | } |
diff --git a/client/src/app/+admin/overview/users/user-edit/user-edit.ts b/client/src/app/+admin/overview/users/user-edit/user-edit.ts index 395d07423..0ba517edb 100644 --- a/client/src/app/+admin/overview/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/overview/users/user-edit/user-edit.ts | |||
@@ -60,33 +60,14 @@ export abstract class UserEdit extends FormReactive implements OnInit { | |||
60 | ] | 60 | ] |
61 | } | 61 | } |
62 | 62 | ||
63 | isTranscodingInformationDisplayed () { | ||
64 | const formVideoQuota = parseInt(this.form.value['videoQuota'], 10) | ||
65 | |||
66 | return this.serverConfig.transcoding.enabledResolutions.length !== 0 && | ||
67 | formVideoQuota > 0 | ||
68 | } | ||
69 | |||
70 | computeQuotaWithTranscoding () { | ||
71 | const transcodingConfig = this.serverConfig.transcoding | ||
72 | |||
73 | const resolutions = transcodingConfig.enabledResolutions | ||
74 | const higherResolution = VideoResolution.H_4K | ||
75 | let multiplier = 0 | ||
76 | |||
77 | for (const resolution of resolutions) { | ||
78 | multiplier += resolution / higherResolution | ||
79 | } | ||
80 | |||
81 | if (transcodingConfig.hls.enabled) multiplier *= 2 | ||
82 | |||
83 | return multiplier * parseInt(this.form.value['videoQuota'], 10) | ||
84 | } | ||
85 | |||
86 | resetPassword () { | 63 | resetPassword () { |
87 | return | 64 | return |
88 | } | 65 | } |
89 | 66 | ||
67 | getUserVideoQuota () { | ||
68 | return this.form.value['videoQuota'] | ||
69 | } | ||
70 | |||
90 | protected buildAdminFlags (formValue: any) { | 71 | protected buildAdminFlags (formValue: any) { |
91 | return formValue.byPassAutoBlock ? UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST : UserAdminFlag.NONE | 72 | return formValue.byPassAutoBlock ? UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST : UserAdminFlag.NONE |
92 | } | 73 | } |