-
Notifications
You must be signed in to change notification settings - Fork 5
Svelte front end #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: fastapi
Are you sure you want to change the base?
Svelte front end #95
Conversation
Basic aladin visualisation implementation complete.
Address linting issues.
Add search pointings page. More visualization tweaks. Signed-off-by: Steve Foale <sfoale@lco.global>
Visualization improvements.
Attempting to get visualization centring correct.
Refactor the api into individual services and types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a new SvelteKit frontend surface area (UI primitives, search/forms, alert “service” components) plus a typed API client/services layer and supporting tooling/config for building, testing, and deployment.
Changes:
- Introduces reusable UI components (loading/error, card/button, carousel, form helpers) and new tables/search panels.
- Adds typed API client (
axios) + service modules + TS types for FastAPI endpoints, plus frontend build/test workflows. - Adds frontend runtime assets/config (Tailwind layers, app.html CDN deps, Docker/nginx, docs standards).
Reviewed changes
Copilot reviewed 91 out of 379 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/lib/components/ui/LoadingState.svelte | New reusable loading-state UI component. |
| frontend/src/lib/components/ui/LoadingSpinner.svelte | New spinner component with sizing/message options. |
| frontend/src/lib/components/ui/FootprintVisualization.svelte | Adds Plotly footprint visualization UI. |
| frontend/src/lib/components/ui/ErrorToast.svelte | Adds global error toast UI. |
| frontend/src/lib/components/ui/ErrorMessage.svelte | Adds inline error/warn/info message UI. |
| frontend/src/lib/components/ui/ErrorBoundary.svelte | Adds UI error boundary with retry/reset. |
| frontend/src/lib/components/ui/ControlGroup.svelte | Adds labeled form control wrapper with help/error text. |
| frontend/src/lib/components/ui/Carousel.svelte | Adds image carousel with autoplay and controls. |
| frontend/src/lib/components/ui/Card.svelte | Adds base Card UI container component. |
| frontend/src/lib/components/ui/Button.svelte | Adds variant/size Button component with loading + link mode. |
| frontend/src/lib/components/ui/AsyncErrorBoundary.svelte | Adds async wrapper that shows spinner + uses ErrorBoundary. |
| frontend/src/lib/components/ui/AlertBanner.svelte | Adds dismissible alert banner component. |
| frontend/src/lib/components/tables/ReportingInstrumentsTable.svelte | Adds reporting instruments table using new UI primitives. |
| frontend/src/lib/components/search/PointingsTable.svelte | Adds pointings results table with selection support. |
| frontend/src/lib/components/search/PointingsSearchForm.svelte | Adds search filter form for pointings. |
| frontend/src/lib/components/search/DoiRequestPanel.svelte | Adds DOI request UI for selected pointings. |
| frontend/src/lib/components/layout/Navigation.svelte | Adds top navigation with auth links. |
| frontend/src/lib/components/layout/InstrumentStats.svelte | Adds instrument summary stats widgets. |
| frontend/src/lib/components/instruments/ExistingInstrumentsTable.svelte | Adds “existing instruments” reference table UI. |
| frontend/src/lib/components/forms/examples/RegisterFormExample.svelte | Example registration form using validation schemas. |
| frontend/src/lib/components/forms/examples/LoginFormExample.svelte | Example login form using validation schemas. |
| frontend/src/lib/components/forms/TimeField.svelte | Adds specialized datetime input + validation wrapper. |
| frontend/src/lib/components/forms/FootprintTypeSelector.svelte | Adds footprint type selector with conditional inputs. |
| frontend/src/lib/components/forms/CoordinateFields.svelte | Adds RA/Dec input fields with validation and summary. |
| frontend/src/lib/components/forms/ConditionalSection.svelte | Adds conditional section with slide animation. |
| frontend/src/lib/components/alerts/services/UrlParameterService.svelte | Adds URL param parsing/building “service component”. |
| frontend/src/lib/components/alerts/services/PaginationService.svelte | Adds pagination state “service component”. |
| frontend/src/lib/components/alerts/services/FilterManagementService.svelte | Adds alert filter state/options “service component”. |
| frontend/src/lib/components/alerts/services/AlertStatusService.svelte | Adds alert status helper “service component”. |
| frontend/src/lib/components/alerts/services/AlertSearchService.svelte | Adds alert autocomplete search “service component”. |
| frontend/src/lib/components/alerts/services/AlertDataProcessingService.svelte | Adds alert loading/processing “service component”. |
| frontend/src/lib/components/alerts/SearchFiltersForm.svelte | Adds alert search filters UI with autocomplete. |
| frontend/src/lib/components/alerts/AlertHeaderComponent.svelte | Adds alert header UI wiring status + download links. |
| frontend/src/lib/api/types/pointing.types.ts | Adds Pointing-related API types. |
| frontend/src/lib/api/types/misc.types.ts | Adds misc API response types. |
| frontend/src/lib/api/types/instrument.types.ts | Adds instrument + footprint API types. |
| frontend/src/lib/api/types/icecube.types.ts | Adds IceCube API types. |
| frontend/src/lib/api/types/galaxy.types.ts | Adds galaxy + filters API types. |
| frontend/src/lib/api/types/doi.types.ts | Adds DOI API types. |
| frontend/src/lib/api/types/candidate.types.ts | Adds candidate API types. |
| frontend/src/lib/api/types/alert.types.ts | Adds GW alert API types. |
| frontend/src/lib/api/services/search.service.ts | Adds combined search/DOI helper service. |
| frontend/src/lib/api/services/pointing.service.ts | Adds pointings API service functions. |
| frontend/src/lib/api/services/misc.service.ts | Adds health/status API service functions. |
| frontend/src/lib/api/services/instrument.service.ts | Adds instruments/footprints API service functions. |
| frontend/src/lib/api/services/icecube.service.ts | Adds IceCube API service functions. |
| frontend/src/lib/api/services/galaxy.service.ts | Adds galaxy API service functions. |
| frontend/src/lib/api/services/doi.service.ts | Adds DOI API service functions. |
| frontend/src/lib/api/services/candidate.service.ts | Adds candidate API service functions. |
| frontend/src/lib/api/services/auth.service.ts | Adds auth API service functions. |
| frontend/src/lib/api/services/alert.service.ts | Adds alert querying + contour helpers. |
| frontend/src/lib/api/services/ajax.service.ts | Adds legacy-style ajax endpoint wrappers. |
| frontend/src/lib/api/index.ts | Exports aggregated API surface + types. |
| frontend/src/lib/api/client.ts | Adds axios client with auth + environment baseURL logic. |
| frontend/src/app.html | Adds CDN deps for jQuery/Aladin/Plotly. |
| frontend/src/app.css | Adds Tailwind + design system layer utilities. |
| frontend/src/tests/setup.ts | Adds Vitest test setup/mocks. |
| frontend/scripts/migrate-styles.js | Adds migration helper script for design system classes. |
| frontend/package.json.docs-script | Adds docs script snippet file. |
| frontend/package.json | Adds frontend dependencies/scripts. |
| frontend/nginx.conf | Adds nginx config for SPA + API proxy. |
| frontend/eslint.config.js | Adds eslint config + ignore list. |
| frontend/docs/component-documentation-standards.md | Adds component documentation standards doc. |
| frontend/README.md | Adds frontend developer documentation. |
| frontend/Dockerfile | Adds multi-stage build + nginx runtime. |
| frontend/.prettierrc | Adds prettier config for Svelte. |
| frontend/.prettierignore | Adds prettier ignore patterns. |
| frontend/.npmrc | Enforces engine-strict for Node. |
| frontend/.gitignore | Adds frontend gitignore rules. |
| frontend/.env.example | Adds example env config for API base URL. |
| docker-compose.yml | Removes redis/celery services from compose. |
| argocd-config/cluster-gwtm-dev.yaml | Adds ArgoCD cluster secret config. |
| argocd-config/argocd-config-app.yaml | Adds ArgoCD app to sync config repo path. |
| argocd-config/README.md | Documents ArgoCD config bootstrap and workflow. |
| README.md | Updates root README with FastAPI quick start + env var list. |
| .github/workflows/frontend-tests.yml | Adds frontend CI (check/lint/test/coverage). |
| .github/workflows/fastapi-tests.yml | Adds FastAPI CI with Dockerized DB + API tests. |
| .github/workflows/build-all.yml | Adds multi-image build/push workflow. |
| .dockerignore | Expands dockerignore patterns for leaner builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @default '' | ||
| */ | ||
| export let spinnerClass: string = ''; | ||
|
|
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reactive assignments are creating containerClass, spinnerSize, and textSize without declaring them. In Svelte (+ TS), assigning to undeclared variables is a compile-time error. Declare these (let containerClass = '', let spinnerSize = '', let textSize = '') with appropriate types before using them in $: blocks.
| // Derived class strings used in reactive statements | |
| let containerClass: string = ''; | |
| let spinnerSize: string = ''; | |
| let textSize: string = ''; |
| .filter(Boolean) | ||
| .join(' '); | ||
|
|
||
| $: spinnerSize = { |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reactive assignments are creating containerClass, spinnerSize, and textSize without declaring them. In Svelte (+ TS), assigning to undeclared variables is a compile-time error. Declare these (let containerClass = '', let spinnerSize = '', let textSize = '') with appropriate types before using them in $: blocks.
| large: 'h-12 w-12' | ||
| }[size]; | ||
|
|
||
| $: textSize = { |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reactive assignments are creating containerClass, spinnerSize, and textSize without declaring them. In Svelte (+ TS), assigning to undeclared variables is a compile-time error. Declare these (let containerClass = '', let spinnerSize = '', let textSize = '') with appropriate types before using them in $: blocks.
| lg: 'h-16 w-16', | ||
| xl: 'h-32 w-32' | ||
| }; | ||
|
|
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spinnerClass and containerClass are assigned in reactive statements but never declared. This will fail compilation. Declare them as let spinnerClass = '' and let containerClass = '' (optionally typed) before the $: statements.
| let spinnerClass: string = ''; | |
| let containerClass: string = ''; |
| * @type {'none' | 'sm' | 'md' | 'lg'} | ||
| * @default 'md' | ||
| */ | ||
| export let padding: 'none' | 'sm' | 'md' | 'lg' = 'md'; |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Card component only supports padding/shadow/hover/clickable/class, but other added components use <Card title=... variant=...> and named slots like slot=\"header\". Those props/slots will be ignored, breaking UI sections (e.g., headers never render). Either (a) extend Card.svelte to support title/variant and named slots (e.g., header, footer) and document them, or (b) update caller components to use Card’s actual API.
| export function parseUrlParameters(pageStore: Readable<{ url: URL }>) { | ||
| pageStore.subscribe(($page) => { |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function subscribes to pageStore but never unsubscribes. If parseUrlParameters() can be called multiple times (or the component is created/destroyed), this will leak subscriptions and duplicate dispatches. Return the unsubscribe function from subscribe() so callers can clean up (typically via onDestroy).
frontend/Dockerfile
Outdated
| @@ -0,0 +1,54 @@ | |||
| # Multi-stage build for production efficiency | |||
| FROM node:18 AS builder | |||
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frontend has engine-strict=true and the repository docs/scripts expect Node 20+, but the Dockerfile pins Node 18 for both build and dev stages—npm ci can fail. Also, the nginx:alpine image typically doesn’t include curl, so the HEALTHCHECK will fail by default. Update Node images to 20+ and either install curl (or switch to an available tool like wget) in the runtime image.
| @@ -0,0 +1,54 @@ | |||
| # Multi-stage build for production efficiency | |||
| FROM node:18 AS builder | |||
|
|
|||
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frontend has engine-strict=true and the repository docs/scripts expect Node 20+, but the Dockerfile pins Node 18 for both build and dev stages—npm ci can fail. Also, the nginx:alpine image typically doesn’t include curl, so the HEALTHCHECK will fail by default. Update Node images to 20+ and either install curl (or switch to an available tool like wget) in the runtime image.
frontend/src/__tests__/setup.ts
Outdated
| PUBLIC_API_URL: 'http://localhost:8000' | ||
| })); | ||
|
|
||
| vi.mock('$env/dynamic/public', () => ({ | ||
| env: { | ||
| PUBLIC_API_URL: 'http://localhost:8000' |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The runtime client code reads env.PUBLIC_API_BASE_URL, but the test mocks provide PUBLIC_API_URL. This mismatch can cause tests to exercise the wrong baseURL path (or default fallback). Align the mocked env var name with PUBLIC_API_BASE_URL so tests reflect actual configuration.
| PUBLIC_API_URL: 'http://localhost:8000' | |
| })); | |
| vi.mock('$env/dynamic/public', () => ({ | |
| env: { | |
| PUBLIC_API_URL: 'http://localhost:8000' | |
| PUBLIC_API_BASE_URL: 'http://localhost:8000' | |
| })); | |
| vi.mock('$env/dynamic/public', () => ({ | |
| env: { | |
| PUBLIC_API_BASE_URL: 'http://localhost:8000' |
frontend/package.json.docs-script
Outdated
| } | ||
|
|
||
| // Add these to your existing package.json No newline at end of file |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains trailing // comments, so it’s not valid JSON. If it’s meant as documentation, consider renaming to .md (or .jsonc) to avoid tooling confusion and accidental parsing failures.
| } | |
| // Add these to your existing package.json | |
| } |
- Add explicit let declarations for reactive variables in UI components. - Extend Card component with title and variant props for callers. - Fix unreachable spinner in Button anchor branch. - Replace ErrorBoundary resetOnPropsChange with resetKey pattern. - Fix ControlGroup SSR hydration mismatch and deprecated substr. - Fix AlertSearchService using undefined currentParams variable. - Fix null handling for URLSearchParams.get() in FilterManagementService. - Fix subscription leak in UrlParameterService with onDestroy cleanup. - Remove stray escape characters in SearchFiltersForm FAR label. - Update Dockerfile from Node 18 to Node 20 and use wget for healthcheck. - Align test setup env var name to PUBLIC_API_BASE_URL. - Rename package.json.docs-script to .md to avoid invalid JSON.
|
{"total": {"lines":{"total":1140,"covered":592,"skipped":0,"pct":51.92},"statements":{"total":1140,"covered":592,"skipped":0,"pct":51.92},"functions":{"total":43,"covered":40,"skipped":0,"pct":93.02},"branches":{"total":215,"covered":209,"skipped":0,"pct":97.2},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}} |
- Split function.py into focused modules (type_checks, geometry, doi, formatters) - Add AlertRole StrEnum for type-safe alert role comparisons - Refactor candidate filters to data-driven pattern with operator lookups - Replace grade calculator if/elif chains with threshold table lookups - Replace repeated probability rounding with getattr/setattr loop - Use strftime for date formatting in delete_test_alerts - Add local filesystem storage backend to gwtm_io - Add @contextmanager db_session() wrapper, delete unused db/utils.py - Migrate test deps to pyproject.toml, update CI workflow
No description provided.