Skip to content

Commit 9c888c0

Browse files
authored
fix: validate connection modal status, retry button, and copy nits (#3347)
* fix: validate connection modal status, retry button, and copy nits - Fix isValid check (=== true) so HTTP error responses without a valid field don't show as "Connection is valid" - Fix result assignment so onError captures the real error message from the API body instead of being overwritten by the raw return value - Add Retry button to modal; replace Cancel to avoid modal closing on retry - Add hideCancel prop to Modal component - Match skeleton height to result row so modal doesn't resize on retry - Update empty state button copy to "Create Serverless Worker Deployment" - Change AWS Setup Guide card title to font-medium * fix: use portal for deployment status tooltip to fix z-index clipping
1 parent b2685f3 commit 9c888c0

6 files changed

Lines changed: 47 additions & 30 deletions

File tree

src/lib/components/deployments/deployment-status.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
);
5252
</script>
5353

54-
<Tooltip text={tooltip[status]} topLeft width={250}>
54+
<Tooltip text={tooltip[status]} topLeft width={250} usePortal>
5555
<p class={deploymentStatus({ status })}>
5656
{#if icon[status]}<Icon name={icon[status]!} />{/if}{label}
5757
</p>

src/lib/components/deployments/validate-connection-modal.svelte

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import Button from '$lib/holocene/button.svelte';
23
import Icon from '$lib/holocene/icon/icon.svelte';
34
import Modal from '$lib/holocene/modal.svelte';
45
import { translate } from '$lib/i18n/translate';
@@ -7,32 +8,45 @@
78
buildId: string;
89
open: boolean;
910
loading: boolean;
10-
result: { valid: boolean; message?: string } | null;
11+
result: { message?: string } | null;
1112
onClose: () => void;
13+
onRetry: () => void;
1214
}
1315
14-
let { buildId, open, loading, result, onClose }: Props = $props();
16+
let { buildId, open, loading, result, onClose, onRetry }: Props = $props();
1517
16-
const isValid = $derived(result?.valid !== false);
18+
const isValid = $derived(!result?.message);
1719
</script>
1820

1921
<Modal
2022
id="validate-connection-modal-{buildId}"
2123
{open}
22-
confirmText={translate('common.close')}
23-
cancelText={translate('common.cancel')}
24-
on:confirmModal={onClose}
25-
on:cancelModal={onClose}
24+
confirmText=""
25+
cancelText=""
26+
hideCancel
27+
hideConfirm
2628
>
2729
<h3 slot="title">
2830
{translate('deployments.validate-connection')}
2931
<span class="font-mono text-secondary">{buildId}</span>
3032
</h3>
33+
<svelte:fragment slot="footer">
34+
<div class="flex w-full items-center justify-end gap-2">
35+
<Button variant="ghost" on:click={onRetry}
36+
>{translate('common.retry')}</Button
37+
>
38+
<Button variant="primary" on:click={onClose}
39+
>{translate('common.close')}</Button
40+
>
41+
</div>
42+
</svelte:fragment>
3143
<div slot="content">
3244
{#if loading}
33-
<div class="flex flex-col gap-2">
34-
<div class="h-3 w-32 animate-pulse rounded bg-subtle"></div>
35-
<div class="h-3 w-48 animate-pulse rounded bg-subtle"></div>
45+
<div class="flex items-center gap-2">
46+
<div
47+
class="h-5 w-5 shrink-0 animate-pulse rounded-full bg-subtle"
48+
></div>
49+
<div class="h-5 w-40 animate-pulse rounded bg-subtle"></div>
3650
</div>
3751
{:else if result}
3852
<div class="flex items-start gap-2">

src/lib/components/deployments/version-table-row.svelte

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@
152152
let deleteVersionError = $state('');
153153
let showValidateModal = $state(false);
154154
let validateLoading = $state(false);
155-
let validateResult = $state<{ valid: boolean; message?: string } | null>(
156-
null,
157-
);
155+
let validateResult = $state<{ message?: string } | null>(null);
158156
159157
async function handleValidateConnection() {
160158
validateResult = null;
@@ -171,16 +169,16 @@
171169
validateLoading = false;
172170
return;
173171
}
174-
validateResult = await validateWorkerDeploymentVersionComputeConfig(
172+
let errorMessage: string | undefined;
173+
await validateWorkerDeploymentVersionComputeConfig(
175174
{ namespace, deploymentName, buildId: versionBuildId, computeConfig },
176-
() => {
177-
validateLoading = false;
178-
validateResult = {
179-
valid: false,
180-
message: translate('deployments.validate-connection-error'),
181-
};
175+
(error) => {
176+
errorMessage =
177+
(error.body as { message?: string })?.message ??
178+
translate('deployments.validate-connection-error');
182179
},
183180
);
181+
validateResult = { message: errorMessage };
184182
validateLoading = false;
185183
}
186184
@@ -307,6 +305,7 @@
307305
loading={validateLoading}
308306
result={validateResult}
309307
onClose={() => (showValidateModal = false)}
308+
onRetry={handleValidateConnection}
310309
/>
311310

312311
<DeleteVersionModal

src/lib/components/workers/serverless-worker-form/serverless-worker-setup-guide.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Resources:
3838
const snippetContent = $derived(cfnTemplate ?? defaultCfnTemplate);
3939
</script>
4040

41-
<h3 class="mb-4 text-base font-semibold">
41+
<h3 class="mb-4 text-base font-medium">
4242
{translate('workers.setup-guide-title')}
4343
</h3>
4444
<Timeline>

src/lib/holocene/modal.svelte

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
confirmDisabled?: boolean;
1515
confirmText: string;
1616
confirmType?: ComponentProps<Button>['variant'];
17+
hideCancel?: boolean;
1718
hideConfirm?: boolean;
1819
hightlightNav?: boolean;
1920
id: string;
@@ -25,6 +26,7 @@
2526
class?: string;
2627
}
2728
29+
export let hideCancel = false;
2830
export let hideConfirm = false;
2931
export let confirmText: string;
3032
export let cancelText: string;
@@ -131,12 +133,14 @@
131133
<div></div>
132134
</slot>
133135
<div class="flex items-center justify-end space-x-2">
134-
<Button
135-
data-testid="cancel-modal-button"
136-
variant="ghost"
137-
disabled={loading}
138-
on:click={closeModal}>{cancelText}</Button
139-
>
136+
{#if !hideCancel}
137+
<Button
138+
data-testid="cancel-modal-button"
139+
variant="ghost"
140+
disabled={loading}
141+
on:click={closeModal}>{cancelText}</Button
142+
>
143+
{/if}
140144
{#if !hideConfirm}
141145
<Button
142146
variant={confirmType}

src/lib/i18n/locales/en/workers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ export const Strings = {
103103
'An IAM role allowing Temporal to invoke your function',
104104
'serverless-empty-prereq-queue':
105105
'A task queue name for your serverless worker',
106-
'create-serverless-worker': 'Create Worker Deployment',
107-
'create-serverless-title': 'Create Worker Deployment',
106+
'create-serverless-worker': 'Create Serverless Worker Deployment',
107+
'create-serverless-title': 'Create Serverless Worker Deployment',
108108
'edit-serverless-worker': 'Edit',
109109
'edit-serverless-worker-title': 'Edit Serverless Worker',
110110
'serverless-detail-title': 'Serverless Worker Details',

0 commit comments

Comments
 (0)