Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit 8db8cfc

Browse files
committed
Dynamic Endpoints to method routings
1 parent 9782413 commit 8db8cfc

2 files changed

Lines changed: 76 additions & 4 deletions

File tree

src/lib/components/DynamicEndpointOperationsTable.svelte

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@
331331
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Operation ID</th>
332332
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Resolves to</th>
333333
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">JSON Schema</th>
334+
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Method Routing</th>
334335
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Try it</th>
335336
</tr>
336337
</thead>
@@ -406,6 +407,21 @@
406407
{/if}
407408
{/if}
408409
</td>
410+
<td class="whitespace-nowrap px-4 py-3 align-top text-xs">
411+
{#if op.operationId}
412+
{@const mrParams = new URLSearchParams({
413+
prefill_method_name: op.operationId,
414+
...(bankId ? { prefill_bank_id_pattern: bankId, prefill_is_bank_id_exact_match: "true" } : {}),
415+
})}
416+
<a
417+
href={`/integration/method-routings?${mrParams.toString()}`}
418+
data-testid="configure-routing-link"
419+
class="text-blue-600 hover:underline dark:text-blue-400"
420+
>Configure routing →</a>
421+
{:else}
422+
<span class="text-gray-400 dark:text-gray-500">—</span>
423+
{/if}
424+
</td>
409425
<td class="whitespace-nowrap px-4 py-3 align-top text-xs">
410426
<button
411427
type="button"
@@ -417,7 +433,7 @@
417433
</tr>
418434
{#if isSchemaOpen}
419435
<tr data-testid="validation-editor-row">
420-
<td colspan="7" class="px-4 py-4 bg-gray-50 dark:bg-gray-900/40">
436+
<td colspan="8" class="px-4 py-4 bg-gray-50 dark:bg-gray-900/40">
421437
<div class="space-y-3">
422438
<div class="flex items-baseline justify-between">
423439
<h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">
@@ -468,7 +484,7 @@
468484
{/if}
469485
{#if isTryOpen}
470486
<tr data-testid="try-it-row">
471-
<td colspan="7" class="px-4 py-4 bg-gray-50 dark:bg-gray-900/40">
487+
<td colspan="8" class="px-4 py-4 bg-gray-50 dark:bg-gray-900/40">
472488
<div class="space-y-3">
473489
<div class="flex items-baseline justify-between">
474490
<h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">

src/routes/(protected)/integration/method-routings/+page.svelte

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,46 @@
312312
return !routing.method_routing_id || routing.method_routing_id === "";
313313
}
314314
315-
onMount(() => {
315+
// Read deep-link query params (e.g. from Dynamic Endpoint operations table)
316+
// and pre-open the create form with fields pre-filled.
317+
let prefillBanner = $state<string | null>(null);
318+
function applyPrefillFromUrl() {
319+
if (typeof window === "undefined") return;
320+
const params = new URLSearchParams(window.location.search);
321+
const prefillMethod = params.get("prefill_method_name");
322+
if (!prefillMethod) return;
323+
324+
const prefillConnector = params.get("prefill_connector_name") || "";
325+
const prefillBankPattern = params.get("prefill_bank_id_pattern") || "";
326+
const prefillExact = params.get("prefill_is_bank_id_exact_match") === "true";
327+
328+
// Dynamic Endpoint operationIds are not part of /system/connector-method-names,
329+
// so add the prefilled name to the options list. Without this, bind:value on the
330+
// <select> can't match any <option> and the field resets to empty.
331+
if (!methodNames.includes(prefillMethod)) {
332+
methodNames = [prefillMethod, ...methodNames];
333+
}
334+
335+
formData = {
336+
method_name: prefillMethod,
337+
connector_name: prefillConnector,
338+
is_bank_id_exact_match: prefillExact,
339+
bank_id_pattern: prefillBankPattern,
340+
parameters: "",
341+
};
342+
showCreateForm = true;
343+
prefillBanner = `Pre-filled from a Dynamic Endpoint operation: ${prefillMethod}. Edit the connector and parameters before saving.`;
344+
scrollToForm();
345+
}
346+
347+
onMount(async () => {
316348
fetchMethodRoutings();
317-
fetchMethodNames();
318349
fetchConnectorNames();
319350
fetchBankIds();
351+
// Await method names before applying the URL prefill so the <select> options
352+
// are populated when we set formData.method_name.
353+
await fetchMethodNames();
354+
applyPrefillFromUrl();
320355
});
321356
</script>
322357

@@ -344,6 +379,15 @@
344379
{/if}
345380
</div>
346381

382+
<!-- Prefill banner (from Dynamic Endpoint deep-link) -->
383+
{#if prefillBanner}
384+
<div class="alert alert-info mb-6" data-testid="prefill-banner">
385+
<strong>ℹ️</strong>
386+
{prefillBanner}
387+
<button onclick={() => (prefillBanner = null)} class="alert-close">×</button>
388+
</div>
389+
{/if}
390+
347391
<!-- Messages -->
348392
{#if error}
349393
<div class="alert alert-error mb-6">
@@ -1050,6 +1094,18 @@
10501094
border-color: rgb(var(--color-success-800));
10511095
}
10521096
1097+
.alert-info {
1098+
background: #dbeafe;
1099+
color: #1e40af;
1100+
border: 1px solid #bfdbfe;
1101+
}
1102+
1103+
:global([data-mode="dark"]) .alert-info {
1104+
background: rgba(59, 130, 246, 0.15);
1105+
color: #93c5fd;
1106+
border-color: rgba(59, 130, 246, 0.3);
1107+
}
1108+
10531109
.alert-close {
10541110
background: transparent;
10551111
border: none;

0 commit comments

Comments
 (0)