Skip to content

Commit ac0aa2e

Browse files
committed
feat: add synchronization failing alert to team overview page
1 parent b94f6af commit ac0aa2e

File tree

2 files changed

+63
-28
lines changed

2 files changed

+63
-28
lines changed

src/routes/team/[team]/+page.gql

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ query TeamOverview($team: Slug!) @cache(policy: NetworkOnly) {
2222
repository
2323
tag
2424
}
25+
... on WorkloadStatusSynchronizationFailing {
26+
detail
27+
}
2528
}
2629
}
2730
}

src/routes/team/[team]/+page.svelte

+60-28
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import TeamInfo from '$lib/components/TeamInfo.svelte';
77
import TeamUtilizationAndOverage from '$lib/components/TeamUtilizationAndOverage.svelte';
88
import VulnerabilitySummary from '$lib/components/VulnerabilitySummary.svelte';
9-
import { Alert, Heading } from '@nais/ds-svelte-community';
9+
import { Alert, BodyShort, Heading } from '@nais/ds-svelte-community';
1010
1111
import WorkloadLink from '$lib/components/WorkloadLink.svelte';
1212
import type { PageProps } from './$houdini';
@@ -21,6 +21,14 @@
2121
)
2222
)
2323
);
24+
25+
const syncFailed = $derived(
26+
$TeamOverview.data?.team.workloads.nodes.filter((workload) =>
27+
workload.status.errors.some(
28+
(error) => error.__typename === 'WorkloadStatusSynchronizationFailing'
29+
)
30+
)
31+
);
2432
</script>
2533

2634
{#if page.url.searchParams.has('deleted')}
@@ -30,38 +38,56 @@
3038
{msgParts[1]}.
3139
</Alert>
3240
{/if}
41+
<div class="alerts-wrapper">
42+
{#if syncFailed?.length}
43+
<Alert variant="error">
44+
<div style="display: flex; flex-direction: column; gap: var(--a-spacing-3)">
45+
<Heading level="2" size="small">Synchronization failing</Heading>
46+
<BodyShort>
47+
The rollout of the following workload{syncFailed.length === 1 ? '' : 's'} failed because of
48+
synchronization errors.
49+
</BodyShort>
50+
<div>
51+
{#each syncFailed as workload (workload.id)}
52+
<WorkloadLink {workload} hideTeam />
53+
{/each}
54+
</div>
55+
</div>
56+
</Alert>
57+
{/if}
3358

34-
{#if deprecatedImages?.length}
35-
<Alert variant="warning">
36-
Starting April 1st, applications and jobs on Nais must use images from Google Artifact Registry
37-
(GAR). The easiest way to ensure that images are stored in GAR is to use Nais' GitHub Actions in
38-
the workflow. <a
39-
href="https://nais.io/log/#2025-02-24-image-policy"
40-
target="_blank"
41-
rel="noopener noreferrer">Read more in Nais announcement</a
42-
>.
43-
<p>
44-
{teamSlug} currently has <strong>{deprecatedImages.length}</strong>
45-
workload{deprecatedImages.length === 1 ? '' : 's'} using
46-
{deprecatedImages.length === 1
47-
? 'a deprecated image registry'
48-
: 'deprecated image registries'}.
49-
</p>
59+
{#if deprecatedImages?.length}
60+
<Alert variant="warning">
61+
Starting April 1st, applications and jobs on Nais must use images from Google Artifact
62+
Registry (GAR). The easiest way to ensure that images are stored in GAR is to use Nais' GitHub
63+
Actions in the workflow. <a
64+
href="https://nais.io/log/#2025-02-24-image-policy"
65+
target="_blank"
66+
rel="noopener noreferrer">Read more in Nais announcement</a
67+
>.
68+
<p>
69+
{teamSlug} currently has <strong>{deprecatedImages.length}</strong>
70+
workload{deprecatedImages.length === 1 ? '' : 's'} using
71+
{deprecatedImages.length === 1
72+
? 'a deprecated image registry'
73+
: 'deprecated image registries'}.
74+
</p>
5075

51-
{#if deprecatedImages.length < 5}
52-
{#each deprecatedImages as workload (workload.id)}
53-
<WorkloadLink {workload} />
54-
{/each}
55-
{:else}
56-
<details>
57-
<summary>Workloads with deprecated image registries</summary>
76+
{#if deprecatedImages.length < 5}
5877
{#each deprecatedImages as workload (workload.id)}
5978
<WorkloadLink {workload} />
6079
{/each}
61-
</details>
62-
{/if}
63-
</Alert>
64-
{/if}
80+
{:else}
81+
<details>
82+
<summary>Workloads with deprecated image registries</summary>
83+
{#each deprecatedImages as workload (workload.id)}
84+
<WorkloadLink {workload} />
85+
{/each}
86+
</details>
87+
{/if}
88+
</Alert>
89+
{/if}
90+
</div>
6591
<div class="grid">
6692
<Card rows={1} columns={3}>
6793
<TeamInfo {teamSlug} {viewerIsMember} />
@@ -95,6 +121,12 @@
95121
.grid:not(:first-child) {
96122
margin-top: 1rem;
97123
}
124+
125+
.alerts-wrapper {
126+
display: flex;
127+
flex-direction: column;
128+
gap: var(--a-spacing-4);
129+
}
98130
.deployments {
99131
grid-column: span 12;
100132
grid-row: span 1;

0 commit comments

Comments
 (0)