mirror of https://github.com/immich-app/immich.git
chore(web) Add automatic server stats refetching (#1271)
parent
af2eac52a8
commit
5999af6c78
@ -1,29 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ServerStatsPanel from '$lib/components/admin-page/server-stats/server-stats-panel.svelte';
|
import ServerStatsPanel from '$lib/components/admin-page/server-stats/server-stats-panel.svelte';
|
||||||
import { api, ServerStatsResponseDto } from '@api';
|
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
|
|
||||||
let serverStat: ServerStatsResponseDto;
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
getServerStats();
|
|
||||||
});
|
|
||||||
|
|
||||||
const getServerStats = async () => {
|
|
||||||
try {
|
|
||||||
const res = await api.serverInfoApi.getStats();
|
|
||||||
serverStat = res.data;
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>Server Status - Immich</title>
|
<title>Server Status - Immich</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
{#if $page.data.allUsers && serverStat}
|
{#if $page.data.allUsers}
|
||||||
<ServerStatsPanel stats={serverStat} allUsers={$page.data.allUsers} />
|
<ServerStatsPanel allUsers={$page.data.allUsers} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Loading…
Reference in New Issue