diff --git a/dashboard/src/routes/scripts/[id]/+page.svelte b/dashboard/src/routes/scripts/[id]/+page.svelte index 330b261..3b3a5f7 100644 --- a/dashboard/src/routes/scripts/[id]/+page.svelte +++ b/dashboard/src/routes/scripts/[id]/+page.svelte @@ -278,13 +278,30 @@ } } - async function removeRoute(routeId: string) { - if (!confirm('Delete this route?')) return; + // F-U-007: ConfirmModal replaces the native confirm/alert flow so + // the route detail is in the body and any error gets an inline + // region instead of an unstyled browser modal. + let routeToRemove = $state(null); + let removingRoute = $state(false); + let removeRouteError = $state(null); + + function requestRemoveRoute(route: Route) { + routeToRemove = route; + removeRouteError = null; + } + + async function confirmRemoveRoute() { + if (!routeToRemove) return; + removingRoute = true; + removeRouteError = null; try { - await api.routes.remove(routeId); + await api.routes.remove(routeToRemove.id); + routeToRemove = null; await loadRoutes(); } catch (e) { - alert(e instanceof Error ? e.message : String(e)); + removeRouteError = e instanceof Error ? e.message : String(e); + } finally { + removingRoute = false; } } @@ -679,7 +696,7 @@ {r.path} {#if canWrite} - {/if} @@ -841,6 +858,29 @@ {/if} + {#if routeToRemove} + + (routeToRemove = null)} + > +

+ Delete route + {routeToRemove.method ?? 'ANY'} {routeToRemove.path} + {#if routeToRemove.host}on {routeToRemove.host}{/if}? +

+

Existing inbound requests will start 404'ing on this path immediately.

+ {#if removeRouteError} + + {/if} +
+ {/if} + {#if confirmingDelete && script}