File tree 1 file changed +19
-5
lines changed
1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
+ import { badgeLevel } from ' $lib/components/Badge.svelte' ;
2
3
import List from ' $lib/components/list/List.svelte' ;
3
4
import TeamListItem from ' $lib/components/list/TeamListItem.svelte' ;
4
5
import Pagination from ' $lib/Pagination.svelte' ;
15
16
let userTeams = $derived (
16
17
$UserTeams .data ?.me .__typename == ' User' && $UserTeams .data ?.me .teams ?.nodes .length
17
18
);
19
+
20
+ const supportedErrorTypes = [
21
+ ' WorkloadStatusNoRunningInstances' ,
22
+ ' WorkloadStatusInvalidNaisYaml' ,
23
+ ' WorkloadStatusSynchronizationFailing' ,
24
+ ' WorkloadStatusDeprecatedRegistry' ,
25
+ ' WorkloadStatusFailedRun'
26
+ ];
18
27
</script >
19
28
20
29
<svelte:head ><title >Console</title ></svelte:head >
43
52
{#if $UserTeams .data .me .__typename == ' User' }
44
53
<List >
45
54
{#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
+ />
51
65
{:else }
52
66
<BodyLong >
53
67
You don't seem to belong to any teams at the moment. You can create a new team or
You can’t perform that action at this time.
0 commit comments