Skip to content

The only tool you need to know what is happening and how to fix it.

ci: test the frontend on every labelled PR (#315)

FrameAutomata187026692ebf
diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml
new file mode 100644
index 00000000..c529e40d
--- /dev/null
+++ b/.github/workflows/frontend.yml
@@ -0,0 +1,66 @@
+name: Frontend
+
+# The frontend is a pure client-side SPA served from the backend image, and
+# release-traceway.yml builds it during a release -- so before this workflow a
+# broken build surfaced at release time, where it blocks shipping rather than
+# failing a PR.
+on:
+ push:
+ branches: [main]
+ paths:
+ - "frontend/**"
+ - ".github/workflows/frontend.yml"
+ pull_request:
+ types: [labeled]
+ paths:
+ - "frontend/**"
+ - ".github/workflows/frontend.yml"
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
+jobs:
+ check:
+ name: Typecheck, test, build and lint
+ if: github.event_name != 'pull_request' || github.event.label.name == 'ci'
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ defaults:
+ run:
+ working-directory: frontend
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+
+ # engines.node in frontend/package.json is the single source of truth for
+ # the Node version -- flake.nix reads that same field to build the dev
+ # shell, so CI and `nix develop` cannot drift.
+ - name: Setup Node
+ uses: actions/setup-node@v7
+ with:
+ node-version-file: frontend/package.json
+ cache: npm
+ cache-dependency-path: frontend/package-lock.json
+
+ # One job rather than three parallel ones (unlike backend.yml): these
+ # steps share a single node_modules and the install dominates the run, so
+ # splitting them would pay that cost three times over.
+ - name: Install
+ run: npm ci
+
+ - name: Typecheck
+ run: npm run check
+
+ - name: Test
+ run: npm run test
+
+ - name: Build
+ run: npm run build
+
+ - name: Lint
+ run: npm run lint
diff --git a/CLAUDE.md b/CLAUDE.md
index bb6d860b..5af41a58 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -27,6 +27,7 @@ Traceway is an error tracking and monitoring platform consisting of:
| Frontend | `cd frontend && npm run dev` | Dev server (port 5173) |
| Frontend | `npm run build` | Production build |
| Frontend | `npm run check` | TypeScript checking |
+| Frontend | `npm run lint` | `prettier --check . && eslint .` (CI gate; `npm run format` fixes the prettier half) |
| Backend | `cd backend && go run ./cmd/traceway` | API server (port 8082) |
| Backend | `cd backend && govulncheck ./...` | Vulnerability scan (default tags only); CI also scans the other storage build-tag combos (`.github/workflows/backend-vulncheck.yml`) |
| CLI | `cd cli && just build` | Builds `bin/traceway` |
@@ -1408,6 +1409,7 @@ type PaginationParams struct {
import { api } from '$lib/api'
import { projectsState } from '$lib/state/projects.svelte'
import { ErrorDisplay } from '$lib/components/ui/error-display'
+ import { getErrorMessage, getErrorStatus } from '$lib/utils/errors'
let data = $state<DataType[]>([])
let loading = $state(true)
@@ -1422,11 +1424,11 @@ type PaginationParams struct {
projectId: projectsState.currentProjectId ?? undefined
})
data = response.data || []
- } catch (e: any) {
- if (e.status === 404) {
+ } catch (e) {
+ if (getErrorStatus(e) === 404) {
notFound = true
} else {
- error = e.message || 'Failed to load data'
+ error = getErrorMessage(e) || 'Failed to load data'
}
} finally {
loading = false
diff --git a/frontend/src/lib/components/post-mortems/markdown-editor.svelte b/frontend/src/lib/components/post-mortems/markdown-editor.svelte
index dc7f3258..3b224230 100644
--- a/frontend/src/lib/components/post-mortems/markdown-editor.svelte
+++ b/frontend/src/lib/components/post-mortems/markdown-editor.svelte
@@ -182,7 +182,9 @@
<div class="relative min-h-[420px] rounded-md border">
{#if mode === 'rich' && failed}
- <div class="flex min-h-[420px] items-center justify-center px-4 text-center text-sm text-red-500">
+ <div
+ class="flex min-h-[420px] items-center justify-center px-4 text-center text-sm text-red-500"
+ >
Failed to load the editor. Switch to Markdown to keep editing.
</div>
{:else if mode === 'rich' && !ready}
diff --git a/frontend/src/lib/components/setup/manual-projects-editor.svelte b/frontend/src/lib/components/setup/manual-projects-editor.svelte
index d5fe37a1..a8c08c23 100644
--- a/frontend/src/lib/components/setup/manual-projects-editor.svelte
+++ b/frontend/src/lib/components/setup/manual-projects-editor.svelte
@@ -6,11 +6,7 @@
import { Input } from '$lib/components/ui/input';
import { Label } from '$lib/components/ui/label';
import { ErrorAlert } from '$lib/components/ui/error-alert';
- import {
- projectsState,
- type Framework,
- type ProjectWithToken
- } from '$lib/state/projects.svelte';
+ import { projectsState, type Framework, type ProjectWithToken } from '$lib/state/projects.svelte';
import FrameworkCombobox from '$lib/components/framework-combobox.svelte';
let {
@@ -26,9 +22,7 @@
type Row = { key: number; name: string; framework: Framework };
let nextKey = 1;
- let rows = $state<Row[]>([
- { key: 0, name: '', framework: untrack(() => initialFramework) }
- ]);
+ let rows = $state<Row[]>([{ key: 0, name: '', framework: untrack(() => initialFramework) }]);
let loading = $state(false);
let error = $state('');
@@ -67,8 +61,8 @@
<div class="border-b px-4 py-3">
<h3 class="font-semibold">Create Projects</h3>
<p class="mt-1 text-sm text-muted-foreground">
- One project per deployed application: a backend uses OpenTelemetry; each browser or mobile
- app gets its own project.
+ One project per deployed application: a backend uses OpenTelemetry; each browser or mobile app
+ gets its own project.
</p>
</div>
<div class="space-y-4 p-4">
@@ -83,12 +77,7 @@
</div>
{#each rows as row (row.key)}
<div class="grid grid-cols-1 gap-3 sm:grid-cols-[1fr_1fr_2rem] sm:items-center">
- <Input
- type="text"
- placeholder="My Application"
- bind:value={row.name}
- disabled={loading}
- />
+ <Input type="text" placeholder="My Application" bind:value={row.name} disabled={loading} />
<FrameworkCombobox bind:value={row.framework} disabled={loading} />
<div class="flex justify-end">
{#if rows.length > 1}
diff --git a/frontend/src/lib/components/setup/party-icon.svelte b/frontend/src/lib/components/setup/party-icon.svelte
index e30ab67f..af0f0898 100644
--- a/frontend/src/lib/components/setup/party-icon.svelte
+++ b/frontend/src/lib/components/setup/party-icon.svelte
@@ -1,12 +1,42 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 268" width="100%" height="100%">
- <path fill="#ff37ad" d="M22.498 68.97a11.845 11.845 0 1 0 0-23.687c-6.471.098-11.666 5.372-11.666 11.844s5.195 11.746 11.666 11.844m181.393-10.04a11.845 11.845 0 1 0-.003-23.688c-6.471.098-11.665 5.373-11.665 11.845c.001 6.472 5.197 11.745 11.668 11.842" />
- <path fill="#fcc954" d="M213.503 211.097a11.845 11.845 0 1 0-.003-23.687c-6.471.098-11.665 5.373-11.664 11.845s5.196 11.745 11.667 11.842M70.872 23.689a11.845 11.845 0 1 0 0-23.688C64.4.1 59.206 5.373 59.206 11.845S64.4 23.591 70.872 23.689" />
- <path fill="#2890e9" d="M140.945 105.94a9.25 9.25 0 0 1-8.974-11.484c.37-1.482.672-2.97.899-4.455a25.4 25.4 0 0 1-8.732 1.904c-5.379.205-10.195-.702-14.3-2.69a22.23 22.23 0 0 1-9.614-8.877c-4.415-7.652-4.034-17.718.964-25.645c4.765-7.568 12.836-11.664 21.586-10.995c6.74.527 12.647 3.051 17.378 7.382q1.293-3.647 2.473-7.803c4.833-17.058 6.429-34.187 6.442-34.36a9.24 9.24 0 0 1 10.041-8.37a9.25 9.25 0 0 1 8.37 10.044c-.067.767-1.768 19.03-7.068 37.735c-2.676 9.445-5.838 17.426-9.42 23.798q.396 2.13.631 4.372c.746 7.211.152 14.974-1.714 22.445a9.256 9.256 0 0 1-8.962 6.998m-20.123-43.827c-.956 0-2.64.28-3.996 2.43c-1.298 2.06-1.552 4.873-.588 6.544c1.282 2.223 5.054 2.417 7.19 2.336c2.424-.092 4.908-1.612 7.338-4.382a16 16 0 0 0-1.43-2.422c-2.007-2.787-4.547-4.212-7.998-4.482c-.13-.008-.305-.024-.516-.024" />
- <path fill="#f0a420" d="M114.361 131.268c-38.343-30.224-78.42-43.319-89.514-29.246a12.8 12.8 0 0 0-2.257 4.509a4 4 0 0 0-.156.61v.024q-.223.947-.333 1.917L.393 236.18c-3.477 20.412 16.73 36.755 35.967 29.093l117.721-46.908c2.076-.826 7.185-3.982 8.583-5.724q.556-.544 1.037-1.153c11.092-14.075-11-49.988-49.34-80.223z" />
- <path fill="#fcc954" d="M163.688 211.494c11.1-14.08-10.984-50-49.327-80.226c-38.343-30.227-78.425-43.316-89.524-29.236s10.983 50 49.326 80.226c38.343 30.227 78.425 43.316 89.525 29.236" />
- <path fill="#f0a420" d="M156.994 203.294c9.108-11.556-10.956-42.563-44.817-69.256c-33.861-26.695-68.697-38.966-77.804-27.413c-9.11 11.556 10.954 42.563 44.815 69.256c33.86 26.695 68.697 38.969 77.806 27.413" />
- <path fill="#2e6ac9" d="M76.059 249.456c-14.327.07-26.004-7.101-40.158-18.257C19.431 218.21 8.493 202.665 7.63 193.81l-4.668 27.327c2.16 7.798 9.523 17.683 20.202 26.101c8.883 7.004 17.844 11.813 27.135 12.48l25.76-10.266zm-14.332-49.6c-27.443-21.637-45.271-46.467-44.77-60.669l-4.549 26.63c.351 12.685 15.175 33.184 36.262 49.808c18.894 14.896 38.583 25.38 53.66 23.363l25.593-10.2c-20.62 1.425-42.376-10.147-66.196-28.931" />
- <path fill="#2890e9" d="M118.535 145.052a11.845 11.845 0 1 0 0-23.688c-6.471.098-11.666 5.372-11.666 11.844s5.195 11.746 11.666 11.844" />
- <path fill="#ff37ad" d="m182.412 122.007l.087-.097c.108-.116.308-.33.596-.621a45 45 0 0 1 2.8-2.56c3.56-2.98 7.45-5.54 11.594-7.63c10.128-5.125 25.208-9.307 44.985-4.747c5.943 1.37 11.87-2.336 13.241-8.278c1.37-5.942-2.336-11.87-8.278-13.24c-25.602-5.903-45.957-.506-59.922 6.566a82.5 82.5 0 0 0-15.857 10.449a66 66 0 0 0-4.215 3.866a45 45 0 0 0-1.53 1.615l-.12.135l-.042.048l-.02.022l-.007.008c-.003.005-.009.01 8.361 7.21l-8.37-7.2c-3.877 4.622-3.328 11.5 1.233 15.448s11.446 3.506 15.464-.994M73.03 43.248a11.75 11.75 0 0 0-16.23-3.664a11.76 11.76 0 0 0-3.665 16.227c.427.683 9.178 14.86 10.976 34.276c1.83 19.727-3.966 37.86-17.253 54.12c4.474 5.686 9.858 11.596 16.008 17.507c8.51-9.834 14.913-20.402 19.12-31.583c5.175-13.756 7.006-28.342 5.445-43.348c-2.487-23.874-12.874-41.11-14.402-43.535" />
- <path fill="#2890e9" d="M220.242 156.578c6.002 1.553 10.244 3.246 12.077 4.034a11.86 11.86 0 0 0 13.94-1.12a11.87 11.87 0 0 0 4.107-8.765a11.85 11.85 0 0 0-8.06-11.426c-5.618-2.495-26.905-10.92-55.044-9.423c-18.941 1.007-37.155 6.253-54.133 15.608c-16.076 8.86-31.004 21.412-44.556 37.425a199 199 0 0 0 20.17 12.607c22.882-26.08 49.283-40.217 78.7-42.085a105.9 105.9 0 0 1 32.8 3.145" />
+ <path
+ fill="#ff37ad"
+ d="M22.498 68.97a11.845 11.845 0 1 0 0-23.687c-6.471.098-11.666 5.372-11.666 11.844s5.195 11.746 11.666 11.844m181.393-10.04a11.845 11.845 0 1 0-.003-23.688c-6.471.098-11.665 5.373-11.665 11.845c.001 6.472 5.197 11.745 11.668 11.842"
+ />
+ <path
+ fill="#fcc954"
+ d="M213.503 211.097a11.845 11.845 0 1 0-.003-23.687c-6.471.098-11.665 5.373-11.664 11.845s5.196 11.745 11.667 11.842M70.872 23.689a11.845 11.845 0 1 0 0-23.688C64.4.1 59.206 5.373 59.206 11.845S64.4 23.591 70.872 23.689"
+ />
+ <path
+ fill="#2890e9"
+ d="M140.945 105.94a9.25 9.25 0 0 1-8.974-11.484c.37-1.482.672-2.97.899-4.455a25.4 25.4 0 0 1-8.732 1.904c-5.379.205-10.195-.702-14.3-2.69a22.23 22.23 0 0 1-9.614-8.877c-4.415-7.652-4.034-17.718.964-25.645c4.765-7.568 12.836-11.664 21.586-10.995c6.74.527 12.647 3.051 17.378 7.382q1.293-3.647 2.473-7.803c4.833-17.058 6.429-34.187 6.442-34.36a9.24 9.24 0 0 1 10.041-8.37a9.25 9.25 0 0 1 8.37 10.044c-.067.767-1.768 19.03-7.068 37.735c-2.676 9.445-5.838 17.426-9.42 23.798q.396 2.13.631 4.372c.746 7.211.152 14.974-1.714 22.445a9.256 9.256 0 0 1-8.962 6.998m-20.123-43.827c-.956 0-2.64.28-3.996 2.43c-1.298 2.06-1.552 4.873-.588 6.544c1.282 2.223 5.054 2.417 7.19 2.336c2.424-.092 4.908-1.612 7.338-4.382a16 16 0 0 0-1.43-2.422c-2.007-2.787-4.547-4.212-7.998-4.482c-.13-.008-.305-.024-.516-.024"
+ />
+ <path
+ fill="#f0a420"
+ d="M114.361 131.268c-38.343-30.224-78.42-43.319-89.514-29.246a12.8 12.8 0 0 0-2.257 4.509a4 4 0 0 0-.156.61v.024q-.223.947-.333 1.917L.393 236.18c-3.477 20.412 16.73 36.755 35.967 29.093l117.721-46.908c2.076-.826 7.185-3.982 8.583-5.724q.556-.544 1.037-1.153c11.092-14.075-11-49.988-49.34-80.223z"
+ />
+ <path
+ fill="#fcc954"
+ d="M163.688 211.494c11.1-14.08-10.984-50-49.327-80.226c-38.343-30.227-78.425-43.316-89.524-29.236s10.983 50 49.326 80.226c38.343 30.227 78.425 43.316 89.525 29.236"
+ />
+ <path
+ fill="#f0a420"
+ d="M156.994 203.294c9.108-11.556-10.956-42.563-44.817-69.256c-33.861-26.695-68.697-38.966-77.804-27.413c-9.11 11.556 10.954 42.563 44.815 69.256c33.86 26.695 68.697 38.969 77.806 27.413"
+ />
+ <path
+ fill="#2e6ac9"
+ d="M76.059 249.456c-14.327.07-26.004-7.101-40.158-18.257C19.431 218.21 8.493 202.665 7.63 193.81l-4.668 27.327c2.16 7.798 9.523 17.683 20.202 26.101c8.883 7.004 17.844 11.813 27.135 12.48l25.76-10.266zm-14.332-49.6c-27.443-21.637-45.271-46.467-44.77-60.669l-4.549 26.63c.351 12.685 15.175 33.184 36.262 49.808c18.894 14.896 38.583 25.38 53.66 23.363l25.593-10.2c-20.62 1.425-42.376-10.147-66.196-28.931"
+ />
+ <path
+ fill="#2890e9"
+ d="M118.535 145.052a11.845 11.845 0 1 0 0-23.688c-6.471.098-11.666 5.372-11.666 11.844s5.195 11.746 11.666 11.844"
+ />
+ <path
+ fill="#ff37ad"
+ d="m182.412 122.007l.087-.097c.108-.116.308-.33.596-.621a45 45 0 0 1 2.8-2.56c3.56-2.98 7.45-5.54 11.594-7.63c10.128-5.125 25.208-9.307 44.985-4.747c5.943 1.37 11.87-2.336 13.241-8.278c1.37-5.942-2.336-11.87-8.278-13.24c-25.602-5.903-45.957-.506-59.922 6.566a82.5 82.5 0 0 0-15.857 10.449a66 66 0 0 0-4.215 3.866a45 45 0 0 0-1.53 1.615l-.12.135l-.042.048l-.02.022l-.007.008c-.003.005-.009.01 8.361 7.21l-8.37-7.2c-3.877 4.622-3.328 11.5 1.233 15.448s11.446 3.506 15.464-.994M73.03 43.248a11.75 11.75 0 0 0-16.23-3.664a11.76 11.76 0 0 0-3.665 16.227c.427.683 9.178 14.86 10.976 34.276c1.83 19.727-3.966 37.86-17.253 54.12c4.474 5.686 9.858 11.596 16.008 17.507c8.51-9.834 14.913-20.402 19.12-31.583c5.175-13.756 7.006-28.342 5.445-43.348c-2.487-23.874-12.874-41.11-14.402-43.535"
+ />
+ <path
+ fill="#2890e9"
+ d="M220.242 156.578c6.002 1.553 10.244 3.246 12.077 4.034a11.86 11.86 0 0 0 13.94-1.12a11.87 11.87 0 0 0 4.107-8.765a11.85 11.85 0 0 0-8.06-11.426c-5.618-2.495-26.905-10.92-55.044-9.423c-18.941 1.007-37.155 6.253-54.133 15.608c-16.076 8.86-31.004 21.412-44.556 37.425a199 199 0 0 0 20.17 12.607c22.882-26.08 49.283-40.217 78.7-42.085a105.9 105.9 0 0 1 32.8 3.145"
+ />
</svg>
diff --git a/frontend/src/lib/components/setup/setup-draft-review.svelte b/frontend/src/lib/components/setup/setup-draft-review.svelte
index dfed8cb1..6d874ec8 100644
--- a/frontend/src/lib/components/setup/setup-draft-review.svelte
+++ b/frontend/src/lib/components/setup/setup-draft-review.svelte
@@ -94,8 +94,7 @@
{/if}
{#if project.deployment}
<div>
- Deployment: {project.deployment.platform} (instructions shown here after
- approval)
+ Deployment: {project.deployment.platform} (instructions shown here after approval)
</div>
{/if}
</div>
@@ -116,9 +115,7 @@
<Button variant="outline" onclick={() => (rejecting = false)} disabled={loading}>
Back
</Button>
- <Button variant="destructive" onclick={reject} disabled={loading}>
- Reject Proposal
- </Button>
+ <Button variant="destructive" onclick={reject} disabled={loading}>Reject Proposal</Button>
</div>
</div>
{:else}
diff --git a/frontend/src/lib/components/setup/setup-live-projects.svelte b/frontend/src/lib/components/setup/setup-live-projects.svelte
index c44420c2..b3e0f783 100644
--- a/frontend/src/lib/components/setup/setup-live-projects.svelte
+++ b/frontend/src/lib/components/setup/setup-live-projects.svelte
@@ -34,9 +34,7 @@
{#each projects as project (project.id)}
{@const isNew = !initialProjectIds.has(project.id)}
<li
- class="flex items-center gap-3 rounded-md border px-3 py-2 {isNew
- ? ''
- : 'opacity-60'}"
+ class="flex items-center gap-3 rounded-md border px-3 py-2 {isNew ? '' : 'opacity-60'}"
>
<FrameworkIcon framework={project.framework} class="size-5 shrink-0" />
<div class="min-w-0 flex-1">
diff --git a/frontend/src/lib/components/setup/setup-token-panel.svelte b/frontend/src/lib/components/setup/setup-token-panel.svelte
index 9a99ef8c..55a3e668 100644
--- a/frontend/src/lib/components/setup/setup-token-panel.svelte
+++ b/frontend/src/lib/components/setup/setup-token-panel.svelte
@@ -24,7 +24,9 @@
});
const expired = $derived(setupToken !== null && minutesLeft <= 0);
const timeLeftLabel = $derived(
- minutesLeft >= 90 ? `${Math.floor(minutesLeft / 60)} h ${minutesLeft % 60} min` : `${minutesLeft} min`
+ minutesLeft >= 90
+ ? `${Math.floor(minutesLeft / 60)} h ${minutesLeft % 60} min`
+ : `${minutesLeft} min`
);
const promptParts = $derived(
setupToken ? getSetupTokenPromptParts(setupToken.backendUrl, setupToken.token) : []
diff --git a/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte b/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte
index 627a9de5..f3cd245c 100644
--- a/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte
+++ b/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte
@@ -471,7 +471,10 @@
</button>
</Popover.Trigger>
<Popover.Content class="w-auto p-0" align="start">
- <DateTimeCalendar value={tempFromDateTime} onValueChange={handleFromDateTimeChange} />
+ <DateTimeCalendar
+ value={tempFromDateTime}
+ onValueChange={handleFromDateTimeChange}
+ />
</Popover.Content>
</Popover.Root>
diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte
index 8e488308..6b2c78e9 100644
--- a/frontend/src/routes/+page.svelte
+++ b/frontend/src/routes/+page.svelte
@@ -390,7 +390,7 @@ service:
<p class="mb-4 max-w-md text-sm text-muted-foreground">
Let your coding agent propose the setup for your approval, or create projects manually.
</p>
- <Button onclick={() => goto('/setup')}>
+ <Button onclick={() => goto(resolve('/setup'))}>
Set Up Projects
<ArrowRight class="ml-2 h-4 w-4" />
</Button>
diff --git a/frontend/src/routes/connection/+page.svelte b/frontend/src/routes/connection/+page.svelte
index d6e1474e..891063f2 100644
--- a/frontend/src/routes/connection/+page.svelte
+++ b/frontend/src/routes/connection/+page.svelte
@@ -7,6 +7,7 @@
CardTitle
} from '$lib/components/ui/card';
import { goto } from '$app/navigation';
+ import { resolve } from '$app/paths';
import { Button } from '$lib/components/ui/button';
import {
projectsState,
@@ -231,7 +232,7 @@ service:
No project selected yet. Let your coding agent propose the setup, or create a project from
the dropdown above.
</p>
- <Button onclick={() => goto('/setup')}>Set Up Projects</Button>
+ <Button onclick={() => goto(resolve('/setup'))}>Set Up Projects</Button>
</CardContent>
</Card>
{/if}
diff --git a/frontend/src/routes/dashboards/+page.svelte b/frontend/src/routes/dashboards/+page.svelte
index 62a31b5f..1860aa72 100644
--- a/frontend/src/routes/dashboards/+page.svelte
+++ b/frontend/src/routes/dashboards/+page.svelte
@@ -193,7 +193,9 @@
url.searchParams.delete('server');
}
serverScope = normalized;
- replaceState(url.pathname + url.search + url.hash, {});
+ let target = resolve('/dashboards');
+ target += url.search + url.hash;
+ replaceState(target, {});
}
function updateDashboardUrl(params: Record<string, string>) {
diff --git a/frontend/src/routes/finish-setup/+page.svelte b/frontend/src/routes/finish-setup/+page.svelte
index d418b51f..986cf041 100644
--- a/frontend/src/routes/finish-setup/+page.svelte
+++ b/frontend/src/routes/finish-setup/+page.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { resolve } from '$app/paths';
+ import { base, resolve } from '$app/paths';
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import { Button } from '$lib/components/ui/button';
@@ -63,7 +63,11 @@
returnTo = safeLocalPath(consumeSsoReturnTo());
if (newOrgId === null) {
- goto(returnTo);
+ // returnTo is a concrete path from the SSO handoff, not a route id.
+ // resolve() substitutes [params] and throws a TypeError on any path
+ // containing brackets, so prefix the base path directly.
+ // eslint-disable-next-line svelte/no-navigation-without-resolve
+ goto(base + returnTo);
return;
}
phase = 'projects';
diff --git a/frontend/src/routes/monitors/post-mortems/[id]/+page.svelte b/frontend/src/routes/monitors/post-mortems/[id]/+page.svelte
index 672c9393..91dcb6df 100644
--- a/frontend/src/routes/monitors/post-mortems/[id]/+page.svelte
+++ b/frontend/src/routes/monitors/post-mortems/[id]/+page.svelte
@@ -349,8 +349,8 @@
<AlertDialog.Header>
<AlertDialog.Title>Link Incident</AlertDialog.Title>
<AlertDialog.Description>
- Link this post-mortem to the incident it covers. Incidents that already have a
- post-mortem are not listed.
+ Link this post-mortem to the incident it covers. Incidents that already have a post-mortem
+ are not listed.
</AlertDialog.Description>
</AlertDialog.Header>
<div class="space-y-3">
diff --git a/frontend/src/routes/monitors/status-pages-tab.svelte b/frontend/src/routes/monitors/status-pages-tab.svelte
index 45dffaea..acb80fe7 100644
--- a/frontend/src/routes/monitors/status-pages-tab.svelte
+++ b/frontend/src/routes/monitors/status-pages-tab.svelte
@@ -17,16 +17,7 @@
import { projectsState } from '$lib/state/projects.svelte';
import { authState } from '$lib/state/auth.svelte';
import type { SyntheticCheck } from '$lib/state/monitors.svelte';
- import {
- Check,
- ExternalLink,
- Globe,
- ImageUp,
- Pencil,
- Plus,
- Siren,
- Trash2
- } from '@lucide/svelte';
+ import { Check, ExternalLink, Globe, ImageUp, Pencil, Plus, Siren, Trash2 } from '@lucide/svelte';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
import { resolve } from '$app/paths';
diff --git a/frontend/src/routes/organization/overview-tab.svelte b/frontend/src/routes/organization/overview-tab.svelte
index 531691f7..eed5ddee 100644
--- a/frontend/src/routes/organization/overview-tab.svelte
+++ b/frontend/src/routes/organization/overview-tab.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { resolve } from '$app/paths';
+ import { resolveHref } from '$lib/utils/links';
import { api } from '$lib/api';
import { getErrorMessage } from '$lib/utils/errors';
import { formatRelativeTimeAgo } from '$lib/utils/formatters';
@@ -261,11 +261,13 @@
const allServerNames = $derived(servers.map((server) => server.serverName));
const hasKubernetesMetadata = $derived(servers.some((server) => !!server.k8sClusterName));
const projectOptions = $derived.by(() => {
- const projects = new Map<string, string>();
- for (const server of servers) projects.set(server.projectId, server.projectName);
- return [...projects.entries()]
- .map(([id, name]) => ({ id, name }))
- .sort((a, b) => a.name.localeCompare(b.name));
+ const byProject = new Map(
+ servers.map((server) => [
+ server.projectId,
+ { id: server.projectId, name: server.projectName }
+ ])
+ );
+ return [...byProject.values()].sort((a, b) => a.name.localeCompare(b.name));
});
$effect(() => {
@@ -317,6 +319,8 @@
return [{ key: 'all', label: 'All instances', subtitle: '', servers: visibleServers }];
}
+ // Scratch map: never escapes this derived, only the sorted array of its values is returned.
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
const grouped = new Map<string, ServerGroup>();
for (const server of visibleServers) {
const cluster = server.k8sClusterName.trim();
@@ -390,14 +394,14 @@
const params = new URLSearchParams({
projectId: server.projectId,
server: server.serverName,
- preset: '30m'
+ preset: '30m',
+ ...(server.dashboardId ? { dashboard: String(server.dashboardId) } : {})
});
- if (server.dashboardId) params.set('dashboard', String(server.dashboardId));
- return `${resolve('/dashboards')}?${params.toString()}`;
+ return `/dashboards?${params.toString()}`;
}
function organizationTabHref(tab: string): string {
- return `${resolve('/organization')}?organizationId=${organizationId}&tab=${tab}`;
+ return `/organization?organizationId=${organizationId}&tab=${tab}`;
}
function osLabel(server: OrgServerRow): string {
@@ -512,7 +516,7 @@
</div>
{/if}
<a
- href={organizationTabHref('issues')}
+ {...{ href: resolveHref(organizationTabHref('issues')) }}
class="group border-r px-5 py-4 transition-colors hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset"
>
<div class="flex items-center justify-between text-xs text-muted-foreground">
@@ -525,7 +529,7 @@
</a>
{#if hasBackendProjects}
<a
- href={organizationTabHref('monitors')}
+ {...{ href: resolveHref(organizationTabHref('monitors')) }}
class="group px-5 py-4 transition-colors hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset"
>
<div class="flex items-center justify-between text-xs text-muted-foreground">
@@ -720,7 +724,7 @@
{#each group.servers as server (server.projectId + server.serverName)}
{@const state = instanceState(server)}
<a
- href={instanceHref(server)}
+ {...{ href: resolveHref(instanceHref(server)) }}
class="group/instance grid gap-4 border-b px-4 py-4 transition-colors last:border-b-0 hover:bg-muted/35 focus-visible:bg-muted/35 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset lg:grid-cols-[minmax(250px,1.7fr)_104px_104px_104px_minmax(155px,0.9fr)_125px_28px] lg:items-center lg:gap-0 lg:py-3"
>
<div class="flex min-w-0 items-center gap-3">
diff --git a/frontend/src/routes/register/+page.svelte b/frontend/src/routes/register/+page.svelte
index 638dc8c6..b3555896 100644
--- a/frontend/src/routes/register/+page.svelte
+++ b/frontend/src/routes/register/+page.svelte
@@ -167,10 +167,7 @@
</CardHeader>
<CardContent>
{#if step === 'projects' && newOrgId !== null}
- <SetupProjectsStep
- organizationId={newOrgId}
- {initialFramework}
- />
+ <SetupProjectsStep organizationId={newOrgId} {initialFramework} />
{:else}
{#if error}
<ErrorAlert {error} class="mb-4" />
diff --git a/frontend/src/routes/setup/+page.svelte b/frontend/src/routes/setup/+page.svelte
index 797ff99b..3659c9b6 100644
--- a/frontend/src/routes/setup/+page.svelte
+++ b/frontend/src/routes/setup/+page.svelte
@@ -17,9 +17,7 @@
: (writableOrgs[0]?.id ?? null);
});
- const selectedOrgName = $derived(
- writableOrgs.find((o) => o.id === selectedOrgId)?.name ?? ''
- );
+ const selectedOrgName = $derived(writableOrgs.find((o) => o.id === selectedOrgId)?.name ?? '');
</script>
<div class="mx-auto w-full max-w-2xl space-y-6">