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:
martin
2024-01-30 18:21:45 +01:00
committed by GitHub
parent 4290a29107
commit 7a1f25b515
6 changed files with 41 additions and 27 deletions

View File

@@ -5,6 +5,7 @@
import { notificationController, NotificationType } from '../shared-components/notification/notification';
import Button from '../elements/buttons/button.svelte';
import { convertToBytes } from '$lib/utils/byte-converter';
import { serverInfo } from '$lib/stores/server-info.store';
let error: string;
let success: string;
@@ -13,9 +14,11 @@
let confirmPassowrd = '';
let canCreateUser = false;
let quotaSize: number | undefined = undefined;
let isCreatingUser = false;
$: quotaSizeWarning = quotaSize && convertToBytes(Number(quotaSize), 'GiB') > $serverInfo.diskSizeRaw;
$: {
if (password !== confirmPassowrd && confirmPassowrd.length > 0) {
error = 'Password does not match';
@@ -121,8 +124,12 @@
</div>
<div class="m-4 flex flex-col gap-2">
<label class="immich-form-label" for="quotaSize">Quota Size (GiB)</label>
<input class="immich-form-input" id="quotaSize" name="quotaSize" type="number" min="0" />
<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} />
</div>
{#if error}