added some nice graphs to the tasks

This commit is contained in:
2024-04-18 15:01:36 +01:00
parent f41cdf78df
commit 2fa7680d0b
13 changed files with 407 additions and 75 deletions

View File

@@ -2,12 +2,12 @@
import { createEventDispatcher } from 'svelte';
import type { Model } from './+page.svelte';
import ModelData from './ModelData.svelte';
import { post } from 'src/lib/requests.svelte';
import { post, showMessage } from 'src/lib/requests.svelte';
import ModelDataPageStatsGraph from './ModelDataPageStatsGraph.svelte';
import type { ModelStats } from './types';
import DeleteZip from './DeleteZip.svelte';
let { model, active } = $props<{ model: Model; active?: boolean }>();
let { model, active }: { model: Model; active?: boolean } = $props();
const dispatch = createEventDispatcher<{ reload: void }>();
@@ -21,26 +21,28 @@
if (!model) return;
try {
stats = await post(`models/class/stats`, { id: model.id });
} catch {
return;
} catch (e) {
showMessage(e);
}
}
</script>
<div class="content" class:selected={active}>
{#if stats}
<ModelDataPageStatsGraph data={stats} />
{/if}
{#if active}
<div class="content selected">
{#if stats}
<ModelDataPageStatsGraph data={stats} />
{/if}
{#if [-6, -2].includes(model.status)}
<DeleteZip {model} on:reload={() => dispatch('reload')} expand />
{/if}
{#if [-6, -2].includes(model.status)}
<DeleteZip {model} on:reload={() => dispatch('reload')} expand />
{/if}
<ModelData
{model}
on:reload={() => {
getData();
dispatch('reload');
}}
/>
</div>
<ModelData
{model}
on:reload={() => {
getData();
dispatch('reload');
}}
/>
</div>
{/if}