fix(server): Server freezes when getting statistic (#994)

* fix(server): Server freezes when getting statistic
* remove dead code
This commit is contained in:
Alex 2022-11-20 13:09:31 -06:00 committed by GitHub
parent b3e51cc849
commit 41ffa0c015
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 187 additions and 259 deletions

View file

@ -2,7 +2,6 @@
import { ServerStatsResponseDto, UserResponseDto } from '@api';
import CameraIris from 'svelte-material-icons/CameraIris.svelte';
import PlayCircle from 'svelte-material-icons/PlayCircle.svelte';
import FileImageOutline from 'svelte-material-icons/FileImageOutline.svelte';
import Memory from 'svelte-material-icons/Memory.svelte';
import StatsCard from './stats-card.svelte';
export let stats: ServerStatsResponseDto;
@ -27,7 +26,6 @@
<div class="flex mt-5 justify-between">
<StatsCard logo={CameraIris} title={'PHOTOS'} value={stats.photos.toString()} />
<StatsCard logo={PlayCircle} title={'VIDEOS'} value={stats.videos.toString()} />
<StatsCard logo={FileImageOutline} title={'OBJECTS'} value={stats.objects.toString()} />
<StatsCard logo={Memory} title={'STORAGE'} value={spaceUsage} unit={spaceUnit} />
</div>
</div>
@ -39,11 +37,10 @@
class="border rounded-md mb-4 bg-gray-50 dark:bg-immich-dark-gray dark:border-immich-dark-gray flex text-immich-primary dark:text-immich-dark-primary w-full h-12"
>
<tr class="flex w-full place-items-center">
<th class="text-center w-1/5 font-medium text-sm">User</th>
<th class="text-center w-1/5 font-medium text-sm">Photos</th>
<th class="text-center w-1/5 font-medium text-sm">Videos</th>
<th class="text-center w-1/5 font-medium text-sm">Objects</th>
<th class="text-center w-1/5 font-medium text-sm">Size</th>
<th class="text-center w-1/4 font-medium text-sm">User</th>
<th class="text-center w-1/4 font-medium text-sm">Photos</th>
<th class="text-center w-1/4 font-medium text-sm">Videos</th>
<th class="text-center w-1/4 font-medium text-sm">Size</th>
</tr>
</thead>
<tbody
@ -57,11 +54,10 @@
: 'bg-immich-bg dark:bg-immich-dark-gray/50'
}`}
>
<td class="text-sm px-2 w-1/5 text-ellipsis">{getFullName(user.userId)}</td>
<td class="text-sm px-2 w-1/5 text-ellipsis">{user.photos}</td>
<td class="text-sm px-2 w-1/5 text-ellipsis">{user.videos}</td>
<td class="text-sm px-2 w-1/5 text-ellipsis">{user.objects}</td>
<td class="text-sm px-2 w-1/5 text-ellipsis">{user.usage}</td>
<td class="text-sm px-2 w-1/4 text-ellipsis">{getFullName(user.userId)}</td>
<td class="text-sm px-2 w-1/4 text-ellipsis">{user.photos}</td>
<td class="text-sm px-2 w-1/4 text-ellipsis">{user.videos}</td>
<td class="text-sm px-2 w-1/4 text-ellipsis">{user.usage}</td>
</tr>
{/each}
</tbody>

View file

@ -7,7 +7,7 @@
$: zeros = () => {
let result = '';
const maxLength = 9;
const maxLength = 13;
const valueLength = parseInt(value).toString().length;
const zeroLength = maxLength - valueLength;
for (let i = 0; i < zeroLength; i++) {
@ -18,7 +18,7 @@
</script>
<div
class="w-[180px] h-[140px] bg-immich-gray dark:bg-immich-dark-gray rounded-3xl p-5 flex flex-col justify-between"
class="w-[250px] h-[140px] bg-immich-gray dark:bg-immich-dark-gray rounded-3xl p-5 flex flex-col justify-between"
>
<div class="flex place-items-center gap-4 text-immich-primary dark:text-immich-dark-primary">
<svelte:component this={logo} size="40" />