qa: Improve manager dashboard

This commit is contained in:
nemunaire 2025-01-13 19:23:59 +01:00
parent 28b4e7e529
commit 092d2256f7

View File

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