Skip to content

Commit e16ea4a

Browse files
committedMar 12, 2025
team list error message badge
1 parent 2c40dbc commit e16ea4a

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed
 

‎src/routes/+page.svelte

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { badgeLevel } from '$lib/components/Badge.svelte';
23
import List from '$lib/components/list/List.svelte';
34
import TeamListItem from '$lib/components/list/TeamListItem.svelte';
45
import Pagination from '$lib/Pagination.svelte';
@@ -15,6 +16,14 @@
1516
let userTeams = $derived(
1617
$UserTeams.data?.me.__typename == 'User' && $UserTeams.data?.me.teams?.nodes.length
1718
);
19+
20+
const supportedErrorTypes = [
21+
'WorkloadStatusNoRunningInstances',
22+
'WorkloadStatusInvalidNaisYaml',
23+
'WorkloadStatusSynchronizationFailing',
24+
'WorkloadStatusDeprecatedRegistry',
25+
'WorkloadStatusFailedRun'
26+
];
1827
</script>
1928

2029
<svelte:head><title>Console</title></svelte:head>
@@ -43,11 +52,16 @@
4352
{#if $UserTeams.data.me.__typename == 'User'}
4453
<List>
4554
{#each $UserTeams.data.me.teams.nodes as node (node.team.id)}
46-
<TeamListItem team={node.team} />
47-
<!-- badge={{
48-
count: node.team.workloads.nodes.length,
49-
level: badgeLevel(node.team.workloads.nodes.flatMap((w) => w.status.errors))
50-
}} -->
55+
{@const errors = node.team.workloads.nodes.flatMap((w) =>
56+
w.status.errors.filter((e) => supportedErrorTypes.includes(e.__typename ?? ''))
57+
)}
58+
<TeamListItem
59+
team={node.team}
60+
badge={{
61+
count: errors.length,
62+
level: badgeLevel(errors)
63+
}}
64+
/>
5165
{:else}
5266
<BodyLong>
5367
You don't seem to belong to any teams at the moment. You can create a new team or

0 commit comments

Comments
 (0)