mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-09-24 00:54:32 +02:00
Import svelte web frontend
This commit is contained in:
37
web/frontend/src/StatsTableEntry.svelte
Normal file
37
web/frontend/src/StatsTableEntry.svelte
Normal file
@@ -0,0 +1,37 @@
|
||||
<script>
|
||||
export let host
|
||||
export let metric
|
||||
export let scope
|
||||
export let jobMetrics
|
||||
|
||||
$: series = jobMetrics
|
||||
.find(jm => jm.name == metric && jm.metric.scope == scope)
|
||||
?.metric.series.filter(s => s.hostname == host && s.statistics != null)
|
||||
</script>
|
||||
|
||||
{#if series == null || series.length == 0}
|
||||
<td colspan={scope == 'node' ? 3 : 4}><i>No data</i></td>
|
||||
{:else if series.length == 1 && scope == 'node'}
|
||||
<td>
|
||||
{series[0].statistics.min}
|
||||
</td>
|
||||
<td>
|
||||
{series[0].statistics.avg}
|
||||
</td>
|
||||
<td>
|
||||
{series[0].statistics.max}
|
||||
</td>
|
||||
{:else}
|
||||
<td colspan="4">
|
||||
<table style="width: 100%;">
|
||||
{#each series as s, i}
|
||||
<tr>
|
||||
<th>{s.id ?? i}</th>
|
||||
<td>{s.statistics.min}</td>
|
||||
<td>{s.statistics.avg}</td>
|
||||
<td>{s.statistics.max}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
</td>
|
||||
{/if}
|
Reference in New Issue
Block a user