|
1 | 1 | <script lang="ts">
|
2 | 2 | import { onNavigate } from '$app/navigation';
|
3 | 3 | import { page } from '$app/state';
|
4 |
| - import { graphql, type WorkloadStatusErrorLevel$options } from '$houdini'; |
| 4 | + import { graphql } from '$houdini'; |
5 | 5 | import AggregatedCostForWorkload from '$lib/components/AggregatedCostForWorkload.svelte';
|
6 | 6 | import Confirm from '$lib/components/Confirm.svelte';
|
| 7 | + import ErrorMessage from '$lib/components/ErrorMessage.svelte'; |
7 | 8 | import Image from '$lib/components/Image.svelte';
|
8 | 9 | import NetworkPolicy from '$lib/components/NetworkPolicy.svelte';
|
9 | 10 | import Persistence from '$lib/components/persistence/Persistence.svelte';
|
10 | 11 | import Secrets from '$lib/components/Secrets.svelte';
|
11 | 12 | import WorkloadDeploy from '$lib/components/WorkloadDeploy.svelte';
|
12 |
| - import { docURL } from '$lib/doc'; |
13 | 13 | import GraphErrors from '$lib/GraphErrors.svelte';
|
14 | 14 | import Time from '$lib/Time.svelte';
|
15 |
| - import { Alert, BodyLong, BodyShort, Button, Heading } from '@nais/ds-svelte-community'; |
| 15 | + import { Alert, Button, Heading } from '@nais/ds-svelte-community'; |
16 | 16 | import { ArrowCirclepathIcon } from '@nais/ds-svelte-community/icons';
|
17 | 17 | import type { PageProps } from './$houdini';
|
18 | 18 | import Ingresses from './Ingresses.svelte';
|
|
53 | 53 | });
|
54 | 54 | };
|
55 | 55 |
|
56 |
| - const levelVariant = (level?: WorkloadStatusErrorLevel$options) => { |
57 |
| - switch (level) { |
58 |
| - case 'ERROR': |
59 |
| - return 'error'; |
60 |
| - case 'WARNING': |
61 |
| - return 'warning'; |
62 |
| - case 'TODO': |
| 56 | + const getError = (type: string) => { |
| 57 | + const error = $App.data?.team.environment.application.status.errors.find( |
| 58 | + (error) => error.__typename === type |
| 59 | + ); |
| 60 | + switch (error?.__typename) { |
| 61 | + case 'WorkloadStatusNoRunningInstances': |
| 62 | + return { |
| 63 | + ...error, |
| 64 | + instances: $App.data?.team.environment.application.instances.nodes ?? [] |
| 65 | + }; |
63 | 66 | default:
|
64 |
| - return 'info'; |
| 67 | + return error; |
65 | 68 | }
|
66 | 69 | };
|
67 | 70 | </script>
|
|
74 | 77 | <div class="wrapper">
|
75 | 78 | <div class="app-content">
|
76 | 79 | <div class="main-section">
|
77 |
| - {#if app.status.errors.some((error) => error.__typename === 'WorkloadStatusNoRunningInstances')} |
78 |
| - <Alert |
79 |
| - variant={levelVariant( |
80 |
| - app.status.errors.find( |
81 |
| - (error) => error.__typename === 'WorkloadStatusNoRunningInstances' |
82 |
| - )?.level |
83 |
| - )} |
84 |
| - > |
85 |
| - <div style="display: grid; gap: var(--a-spacing-3);"> |
86 |
| - <Heading level="2" size="small">No Running Instances</Heading> |
87 |
| - <BodyShort>The application has no running instances.</BodyShort> |
88 |
| - |
89 |
| - <Heading level="3" size="xsmall">Failing instances:</Heading> |
90 |
| - <ul style="margin: 0;"> |
91 |
| - {#each app.instances.nodes as instance (instance.id)} |
92 |
| - <li> |
93 |
| - <code style="font-size: 1rem; line-height: 1.75;">{instance.name}</code>: |
94 |
| - <strong>{instance.status.message}</strong> |
95 |
| - </li> |
96 |
| - {/each} |
97 |
| - </ul> |
98 |
| - <BodyLong> |
99 |
| - Check logs if available. If this is unexpected and you cannot resolve the issue, |
100 |
| - contact the Nais team. |
101 |
| - </BodyLong> |
102 |
| - </div> |
103 |
| - </Alert> |
104 |
| - {/if} |
105 |
| - {#if app.status.errors.some((error) => error.__typename === 'WorkloadStatusInvalidNaisYaml')} |
106 |
| - <Alert |
107 |
| - variant={levelVariant( |
108 |
| - app.status.errors.find( |
109 |
| - (error) => error.__typename === 'WorkloadStatusInvalidNaisYaml' |
110 |
| - )?.level |
111 |
| - )} |
112 |
| - > |
113 |
| - <div style="display: grid; gap: var(--a-spacing-3);"> |
114 |
| - <Heading level="2" size="small">Rollout Failed - Invalid Manifest</Heading> |
115 |
| - <BodyLong> |
116 |
| - The rollout of your application has failed due to an error in the application |
117 |
| - manifest. |
118 |
| - </BodyLong> |
119 |
| - |
120 |
| - <Heading level="3" size="xsmall">Error details</Heading> |
121 |
| - |
122 |
| - <code style="font-size: 0.8rem; line-height: 1.75;" |
123 |
| - >{app.status.errors.find( |
124 |
| - (error) => error.__typename === 'WorkloadStatusInvalidNaisYaml' |
125 |
| - )?.detail}</code |
126 |
| - > |
127 |
| - |
128 |
| - <BodyLong> |
129 |
| - To resolve this issue, review the application manifest and correct any errors. |
130 |
| - Consult the <a |
131 |
| - target="_blank" |
132 |
| - rel="noopener noreferrer" |
133 |
| - href={docURL('/workloads/application/reference/application-spec/')} |
134 |
| - >Nais application reference</a |
135 |
| - > for manifest requirements. |
136 |
| - </BodyLong> |
137 |
| - </div> |
138 |
| - </Alert> |
139 |
| - {/if} |
140 |
| - {#if app.status.errors.some((error) => error.__typename === 'WorkloadStatusSynchronizationFailing')} |
141 |
| - <Alert |
142 |
| - variant={levelVariant( |
143 |
| - app.status.errors.find( |
144 |
| - (error) => error.__typename === 'WorkloadStatusSynchronizationFailing' |
145 |
| - )?.level |
146 |
| - )} |
147 |
| - > |
148 |
| - <Heading level="2" size="small" spacing>Rollout Failed - Synchronization Error</Heading> |
149 |
| - <BodyLong spacing> |
150 |
| - The rollout of the application is failing, meaning it is not in sync with the latest |
151 |
| - deployment. This may be due to a misconfiguration or a temporary issue, so try again |
152 |
| - in a few minutes. If the problem persists, contact the Nais team. |
153 |
| - </BodyLong> |
154 |
| - |
155 |
| - <Heading level="3" size="xsmall" spacing>Error details</Heading> |
156 |
| - |
157 |
| - <code style="font-size: 0.8rem; line-height: 1;" |
158 |
| - >{app.status.errors.find( |
159 |
| - (error) => error.__typename === 'WorkloadStatusSynchronizationFailing' |
160 |
| - )?.detail}</code |
161 |
| - > |
162 |
| - </Alert> |
163 |
| - {/if} |
164 |
| - {#if app.status.errors.some((error) => error.__typename === 'WorkloadStatusDeprecatedRegistry')} |
165 |
| - <Alert |
166 |
| - variant={levelVariant( |
167 |
| - app.status.errors.find( |
168 |
| - (error) => error.__typename === 'WorkloadStatusDeprecatedRegistry' |
169 |
| - )?.level |
170 |
| - )} |
171 |
| - > |
172 |
| - <BodyShort spacing |
173 |
| - >This application is using a deprecated image registry ({app.status.errors.find( |
174 |
| - (error) => error.__typename === 'WorkloadStatusDeprecatedRegistry' |
175 |
| - )?.registry}).</BodyShort |
176 |
| - > |
177 |
| - |
178 |
| - <BodyLong |
179 |
| - >Starting April 1st, applications and jobs on Nais must use images from Google |
180 |
| - Artifact Registry (GAR). The easiest way to ensure that images are stored in GAR is to |
181 |
| - use Nais' GitHub Actions in the workflow. <a |
182 |
| - href="https://nais.io/log/#2025-02-24-image-policy" |
183 |
| - target="_blank" |
184 |
| - rel="noopener noreferrer">Read more in Nais announcement</a |
185 |
| - >. |
186 |
| - </BodyLong> |
187 |
| - </Alert> |
188 |
| - {/if} |
| 80 | + {#each ['WorkloadStatusInvalidNaisYaml', 'WorkloadStatusSynchronizationFailing', 'WorkloadStatusNoRunningInstances', 'WorkloadStatusDeprecatedRegistry'].map(getError) as error} |
| 81 | + {#if error} |
| 82 | + <ErrorMessage {error} /> |
| 83 | + {/if} |
| 84 | + {/each} |
189 | 85 |
|
190 | 86 | {#if app.deletionStartedAt}
|
191 | 87 | <Alert variant="info" size="small" fullWidth={false}>
|
|
0 commit comments