Skip to content

Commit e4ffa6a

Browse files
committed
feat: enhance deployment status display with error handling and additional data
1 parent 1474f39 commit e4ffa6a

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

src/lib/components/WorkloadDeploy.svelte

+14-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { fragment, graphql, type WorkloadDeploy } from '$houdini';
33
import Time from '$lib/Time.svelte';
44
import { isValidSha } from '$lib/utils/isValidSha';
5-
import { BodyShort, Heading, Link } from '@nais/ds-svelte-community';
5+
import { BodyShort, Heading, Link, Tag } from '@nais/ds-svelte-community';
66
import { ExternalLinkIcon } from '@nais/ds-svelte-community/icons';
77
88
interface Props {
@@ -25,6 +25,11 @@
2525
triggerUrl
2626
commitSha
2727
repository
28+
statuses {
29+
nodes {
30+
state
31+
}
32+
}
2833
}
2934
}
3035
}
@@ -38,7 +43,14 @@
3843
</script>
3944

4045
<div class="wrapper">
41-
<Heading level="3" size="small">Deploy</Heading>
46+
<Heading level="3" size="small">
47+
<div style="display: flex; gap: var(--a-spacing-2);">
48+
Deployment
49+
{#if deploymentInfo?.statuses.nodes[0].state === 'FAILURE'}
50+
<Tag variant="error" size="small">Failed</Tag>
51+
{/if}
52+
</div>
53+
</Heading>
4254
{#if deploymentInfo}
4355
{#if deploymentInfo.createdAt}
4456
<BodyShort>Last deployed <Time time={deploymentInfo.createdAt} distance={true} />.</BodyShort>

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

+24
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,31 @@ query App($app: String!, $team: Slug!, $env: String!) {
88
team {
99
slug
1010
}
11+
image {
12+
tag
13+
}
14+
instances {
15+
nodes {
16+
image {
17+
name
18+
tag
19+
}
20+
}
21+
}
1122
deletionStartedAt
23+
deployments(first: 1) {
24+
nodes {
25+
triggerUrl
26+
statuses {
27+
nodes {
28+
state
29+
message
30+
31+
createdAt
32+
}
33+
}
34+
}
35+
}
1236

1337
...AppInstances
1438
...AppStatus

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

+23-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import WorkloadDeploy from '$lib/components/WorkloadDeploy.svelte';
1212
import GraphErrors from '$lib/GraphErrors.svelte';
1313
import Time from '$lib/Time.svelte';
14-
import { Alert, Button, Heading } from '@nais/ds-svelte-community';
15-
import { ArrowCirclepathIcon } from '@nais/ds-svelte-community/icons';
14+
import { Alert, BodyShort, Button, Heading } from '@nais/ds-svelte-community';
15+
import { ArrowCirclepathIcon, ExternalLinkIcon } from '@nais/ds-svelte-community/icons';
1616
import type { PageData } from './$houdini';
1717
import Ingresses from './Ingresses.svelte';
1818
import Instances from './Instances.svelte';
@@ -56,6 +56,11 @@
5656
team: teamSlug
5757
});
5858
};
59+
60+
let deployFailed = $derived(
61+
$App.data?.team.environment.application.deployments.nodes[0].statuses.nodes[0].state ===
62+
'FAILURE'
63+
);
5964
</script>
6065

6166
<GraphErrors errors={$App.errors} />
@@ -73,6 +78,22 @@
7378
/>. If the deletion is taking too long, please contact the Nais team.
7479
</Alert>
7580
{/if}
81+
{#if deployFailed}
82+
<Alert variant="error" fullWidth={false}>
83+
<Heading level="2" size="small" spacing>Last deployment failed</Heading>
84+
<BodyShort spacing>
85+
<strong>Error message:</strong>
86+
{$App.data?.team.environment.application.deployments.nodes[0].statuses.nodes[0]
87+
.message}
88+
</BodyShort>
89+
{#if $App.data?.team.environment.application.deployments.nodes[0].triggerUrl}
90+
<a href={$App.data?.team.environment.application.deployments.nodes[0].triggerUrl}
91+
>Github action <ExternalLinkIcon /></a
92+
>
93+
{/if}
94+
</Alert>
95+
{/if}
96+
7697
<div style="display:flex; flex-direction: column; gap: var(--a-spacing-4);">
7798
<div class="instances-header">
7899
<Heading level="3" size="medium">Instances</Heading>

0 commit comments

Comments
 (0)