diff --git a/apps/ui/src/lib/components/Usage.svelte b/apps/ui/src/lib/components/Usage.svelte index 00915b767..66b201da3 100644 --- a/apps/ui/src/lib/components/Usage.svelte +++ b/apps/ui/src/lib/components/Usage.svelte @@ -22,9 +22,9 @@ usage: false, cleanup: false }; - import { appSession } from '$lib/store'; + import { addToast, appSession } from '$lib/store'; import { onDestroy, onMount } from 'svelte'; - import { get } from '$lib/api'; + import { get, post } from '$lib/api'; import { errorNotification } from '$lib/common'; async function getStatus() { if (loading.usage) return; @@ -48,13 +48,36 @@ return errorNotification(error); } }); + async function manuallyCleanupStorage() { + try { + loading.cleanup = true; + await post('/internal/cleanup', {}); + return addToast({ + message: 'Cleanup done.', + type: 'success' + }); + } catch (error) { + return errorNotification(error); + } finally { + loading.cleanup = false; + } + }