Skip to content

Commit

Permalink
Ability to pass regex to form from create/edit (#2264)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Tideman authored Aug 12, 2024
1 parent d7781aa commit 0df27e6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/lib/pages/nexus-create-endpoint.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
export let error: NetworkError | undefined = undefined;
export let loading = false;
export let isCloud = false;
export let nameRegexPattern: RegExp = /^[A-Za-z_][A-Za-z0-9_]*$/;
$: createDisabled =
$endpointForm.spec.name === '' ||
Expand All @@ -30,7 +31,13 @@
<h1 data-testid="namespace-selector-title">
{translate('nexus.create-endpoint')}
</h1>
<NexusForm {error} {targetNamespaceList} {callerNamespaceList} {isCloud} />
<NexusForm
{nameRegexPattern}
{error}
{targetNamespaceList}
{callerNamespaceList}
{isCloud}
/>
<div class="flex items-center gap-4">
<Button
variant="primary"
Expand Down
2 changes: 2 additions & 0 deletions src/lib/pages/nexus-edit-endpoint.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
export let error: NetworkError | undefined = undefined;
export let loading = false;
export let isCloud = false;
export let nameRegexPattern: RegExp = /^[A-Za-z_][A-Za-z0-9_]*$/;
let deleteConfirmationModalOpen = false;
let confirmDeleteInput = '';
Expand Down Expand Up @@ -49,6 +50,7 @@
</div>
<NexusForm
{endpoint}
{nameRegexPattern}
{targetNamespaceList}
{callerNamespaceList}
{error}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/nexus-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
export let nameDisabled = false;
export let isCloud = true;
export let nameHintText = translate('nexus.endpoint-name-hint');
export let nameRegexPattern = /^[A-Za-z_][A-Za-z0-9_]*$/;
export let nameRegexPattern: RegExp;
let name = endpoint?.spec?.name || '';
let description = endpoint?.spec?.descriptionString || '';
Expand Down

0 comments on commit 0df27e6

Please sign in to comment.