chore(web): quota enhancement (#6371)

* chore(web): quota enhancement

* show quota in user table

* update quota for single user ioption

* Add a note how to set unlimited storage

* fixed deletion doesn't update quota

* refactor relation

* fixed test

* re-refactor

* update sql

* fix e2e test

* Update server/src/domain/user/user.service.ts

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>

* revert e2e test

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Alex
2024-01-15 09:04:29 -06:00
committed by GitHub
parent 2a8cb70c98
commit d096caccac
10 changed files with 183 additions and 128 deletions

View File

@@ -104,6 +104,7 @@
<div class="m-4 flex flex-col gap-2">
<label class="immich-form-label" for="quotaSize">Quota Size (GB)</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>
<div class="m-4 flex flex-col gap-2">

View File

@@ -14,6 +14,7 @@
import type { PageData } from './$types';
import { mdiCheck, mdiClose, mdiDeleteRestore, mdiPencilOutline, mdiTrashCanOutline } from '@mdi/js';
import { user } from '$lib/stores/user.store';
import { asByteUnitString } from '$lib/utils/byte-units';
export let data: PageData;
@@ -171,6 +172,7 @@
<tr class="flex w-full place-items-center">
<th class="w-8/12 sm:w-5/12 lg:w-6/12 xl:w-4/12 2xl:w-5/12 text-center text-sm font-medium">Email</th>
<th class="hidden sm:block w-3/12 text-center text-sm font-medium">Name</th>
<th class="hidden xl:block w-3/12 2xl:w-2/12 text-center text-sm font-medium">Has quota</th>
<th class="hidden xl:block w-3/12 2xl:w-2/12 text-center text-sm font-medium">Can import</th>
<th class="w-4/12 lg:w-3/12 xl:w-2/12 text-center text-sm font-medium">Action</th>
</tr>
@@ -191,6 +193,15 @@
>{immichUser.email}</td
>
<td class="hidden sm:block w-3/12 text-ellipsis break-all px-2 text-sm">{immichUser.name}</td>
<td class="hidden xl:block w-3/12 2xl:w-2/12 text-ellipsis break-all px-2 text-sm">
<div class="container mx-auto flex flex-wrap justify-center">
{#if immichUser.quotaSizeInBytes && immichUser.quotaSizeInBytes > 0}
{asByteUnitString(immichUser.quotaSizeInBytes, $locale)}
{:else}
<Icon path={mdiClose} size="16" />
{/if}
</div>
</td>
<td class="hidden xl:block w-3/12 2xl:w-2/12 text-ellipsis break-all px-2 text-sm">
<div class="container mx-auto flex flex-wrap justify-center">
{#if immichUser.externalPath}
@@ -200,6 +211,7 @@
{/if}
</div>
</td>
<td class="w-4/12 lg:w-3/12 xl:w-2/12 text-ellipsis break-all px-4 text-sm">
{#if !isDeleted(immichUser)}
<button