mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore(web) Add automatic server stats refetching (#1271)
This commit is contained in:
parent
af2eac52a8
commit
5999af6c78
5 changed files with 71 additions and 42 deletions
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts">
|
||||
import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export let logo: any;
|
||||
export let title: string;
|
||||
|
|
@ -6,8 +8,12 @@
|
|||
export let unit: string | undefined = undefined;
|
||||
|
||||
$: zeros = () => {
|
||||
let result = '';
|
||||
if (!value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const maxLength = 13;
|
||||
let result = '';
|
||||
const valueLength = parseInt(value).toString().length;
|
||||
const zeroLength = maxLength - valueLength;
|
||||
for (let i = 0; i < zeroLength; i++) {
|
||||
|
|
@ -26,9 +32,15 @@
|
|||
</div>
|
||||
|
||||
<div class="relative text-center font-mono font-semibold text-2xl">
|
||||
<span class="text-[#DCDADA] dark:text-[#525252]">{zeros()}</span><span
|
||||
class="text-immich-primary dark:text-immich-dark-primary">{parseInt(value)}</span
|
||||
>
|
||||
{#if value !== undefined}
|
||||
<span class="text-[#DCDADA] dark:text-[#525252]">{zeros()}</span><span
|
||||
class="text-immich-primary dark:text-immich-dark-primary">{parseInt(value)}</span
|
||||
>
|
||||
{:else}
|
||||
<div class="flex justify-end pr-2">
|
||||
<LoadingSpinner />
|
||||
</div>
|
||||
{/if}
|
||||
{#if unit}
|
||||
<span class="absolute -top-5 right-2 text-base font-light text-gray-400">{unit}</span>
|
||||
{/if}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue