You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-07-13 07:00:55 +02:00
feat(web): add warning when setting a quota superior to the disk size (#6737)
* refactor: inline warning * fix: do not use onmount * chore: remove outdated comment * wording --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@ -10,14 +10,22 @@
|
||||
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
||||
import { handleError } from '$lib/utils/handle-error';
|
||||
import { convertFromBytes, convertToBytes } from '$lib/utils/byte-converter';
|
||||
import { serverInfo } from '$lib/stores/server-info.store';
|
||||
|
||||
export let user: UserResponseDto;
|
||||
export let canResetPassword = true;
|
||||
|
||||
let error: string;
|
||||
let success: string;
|
||||
|
||||
let isShowResetPasswordConfirmation = false;
|
||||
let quotaSize = user.quotaSizeInBytes ? convertFromBytes(user.quotaSizeInBytes, 'GiB') : null;
|
||||
|
||||
const previousQutoa = user.quotaSizeInBytes;
|
||||
|
||||
$: quotaSizeWarning =
|
||||
previousQutoa !== convertToBytes(Number(quotaSize), 'GiB') &&
|
||||
!!quotaSize &&
|
||||
convertToBytes(Number(quotaSize), 'GiB') > $serverInfo.diskSizeRaw;
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
close: void;
|
||||
@ -25,8 +33,6 @@
|
||||
editSuccess: void;
|
||||
}>();
|
||||
|
||||
let quotaSize = user.quotaSizeInBytes ? convertFromBytes(user.quotaSizeInBytes, 'GiB') : null;
|
||||
|
||||
const editUser = async () => {
|
||||
try {
|
||||
const { id, email, name, storageLabel, externalPath } = user;
|
||||
@ -102,7 +108,11 @@
|
||||
</div>
|
||||
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="quotaSize">Quota Size (GiB)</label>
|
||||
<label class="flex items-center gap-2 immich-form-label" for="quotaSize"
|
||||
>Quota Size (GiB) {#if quotaSizeWarning}
|
||||
<p class="text-red-400 text-sm">You set a quota higher than the disk size</p>
|
||||
{/if}</label
|
||||
>
|
||||
<input class="immich-form-input" id="quotaSize" name="quotaSize" type="number" min="0" bind:value={quotaSize} />
|
||||
<p>Note: Enter 0 for unlimited quota</p>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user