You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up of #756 (drafts approved in the 2026-09-01 review). Track B — SQL Query / SQL View, step 1 of 5.
Design reference:SQL on FHIR UI Drafts → page Approved, artboards "SQL Query — approved layout", "SQL View — approved layout", "SQL Query — empty", "SQL View — empty". This issue builds the page skeleton and the live results; the Details section (#840), the Parameters card (#841) and the Tables panel (#842) plug into it afterwards — leave their slots in the layout.
Summary
Both pages share crates/ui/templates/pages/sql-library.html and today look like a form dump: title row with Run / Duplicate / Delete / Create New, a short SQL textarea, the whole Library JSON in a <details> fold, a Save row, a results table. Rebuild the page around the SQL: title row → (Details slot) → SQL editor → (Parameters slot, SQL Query only) → (Tables slot) → Results, with the results refreshing as you type and no Run button — the direction #752 sets for View Definitions.
Kind identity. Kind-specific lede on the page head, editor heading (SQL vs View definition (SQL)), results heading (Results vs Preview), empty-state copy that says what a view is. Both come from the existing SqlLibraryKind table, not from template branches on strings.
Live run. Editing the SQL re-runs $sql-run (debounced, ~500 ms, hx-post to a fragment endpoint that returns the results card) against the current editor content, saved or not — conformance.sql_run already takes the resource inline. The fragment swaps only the results card; the editor is never re-rendered. Without JavaScript: Save re-renders the page with results for the saved SQL (replaces today's ?run=1 link; remove the vd-run usage here).
Results / Preview card..card.table-card with .card-head__metaN rows · T ms; SQL Query additionally gets an Export as files action (.btn → /ui/sql/export/new?subject=Library/{id}, see the create form issue). Limit stays 50 rows.
Failed run. The existing .notice--warn with the server message and, when the message carries a line, the line tinted in the editor; the SQL is left untouched and the last successful results stay, labelled "last successful run".
Empty state. Rail says "No queries yet." / "No views yet."; centre card offers Create New.
i18n for every new/changed string (en/es/de); drop keys that become unused.
Acceptance criteria
Both pages render the approved layout; design-system.spec.ts passes.
Typing a valid query updates the results card without a full page load; typing an invalid one shows the notice and keeps the previous results.
With JavaScript disabled, Save shows results for the saved SQL.
Export as files opens the export form with the query pre-checked.
Rust router_http tests for the fragment endpoint (success, error, unsaved content); Playwright for the live-run flow on each page; nojs passes.
Pointers
crates/ui/templates/pages/sql-library.html, crates/ui/src/lib.rs (sql_library_page, sql_library_save, SqlLibraryKind), crates/ui/src/conformance.rs::sql_run, crates/ui/src/sql_libraries.rs (extract_sql / embed_sql), #752 for the same direction on View Definitions.
Design reference (screenshots)
Full-page renders of the approved artboards (branch docs/756-design-references, docs/images/sql-ui-drafts/). The canvas linked above is the editable source.
Follow-up of #756 (drafts approved in the 2026-09-01 review). Track B — SQL Query / SQL View, step 1 of 5.
Design reference: SQL on FHIR UI Drafts → page Approved, artboards "SQL Query — approved layout", "SQL View — approved layout", "SQL Query — empty", "SQL View — empty". This issue builds the page skeleton and the live results; the Details section (#840), the Parameters card (#841) and the Tables panel (#842) plug into it afterwards — leave their slots in the layout.
Summary
Both pages share
crates/ui/templates/pages/sql-library.htmland today look like a form dump: title row with Run / Duplicate / Delete / Create New, a short SQL textarea, the whole Library JSON in a<details>fold, a Save row, a results table. Rebuild the page around the SQL: title row → (Details slot) → SQL editor → (Parameters slot, SQL Query only) → (Tables slot) → Results, with the results refreshing as you type and no Run button — the direction #752 sets for View Definitions.Requirements
.page-head--row): the page's icon, the Library title, a.tag--typechip (SQL Query / SQL View), the status as a.tag--{status}chip; actions Duplicate / Delete / Create New. No rename control — the name is edited in Details (ui: SQL Query & SQL View — Details: JSON editor + guided form over the Library, above the SQL #840).SqlLibraryKindtable, not from template branches on strings..cardwith a.editor-legend__livehint ("Runs as you type — results follow the current SQL, saved or not"); Save in.form-actions.$sql-run(debounced, ~500 ms,hx-postto a fragment endpoint that returns the results card) against the current editor content, saved or not —conformance.sql_runalready takes the resource inline. The fragment swaps only the results card; the editor is never re-rendered. Without JavaScript: Save re-renders the page with results for the saved SQL (replaces today's?run=1link; remove thevd-runusage here)..card.table-cardwith.card-head__metaN rows · T ms; SQL Query additionally gets an Export as files action (.btn→/ui/sql/export/new?subject=Library/{id}, see the create form issue). Limit stays 50 rows..notice--warnwith the server message and, when the message carries a line, the line tinted in the editor; the SQL is left untouched and the last successful results stay, labelled "last successful run".<details>fold from this template (Details replaces it in ui: SQL Query & SQL View — Details: JSON editor + guided form over the Library, above the SQL #840; until then the raw JSON is reachable through the Resource Editor link in the overflow, or keep a plain link "Edit as JSON").Acceptance criteria
design-system.spec.tspasses.router_httptests for the fragment endpoint (success, error, unsaved content); Playwright for the live-run flow on each page; nojs passes.Pointers
crates/ui/templates/pages/sql-library.html,crates/ui/src/lib.rs(sql_library_page,sql_library_save,SqlLibraryKind),crates/ui/src/conformance.rs::sql_run,crates/ui/src/sql_libraries.rs(extract_sql/embed_sql), #752 for the same direction on View Definitions.Design reference (screenshots)
Full-page renders of the approved artboards (branch
docs/756-design-references,docs/images/sql-ui-drafts/). The canvas linked above is the editable source.SQL Query — approved layout
SQL View — approved layout
SQL Query — empty
SQL View — empty