qa: Improve manager dashboard

This commit is contained in:
nemunaire 2025-01-13 19:23:59 +01:00
parent ba985874ca
commit cd0e75dc66

View File

@ -11,48 +11,62 @@
let themesP = fetch('api/qa/export.json').then((res) => res.json()) let themesP = fetch('api/qa/export.json').then((res) => res.json())
function state2Color(state) { function state2Color(report) {
const subtle = report.closed ? "-subtle" : "";
const state = report.state;
if (state === "timer") { if (state === "timer") {
return "info"; return "info" + subtle;
} else if (state === "ok") { } else if (state === "ok") {
return "success"; return "success" + subtle;
} else if (state.startsWith("issue")) { } else if (state.startsWith("issue")) {
return "danger"; return "danger" + subtle;
} else { } else {
return "warning"; return "warning" + subtle;
} }
} }
</script> </script>
<div <div
class="d-flex flex-fill" class="d-flex flex-column flex-fill"
style="overflow-y: auto" style="overflow-y: auto"
> >
{#await themesP then themes} {#await themesP then themes}
{#if Object.keys(themes).length > 1} {#if Object.keys(themes).length > 1}
<Row
style={'min-width:'+15*Object.keys(themes).length + 'vw'}
>
{#each Object.keys(themes) as tname} {#each Object.keys(themes) as tname}
<Col style="border-right: 1px solid lightgray"> <div
<h3 class="d-flex gap-2 mb-2 align-items-start py-1"
class="text-center py-3 mb-3" style="border-bottom: 1px solid lightgray; min-height: 4rem"
style="border-bottom: 2px solid black" >
<h4
class="d-flex align-items-center pe-2 mb-0 h-100 text-truncate"
style="border-right: 2px solid black; max-width: 150px"
title={tname}
on:click={() => goto("/themes/" + themes[tname].theme.id)}
> >
{tname} {tname}
</h3> </h4>
{#if themes[tname].exercices} {#if themes[tname].exercices}
{#each themes[tname].exercices as exercice} <div
class="flex-fill d-flex flex-column gap-1"
>
{#each themes[tname].exercices as exercice, eid}
{#if exercice.reports} {#if exercice.reports}
<div
class="flex-fill d-flex gap-2 align-items-center"
>
<span
title={exercice.exercice.title}
on:click={() => goto("/themes/" + themes[tname].theme.id + "/" + exercice.exercice.id)}
>
{eid+1}.
</span>
{#each exercice.reports as report} {#each exercice.reports as report}
<Card <Card
class="mb-3" color={state2Color(report.report)}
color={state2Color(report.report.state)} style="cursor: pointer; min-width: 100px; max-width: 250px"
style="cursor: pointer"
on:click={() => goto(`exercices/${exercice.exercice.id}/${report.report.id}`)} on:click={() => goto(`exercices/${exercice.exercice.id}/${report.report.id}`)}
> >
<CardBody class="p-2"> <CardBody class="p-2 text-truncate" title={report.report.subject}>
{report.report.subject}
{#if report.comments} {#if report.comments}
<Badge <Badge
class="float-end" class="float-end"
@ -60,16 +74,17 @@
{report.comments.length} {report.comments.length}
</Badge> </Badge>
{/if} {/if}
{report.report.subject}
</CardBody> </CardBody>
</Card> </Card>
{/each} {/each}
<hr /> </div>
{/if} {/if}
{/each} {/each}
</div>
{/if} {/if}
</Col> </div>
{/each} {/each}
</Row>
{:else} {:else}
{#each Object.keys(themes) as tname} {#each Object.keys(themes) as tname}
{#if themes[tname].exercices} {#if themes[tname].exercices}