qa: Improve manager dashboard
This commit is contained in:
parent
28b4e7e529
commit
092d2256f7
@ -11,66 +11,81 @@
|
||||
|
||||
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'}
|
||||
>
|
||||
{#if Object.keys(themes).length > 1}
|
||||
{#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"
|
||||
>
|
||||
{tname}
|
||||
</h3>
|
||||
{#if themes[tname].exercices}
|
||||
{#each themes[tname].exercices as exercice}
|
||||
{#if exercice.reports}
|
||||
{#each exercice.reports as report}
|
||||
<Card
|
||||
class="mb-3"
|
||||
color={state2Color(report.report.state)}
|
||||
style="cursor: pointer"
|
||||
on:click={() => goto(`exercices/${exercice.exercice.id}/${report.report.id}`)}
|
||||
<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}
|
||||
</h4>
|
||||
{#if themes[tname].exercices}
|
||||
<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"
|
||||
>
|
||||
<CardBody class="p-2">
|
||||
{report.report.subject}
|
||||
{#if report.comments}
|
||||
<Badge
|
||||
class="float-end"
|
||||
>
|
||||
{report.comments.length}
|
||||
</Badge>
|
||||
{/if}
|
||||
</CardBody>
|
||||
</Card>
|
||||
{/each}
|
||||
<hr />
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
</Col>
|
||||
<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
|
||||
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 text-truncate" title={report.report.subject}>
|
||||
{#if report.comments}
|
||||
<Badge
|
||||
class="float-end"
|
||||
>
|
||||
{report.comments.length}
|
||||
</Badge>
|
||||
{/if}
|
||||
{report.report.subject}
|
||||
</CardBody>
|
||||
</Card>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</Row>
|
||||
{:else}
|
||||
{:else}
|
||||
{#each Object.keys(themes) as tname}
|
||||
{#if themes[tname].exercices}
|
||||
{#each themes[tname].exercices as exercice}
|
||||
@ -112,6 +127,6 @@
|
||||
{/each}
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{/if}
|
||||
{/await}
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user