fix color overflow, add info if no status data

This commit is contained in:
Christoph Kluge
2025-08-08 13:50:09 +02:00
parent b474288df7
commit 10194105e3
4 changed files with 32 additions and 76 deletions

View File

@@ -182,6 +182,15 @@
});
}
}
function legendColor(targetIdx) {
// Reuses first color if targetIdx overflows
if (cbmode) {
return cbColors[(colors.length + targetIdx) % colors.length]
} else {
return colors[(colors.length + targetIdx) % colors.length]
}
}
</script>
{#if $initq.data}
@@ -235,7 +244,7 @@
</tr>
{#each $topUserQuery.data.topUser as tu, i}
<tr>
<td><Icon name="circle-fill" style="color: {cbmode ? cbColors[i] : colors[i]};" /></td>
<td><Icon name="circle-fill" style="color: {legendColor(i)};" /></td>
<th scope="col" id="topName-{tu.id}"
><a
href="/monitoring/user/{tu.id}?cluster={cluster}&state=running"
@@ -302,7 +311,7 @@
</tr>
{#each $topProjectQuery.data.topProjects as tp, i}
<tr>
<td><Icon name="circle-fill" style="color: {cbmode ? cbColors[i] : colors[i]};" /></td>
<td><Icon name="circle-fill" style="color: {legendColor(i)};" /></td>
<th scope="col"
><a
href="/monitoring/jobs/?cluster={cluster}&state=running&project={tp.id}&projectMatch=eq"