diff --git a/src/lib/pages/nexus-create-endpoint.svelte b/src/lib/pages/nexus-create-endpoint.svelte index c52161a039..6b6c24770f 100644 --- a/src/lib/pages/nexus-create-endpoint.svelte +++ b/src/lib/pages/nexus-create-endpoint.svelte @@ -1,4 +1,6 @@ @@ -36,8 +50,13 @@ {callerNamespaceList} {isCloud} {validateNamespacesExist} + {nameLeading} + {fieldsInert} + {submitDisabled} + class={className} {cancelHref} - submitButtonText={translate('nexus.create-endpoint')} + {card} + {submitButtonText} onSubmit={onCreate} /> diff --git a/src/lib/pages/nexus-form.svelte b/src/lib/pages/nexus-form.svelte index d92f0cc464..0d83ea12f1 100644 --- a/src/lib/pages/nexus-form.svelte +++ b/src/lib/pages/nexus-form.svelte @@ -2,11 +2,13 @@ import type { Snippet } from 'svelte'; import { superForm } from 'sveltekit-superforms'; import { zodClient } from 'sveltekit-superforms/adapters'; + import { twMerge as merge } from 'tailwind-merge'; import { z } from 'zod/v3'; import Message from '$lib/components/form/message.svelte'; import IsOssGuard from '$lib/components/is-oss-guard.svelte'; import Button from '$lib/holocene/button.svelte'; + import Card from '$lib/holocene/card.svelte'; import Combobox from '$lib/holocene/combobox/combobox.svelte'; import Input from '$lib/holocene/input/input.svelte'; import MarkdownEditor from '$lib/holocene/markdown-editor/markdown-editor.svelte'; @@ -26,6 +28,11 @@ endpoint?: NexusEndpoint; nameDisabled?: boolean; footer?: Snippet<[{ submitting: boolean }]>; + nameLeading?: Snippet; + fieldsInert?: boolean; + submitDisabled?: boolean; + class?: string; + card?: boolean; validateNamespacesExist?: ValidateNamespacesExist; }; @@ -41,6 +48,11 @@ endpoint = undefined, nameDisabled = false, footer, + nameLeading, + fieldsInert = false, + submitDisabled = false, + class: className = '', + card = false, validateNamespacesExist, }: Props = $props(); @@ -98,7 +110,7 @@ resetForm: false, dataType: 'json', onUpdate: async ({ form, cancel }) => { - if (!form.valid) return; + if (!form.valid || fieldsInert || submitDisabled) return; if ( isCloud && @@ -193,95 +205,139 @@ ); -
- -
-

{translate('nexus.target')}

-

- {translate('nexus.target-description')} -

-
- - - -
-

- {translate('nexus.access-policy')} -

-

- {translate('nexus.allowed-caller-namespaces-description')} -

-
- + {#snippet nameInput()} + -
-
-

- {translate('nexus.description-label')} -

- -

- {translate('nexus.description-hint')} -

-
+ {/snippet} + {#snippet fields()} + {#if nameLeading} +
+
+ {@render nameLeading()} +
+ +
+ {@render nameInput()} +
+
+ {:else} +
+ {@render nameInput()} +
+ {/if} +
+
+

{translate('nexus.target')}

+

+ {translate('nexus.target-description')} +

+
+ + + +
+

+ {translate('nexus.access-policy')} +

+

+ {translate('nexus.allowed-caller-namespaces-description')} +

+
+ +
+
+

+ {translate('nexus.description-label')} +

+ +

+ {translate('nexus.description-hint')} +

+
+
+ {/snippet} + {#if card} + + {@render fields()} + + {:else} + {@render fields()} + {/if}