|
1 | 1 | <script lang="ts">
|
2 | 2 | import { page } from '$app/state';
|
3 |
| - import { graphql } from '$houdini'; |
| 3 | + import { graphql, type WorkloadStatusErrorLevel$options } from '$houdini'; |
4 | 4 | import AggregatedCostForWorkload from '$lib/components/AggregatedCostForWorkload.svelte';
|
5 | 5 | import Image from '$lib/components/Image.svelte';
|
6 | 6 | import NetworkPolicy from '$lib/components/NetworkPolicy.svelte';
|
|
10 | 10 | import GraphErrors from '$lib/GraphErrors.svelte';
|
11 | 11 | import Time from '$lib/Time.svelte';
|
12 | 12 | import { Alert, BodyLong, BodyShort, Button, Heading } from '@nais/ds-svelte-community';
|
13 |
| - import { ExternalLinkIcon } from '@nais/ds-svelte-community/icons'; |
14 | 13 | import type { PageData } from './$houdini';
|
15 | 14 | import Runs from './Runs.svelte';
|
16 | 15 | import Schedule from './Schedule.svelte';
|
|
64 | 63 | });
|
65 | 64 | };
|
66 | 65 |
|
67 |
| - let deployFailed = $derived( |
68 |
| - $Job.data?.team.environment.job.deployments.nodes.at(0)?.statuses.nodes.at(0)?.state === |
69 |
| - 'FAILURE' |
70 |
| - ); |
| 66 | + const levelVariant = (level?: WorkloadStatusErrorLevel$options) => { |
| 67 | + switch (level) { |
| 68 | + case 'ERROR': |
| 69 | + return 'error'; |
| 70 | + case 'WARNING': |
| 71 | + return 'warning'; |
| 72 | + case 'TODO': |
| 73 | + default: |
| 74 | + return 'info'; |
| 75 | + } |
| 76 | + }; |
71 | 77 | </script>
|
72 | 78 |
|
73 | 79 | <GraphErrors errors={$Job.errors} />
|
|
76 | 82 | {@const job = $Job.data.team.environment.job}
|
77 | 83 | <div class="job-content">
|
78 | 84 | <div style="display:flex; flex-direction: column; gap: 1rem;">
|
| 85 | + {#if job.status.errors.some((error) => error.__typename === 'WorkloadStatusSynchronizationFailing')} |
| 86 | + <Alert |
| 87 | + variant={levelVariant( |
| 88 | + job.status.errors.find( |
| 89 | + (error) => error.__typename === 'WorkloadStatusSynchronizationFailing' |
| 90 | + )?.level |
| 91 | + )} |
| 92 | + > |
| 93 | + <Heading level="2" size="small" spacing>Synchronization failing</Heading> |
| 94 | + <BodyLong spacing> |
| 95 | + The rollout of the job is failing, meaning it is not in sync with the latest deployment. |
| 96 | + This may be due to a misconfiguration or a temporary issue, so try again in a few |
| 97 | + minutes. If the problem persists, please contact the Nais team. |
| 98 | + </BodyLong> |
| 99 | + |
| 100 | + <Heading level="3" size="xsmall" spacing>Error details</Heading> |
| 101 | + |
| 102 | + <code style="font-size: 0.8rem; line-height: 1;" |
| 103 | + >{job.status.errors.find( |
| 104 | + (error) => error.__typename === 'WorkloadStatusSynchronizationFailing' |
| 105 | + )?.detail}</code |
| 106 | + > |
| 107 | + </Alert> |
| 108 | + {/if} |
79 | 109 | {#if job.status.errors.some((error) => error.__typename === 'WorkloadStatusDeprecatedRegistry')}
|
80 | 110 | <Alert variant="error">
|
81 | 111 | <BodyShort spacing
|
|
105 | 135 | </Alert>
|
106 | 136 | {/if}
|
107 | 137 |
|
108 |
| - {#if deployFailed} |
109 |
| - <Alert variant="error" fullWidth={false}> |
110 |
| - <Heading level="2" size="small" spacing>Last deployment failed</Heading> |
111 |
| - <BodyShort spacing> |
112 |
| - <strong>Error message:</strong> |
113 |
| - {$Job.data?.team.environment.job.deployments.nodes.at(0)?.statuses.nodes.at(0)?.message} |
114 |
| - </BodyShort> |
115 |
| - {#if $Job.data?.team.environment.job.deployments.nodes[0].triggerUrl} |
116 |
| - <a href={$Job.data?.team.environment.job.deployments.nodes.at(0)?.triggerUrl} |
117 |
| - >Github action <ExternalLinkIcon /></a |
118 |
| - > |
119 |
| - {/if} |
120 |
| - </Alert> |
121 |
| - {/if} |
122 |
| - |
123 | 138 | <div style="display:flex; flex-direction: column; gap:0.5rem;">
|
124 | 139 | <div class="runs-header">
|
125 | 140 | <Heading level="2" size="medium">Runs</Heading>
|
|
0 commit comments