Local server and web experience
The local dashboard service and the React application form one delivery path for a DAC project. The service reads dashboard definitions and data settings, exposes them over HTTP, and serves the web app. The app turns those responses into pages where engineers can browse dashboards, change filters, inspect definitions, manage connections, interact with related data, and export results. The same dashboard experience can also run in an embedded MCP host.
Delivery path
The dac serve command starts the local service for a project. The service checks dashboard definitions before it listens, uses the configured query environment for data work, and serves the built web app from the same address. The browser then uses relative API paths, so the page and its data share one local origin.
This diagram shows how a project definition becomes an interactive dashboard and how user actions travel back to the service or an embedded host.
flowchart LR
P[Dashboard project] --> S[Local dashboard service]
S --> F[React web application]
F --> L[Dashboard list and detail pages]
F --> Q[Filter and interaction requests]
Q --> S
S --> B[Configured query backend]
B --> S
S --> F
F --> E[CSV, PNG, or PDF export]
M[MCP dashboard host] --> A[Embedded dashboard application]
A --> T[Dashboard preview tool]
T --> B
Local service boundary
The local service is the boundary between project files, configured data connections, and the browser. It provides dashboard metadata, dashboard definitions, theme settings, filter option values, query results, raw source content, and optional administration through a versioned API. Before a query reaches a data connection, the service checks the requested filter names and value shapes. It then resolves regular or semantic dashboard work from the checked state. Semantic work uses the complete rendered model set for joined queries and maps generated column names back to the names used by the dashboard. Query results can arrive for one widget, for a whole dashboard, or as a stream of completed widget results. Filter option responses can also carry display-only metric values and their format. The service also serves the React application as a single-page site, with a fallback that lets browser routes work when opened directly. See Local server APIs and live reload for the API and reload contract.
References: cmd/serve.go• L13-77 pkg/…/server.go• L18-39 pkg/…/server.go• L95-171 pkg/…/api.go• L45-203 pkg/…/api.go• L255-379 pkg/…/api.go• L393-522 pkg/…/filter_options.go• L11-71 pkg/…/filter_options_resolution.go• L16-121 pkg/…/semantic.go• L15-73
React application boundary
The React application is the user-facing layer above that service boundary. It selects a dashboard route, loads the matching definition, keeps filter state, and supplies returned data to the active visual template. The frontend also exposes this dashboard experience as a reusable @bruin-data/dac-ui package with a shared stylesheet, so the same page and template contracts can serve the local app or an embedded consumer. A shared data-client boundary lets the page use the service-backed client or a supplied client while keeping dashboard, filter-option, widget, and cross-filter hooks on the same contract. The active template supplies layout, filter, row, and widget-frame components together with the color tokens used by charts and controls.
The page renders untabbed rows and the selected tab. Filters can be global or tied to a row tab, so the selected tab controls which scoped controls appear. Each data-bearing widget loads through the shared widget result shape, while text, divider, or inline-data content can render without a backend query. Filter controls can obtain select values as separate requests, so a slow option query does not hold back dashboard widgets. Query-driven options can include a display-only metric and format, which the select menu shows without changing the selected value. Static payloads use the same page contract without making live service requests.
Definition and query-source views can show SQL, YAML, or TSX with syntax highlighting. The highlighter loads only when code is present and supports the languages used by those views, which keeps this aid separate from the first page load.
References: frontend/package.json• L11-31 frontend/…/main.tsx• L1-10 frontend/…/App.tsx• L1-85 frontend/…/client.ts• L1-195 frontend/…/dataClient.ts• L5-45 frontend/…/dashboard.ts• L10-20 frontend/…/dashboard.ts• L22-54 frontend/…/dashboard.ts• L68-157 frontend/…/dashboard.ts• L321-338 frontend/…/useFilterOptions.ts• L7-51 frontend/…/DashboardView.tsx• L37-218 frontend/…/DashboardWidget.tsx• L7-67 frontend/…/TemplateProvider.tsx• L10-57 frontend/…/DashboardLayout.tsx• L6-45
Embedded MCP delivery
The embedded MCP dashboard is a host-controlled version of the dashboard page for Claude or Bruin Cloud. The host selects a dashboard through dashboard-preview-tool, while the page uses the same dashboard, filter, widget, and template contracts as the local app. It keeps the current definition visible during refresh, supports host theme and display mode changes, and sends links to the host instead of navigating its own frame. A strict page policy allows only the data already supplied to the page, so dashboard content cannot load or send data to another network target. See MCP dashboard tooling for the host and tool contract.
The MCP build produces one self-contained HTML page. It uses the preview tool as its data client, supports dashboard filters and widget interactions, and isolates a broken widget so the rest of the dashboard remains usable. Its controls are limited to actions that the host can perform, such as refresh, open in Bruin Cloud, and full-screen display.
References: frontend/…/dashboard.html• L1-13 frontend/…/dashboard.tsx• L32-53 frontend/…/dashboard.tsx• L90-165 frontend/…/dashboard.tsx• L168-227 frontend/…/dashboard.tsx• L231-305 frontend/…/theme.ts• L1-54 frontend/…/dashboard.css• L1-57 frontend/vite.mcp.config.ts• L1-16
Dashboard browsing and querying
The web experience separates dashboard discovery from dashboard data. It first asks for lightweight summaries so a project can show a useful list without running every query. After a user opens a dashboard, the app loads its definition and requests data with the dashboard’s current filters.
Dashboard discovery
The dashboard list gives users a project-level view before they enter a dashboard. Each summary carries enough information to identify the dashboard and describe its size, while a project with one dashboard moves directly to that dashboard. The detail route then presents the dashboard name, description, rows, widgets, and optional tabs.
References: pkg/…/api.go• L45-103 frontend/…/useDashboard.ts• L1-20 frontend/…/DashboardList.tsx• L8-59 frontend/…/DashboardView.tsx• L167-175
Filtered data retrieval
Filters connect the page controls to the data shown in widgets. The app starts with dashboard defaults, accepts typed values from the URL, and updates the URL when a user changes a control. Dates must be real calendar dates, date ranges can use a preset or a pair of dates, and repeated parameters preserve multi-selections without comma parsing. Filters may also be scoped to a dashboard row tab, with those controls shown only for the active tab. The service combines those values with the dashboard definition, checks that they match declared filter types and allowed shapes, and only then resolves and runs the needed widget work. Semantic dashboards can use dimensions from joined models; the service renders the models and query together, then keeps joined result columns aligned with dashboard dimension names. This makes a filtered dashboard linkable while keeping query rules and unsafe input checks on the service side.
The normal dashboard view requests each data-bearing widget through the shared data client. Query state is cached per dashboard, widget, filter set, and client, so a filter change refreshes the affected data while the page can keep prior data during the transition. Text and divider widgets need no query. Widgets with inline data can return that data without a backend call. Tabbed widgets treat each tab as its own data unit and use the tab name in their result identity, so switching tabs does not attach data to the wrong view.
Filter controls use the dashboard defaults and any values in the URL as the starting state. A select filter can define its choices in the dashboard or ask the service for them from a query or semantic dimension. The app sends only the filter values named by that option query, while the service supplies defaults, validates the values, runs the configured query, and returns distinct safe scalar choices. An option query may also identify a metric column; the service maps one metric to each option and returns its format for display in the menu. Static choices take precedence, and an option failure leaves the control usable with an error state instead of blocking widget data. Selected values remain visible while options load, so shared links do not lose a value that the current option result does not contain.
The Bruin filter bar gives date ranges both preset and direct-entry paths. Presets resolve in the viewer’s local time zone, while typed values accept real YYYY-MM-DD or DD.MM.YYYY dates. A range applies only after both ends are complete and valid; the calendar prevents an end before the selected start and supports an Include today choice for last-N-day presets. The same controls support query-driven option metrics as display-only text, so selection and URL values remain the original option values.
The service also offers a batch path and a stream path. The stream path returns each completed widget result as it becomes available, while dashboard CSV export uses the batch result path to collect the current data into export sections.
References: frontend/…/DashboardView.tsx• L68-218 frontend/…/DashboardView.tsx• L220-271 frontend/…/client.ts• L66-195 frontend/…/dataClient.ts• L5-45 frontend/…/useFilterOptions.ts• L7-63 frontend/…/useWidgetQuery.ts• L5-22 frontend/…/filterParams.ts• L5-85 frontend/…/FilterBar.tsx• L164-177 frontend/…/FilterBar.tsx• L296-355 frontend/…/FilterBar.tsx• L368-418 frontend/…/FilterBar.tsx• L623-665 frontend/…/FilterBar.tsx• L675-789 frontend/…/DashboardWidget.tsx• L7-139 pkg/…/api.go• L133-204 pkg/…/api.go• L255-379 pkg/…/api.go• L393-522 pkg/…/filter_options.go• L11-71 pkg/…/filter_options_resolution.go• L16-137 pkg/…/semantic.go• L15-91 pkg/…/semantic.go• L153-247
Cross-filter interaction
Cross-filtering lets a user select a dimension in one chart or table and use that selection as a dashboard filter. The page records the source widget and the value that existed before the click, then sends the resulting filter state to all affected widgets. A second selection can add to or remove from a multi-select filter, and a widget-level reset clears only selections that came from that widget.
The interaction layer maps configured or same-name dimensions to declared filters. It accepts only values that can safely become the target filter type. Select changes can narrow the old rows while new results load when the old data can represent the selection; changes that widen or alter aggregates wait for fresh data. Date axes can select a complete day, week, or month bucket. Charts and tables expose the same behavior through pointer and keyboard actions, while stale widget data remains visible but cannot start another selection until it is ready. Chart marks ignore a drag that ends over a point, and table clicks are delayed briefly so a double-click can copy a cell without also changing filters.
This diagram shows how a mark or table value becomes shared dashboard state and then drives new widget queries.
sequenceDiagram
participant U as User
participant W as Chart or table widget
participant D as Dashboard state
participant C as Data client
participant S as Local service
U->>W: Select a dimension value
W->>D: Add, remove, or reset a filter
D->>C: Query affected widgets
C->>S: Send shared filter state
S-->>C: Return widget results
C-->>W: Refresh and highlight selections
References: frontend/…/useCrossFilter.ts• L5-134 frontend/…/crossFilter.ts• L3-242 frontend/…/DashboardView.tsx• L20-155 frontend/…/DashboardWidget.tsx• L43-67 frontend/…/ChartWidget.tsx• L1336-1385 frontend/…/ChartWidget.tsx• L1494-1619 frontend/…/TableWidget.tsx• L617-654 frontend/…/TableWidget.tsx• L811-874 frontend/…/VegaLiteChart.tsx• L267-469
Widget presentation
Widget frames connect a result to its visible dashboard block. They provide a common place for titles, descriptions, loading and error states, query details, widget-level exports, and reset actions for selections before the active visual type renders the result. A data widget owns one result request, while a tabbed widget switches between complete child widgets and keeps each tab’s data and export name separate.
Widget descriptions use an info control that works with pointer and keyboard input. The visible description stays near its trigger while the page moves, remains usable for long text, and closes when the user clicks outside it or presses Escape.
Data-driven image widgets use result columns to show one or more images with optional titles, captions, and alternate text. Image values pass through one URL policy: only bounded, absolute HTTPS URLs on another origin can load, which stops query data from sending the browser back to the local service or from activating unsafe URL schemes.
Metric widgets present one selected result value as a compact headline. They apply the value encoding when it defines a date or number format, and otherwise use a compact number form for large values. The displayed value also adapts to the available width so the metric remains readable inside its widget.
References: frontend/…/InfoTooltip.tsx• L5-95 frontend/…/usePopover.ts• L3-61 frontend/…/DashboardWidget.tsx• L7-139 frontend/…/WidgetFrame.tsx• L21-169 frontend/…/MetricWidget.tsx• L45-73 frontend/…/QueryInfo.tsx• L26-215 frontend/…/ExportMenuButton.tsx• L36-103 frontend/…/format.ts• L40-91 frontend/…/dashboardImage.ts• L1-26 frontend/…/dashboard.ts• L74-157 frontend/…/dashboard.ts• L322-327
Responsive layout
Rows and widgets form a responsive dashboard grid. On narrow screens widgets stack. On wider screens declared row and widget heights and column spans shape the layout. A widget height can override its row height, while the active template receives the height needed to size its content. This keeps one dashboard definition usable across screen sizes without changing its data.
References: frontend/…/RowContext.ts• L1-11 frontend/…/Row.tsx• L5-55 frontend/…/dac.css• L18-46 frontend/…/dashboard.css• L8-51 frontend/…/dashboard.ts• L68-72 frontend/…/template.ts• L36-48
Chart presentation
Chart widgets turn one returned result into a visual view that matches the dashboard definition. They support common analytical forms such as lines, bars, areas, distributions, flows, heatmaps, funnels, financial views, and statistical views, while a Vega-Lite chart accepts a declarative specification over the same returned rows. The chart layer applies dashboard theme tokens and keeps chart data inside the widget result rather than loading an outside data source.
The chart view adapts axes, labels, legends, reference guides, series styles, and tooltips to the selected encoding. It supports separate left and right value axes when measures use different units. Marks can act as cross-filter controls and remain keyboard accessible while a new result is loading. Date labels use compact calendar ticks when space is limited. Funnel views show stage values and conversion between stages. Heatmaps show value intensity and can use the same scale rules as table cells. A Vega-Lite view forces a simple or layered plot to fit its widget and scales composed views down when they have their own layout. Long axis and legend labels expose their full text on hover. Its tooltip uses the active theme even though it renders outside the theme provider, and its image marks use the same safe image policy as other dashboard images. A render error appears in the widget frame when the specification cannot run.
References: frontend/…/ChartWidget.tsx• L1336-1385 frontend/…/ChartWidget.tsx• L1400-1527 frontend/…/ChartWidget.tsx• L1629-1680 frontend/…/VegaLiteChart.tsx• L127-177 frontend/…/VegaLiteChart.tsx• L196-263 frontend/…/VegaLiteChart.tsx• L267-549 frontend/…/dac.css• L85-133 frontend/…/dashboard.ts• L107-143 frontend/…/dashboardImage.ts• L1-26
Table presentation
Table widgets turn returned rows into a browsable data view without changing the server result. Users can sort plain tables, keep frozen columns visible while scrolling, resize columns with a pointer or keyboard, hide helper columns, set alignment and group borders, and apply display formats or conditional styles. Consecutive columns can form a named group with one summary column; the user can collapse or expand that group without losing its measured layout. Columns can also render image values as thumbnails, show structured series as interactive sparklines, and let users copy displayed cell values. Pivot tables keep their structural row and column order so totals and grouped values remain aligned.
A table can also show a returned grand-total row that stays visible at the bottom of its scroll area. The table contract keeps displayed values separate from values used for color rules. This lets a visible column mirror the color of another result column while still using its own number format. Table definitions express these choices through the shared dashboard types, and the widget applies them after it receives WidgetData. A sparkline column accepts a bounded structured series or a bounded JSON array string, shows its latest value on hover, and does not change the table’s row model. A grand-total sparkline combines the shown rows by x value before it samples the series. Number formats can use common currency and number forms or a d3-format specification. Date-time values keep a date-only display when they use an ISO date-time value without an explicit number format. Pivot results preserve raw dimension values for cross-filter actions, so generated headers and totals do not become filter values.
References: frontend/…/TableWidget.tsx• L95-145 frontend/…/TableWidget.tsx• L146-226 frontend/…/TableWidget.tsx• L617-715 frontend/…/TableWidget.tsx• L756-874 frontend/…/TableWidget.tsx• L878-1013 frontend/…/pivot.ts• L23-64 frontend/…/pivot.ts• L165-271 frontend/…/ColumnGroupToggle.tsx• L5-49 frontend/…/columnGroups.ts• L3-47 frontend/…/SparklineCell.tsx• L28-145 frontend/…/sparkline.ts• L1-61 frontend/…/dashboardImage.ts• L1-26 frontend/…/format.ts• L66-91 frontend/…/dashboard.ts• L175-201
For the dashboard view, filter controls, loading behavior, and the visual layout, see Frontend dashboard experience. For the widget data and user actions inside each widget, see Frontend widgets and export interactions.
Administration and project settings
The web experience includes an administration route for connection settings when the service starts with an admin password. This route is separate from normal dashboard browsing and gives an engineer a way to inspect, add, edit, remove, and test connections used by the selected environment.
Connection administration
The admin page first authenticates with the configured password. It then reads connection groups, presents known connection types with guided fields, and uses a general key-value form for types it does not know. Save operations write the changed connection settings back to the project configuration, while a connection test checks that the named connection can answer a basic query.
The service does not expose these management routes when no admin password is configured. When the password is configured, the browser sends it as a bearer value for each protected operation and clears it from the session after an unauthorized response.
References: pkg/…/server.go• L158-166 pkg/…/admin.go• L11-52 pkg/…/admin.go• L54-147 frontend/…/client.ts• L206-300 frontend/…/Admin.tsx• L518-695
Live project feedback
Live reload keeps the local page aligned with files that an engineer edits during dashboard development. The service watches dashboard, semantic, and theme directories. A file change clears cached query data and sends a reload event to connected browsers.
File change feedback
The reload event is a Server-Sent Events connection, which is a long-lived HTTP response that carries one-way messages from the service to the browser. On a full reload event, the app invalidates current data and starts the affected dashboard requests again. The browser also reconnects if the event connection breaks.
This behavior is useful for local editing but is not part of a static delivery. In static mode the application uses the data baked into the page and does not open a reload connection.
References: pkg/…/server.go• L214-246 pkg/…/watcher.go• L13-25 pkg/…/watcher.go• L58-83 pkg/…/watcher.go• L115-145 frontend/…/useLiveReload.ts• L1-33 frontend/…/useDashboardData.ts• L17-39 frontend/…/client.ts• L7-19
Export and delivery modes
The interactive page treats export as an output of the current dashboard state. It can export a dashboard’s returned data as CSV or capture the rendered dashboard as PNG or PDF. The same React experience can also run from a static build where one dashboard and its query results are prepared before the files are delivered.
Browser exports
Dashboard export uses the active filters and the current rendered content. CSV output groups data-bearing widgets into named sections, including separate sections for the tabs of a tabbed widget. A multi-select cross-filter keeps the originating widget’s pre-click scope when needed, so the CSV matches what that widget shows on screen. Image and PDF output captures the dashboard view while excluding export controls, so the downloaded artifact represents the dashboard rather than its page controls. Individual chart and table widgets can offer their own export action as well.
References: frontend/…/DashboardView.tsx• L220-271 frontend/…/ExportMenuButton.tsx• L36-103 frontend/…/csv.ts• L27-74 frontend/…/renderExport.ts• L36-101 frontend/…/DashboardWidget.tsx• L60-127 frontend/…/WidgetFrame.tsx• L119-145
Static dashboard delivery
Static delivery preserves the dashboard viewing experience without a live local service. The build prepares the selected dashboard, its summaries, configuration, filters, and widget results in an injected page payload. The React app detects that payload, opens the selected dashboard, and skips requests that would need a running service. The same client and widget contracts still drive the page, but data is supplied from the fixed payload rather than from HTTP.
Static delivery is therefore suitable for viewing and exporting a known dashboard snapshot. It does not provide live reload or server-backed administration, and changing filters cannot run new queries against the original data source.
References: pkg/…/render.go• L21-36 pkg/…/render.go• L83-137 pkg/…/render.go• L144-176 frontend/…/client.ts• L7-19 frontend/…/dataClient.ts• L21-28 frontend/…/App.tsx• L12-47
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the API response shapes aligned with the TypeScript dashboard and widget data types. A field change can leave the page readable while silently dropping data.
- Keep canonical widget IDs consistent between server query results, frontend lookup, batch export, embedded MCP preview calls, and any other result consumer. For tabbed widgets, preserve the tab-name form and URL escaping across the service and browser.
- When the data-client contract changes, keep the HTTP client, supplied clients, MCP preview client, provider boundary, query keys, filter-option queries, widget queries, and static payload path aligned. Client identity must remain part of cache keys when clients share a query cache.
- When filter encoding changes, check both URL values and the values sent to server-side query rendering. Multi-select and date-range filters use distinct shapes, and date parsing must reject invalid calendar dates.
- When filter option queries change, keep the option endpoint, dependent-filter extraction, default values, static allowlists, metric values and formats, live filter controls, and MCP preview action aligned. Option lookup must stay separate from widget loading.
- When cross-filter bindings change, keep automatic name matching, explicit field mappings, safe wire values, date bucket ranges, source-widget scope, preview rows, reset behavior, keyboard actions, delayed table selection, and export filters aligned.
- When filter validation or semantic rendering changes, preserve the rule that invalid request values stop before backend execution. Keep the primary model and every joined model rendered from the same filter state, and keep generated semantic column names mapped to dashboard names. Check regular SQL, named-query, tab, stream, single-widget, semantic, and MCP preview paths together.
- When table column rules change, keep the dashboard schema, table rendering order, hidden and frozen column behavior, group collapse state, pivot dimensions and totals, sparkline data shape, cross-filter dimensions, cell-copy behavior, and export consumers in agreement.
- When table totals change, keep the grand-total result shape, displayed total columns, scroll behavior, formatting, sparkline aggregation, and export treatment aligned.
- When widget types gain data-driven fields, keep server job resolution, result column names, frontend rendering, cross-filter field discovery, MCP preview results, and static payload generation aligned.
- When metric, chart, sparkline, or table format rules change, keep the shared encoding contract aligned with number, date, axis, tooltip, and fallback display behavior in every widget that formats values.
- When image sources change, preserve the same safe URL policy in image widgets, table image cells, Vega-Lite image marks, MCP content, and caption markdown.
- When Vega-Lite sizing, composed views, label help, mark selection, or tooltip theme behavior changes, keep widget frame sizing, export readiness, responsive resize handling, and the shared DAC token styles aligned.
- When widget descriptions or popover behavior changes, keep the accessible description, pointer and keyboard opening, viewport positioning, outside-click dismissal, and export exclusion behavior aligned.
- When code-view languages or highlighting dependencies change, keep the lazy language set aligned with every definition view that requests highlighting.
- When theme or template settings change, update the service configuration response, browser-side template selection, and MCP light and dark templates. Keep token names valid for layout, controls, charts, and tooltips.
- When admin connection fields change, keep the browser form, request payload, configuration model, and selected environment in agreement.
- When reload events change, preserve the link between file changes, cache invalidation, event delivery, and browser refetch behavior.
- When the MCP page or its build changes, keep the host callbacks, preview-tool actions, content security policy, single-file output, host display modes, and external-link handling aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A dashboard fails validation while the service starts | The local service does not reach its listening state | Validate dashboard definitions before starting the service |
| A request contains an unknown filter, an invalid filter shape, or unsafe filter text | The query is rejected before SQL reaches the backend | Validate declared filter types and SQL-safe value shapes on every query path |
| A query-driven select option request uses an invalid dependency or returns unsafe or non-scalar values | The option list is rejected or the control shows an option error without changing widget results | Use declared filter dependencies, configured query and connection, and safe scalar option values |
| An option query names a missing or non-scalar metric field | The option request fails instead of returning misleading menu metrics | Keep the metric field in the option result and limit metric values to safe scalar data |
| A typed date is invalid or a date-range end comes before its start | The input reverts or the incomplete range does not query | Validate real local calendar dates and apply only complete ordered ranges |
| A widget query fails | That widget reports its query error while other widget results can still arrive | Keep errors attached to the widget result and show them in the widget frame |
| A widget ID differs between the dashboard layout and its query result | The page can leave a widget empty or attach data to the wrong widget | Derive IDs from the shared row and widget position in both server and frontend paths |
| A tab name is not preserved in a per-tab result ID or its URL path is not escaped | A tab query can fail to resolve or its data can appear under another tab | Use the shared tab-name ID format and path-escape tab IDs in the browser |
| A supplied data client shares a query cache without a distinct client key | One client can display another client’s dashboard or widget data | Include data-client identity in dashboard, filter-option, and widget query keys |
| A cross-filter field is not mapped to the declared filter or its value cannot use the filter wire type | A click does nothing or sends a value that the backend rejects | Resolve explicit or same-name bindings and validate every clicked value before changing state |
| A chart drag ends over a mark or a table double-click is treated as a filter click | A gesture or copy action changes dashboard filters unexpectedly | Ignore moved chart presses and defer table selection long enough to distinguish double-clicks |
| A cross-filter change widens an aggregate or a date bucket is not complete | The page can show a misleading preview or select only part of a period | Preview only safe select narrowing and extend date selections to the full known bucket |
| A stale widget result remains selectable during a refetch | A second click can apply a value that no longer matches the visible query state | Keep marks visible but disable selection until the widget result is ready |
| A semantic query uses joined models that were not rendered with the same filter state, or its generated dimension alias is not mapped back | SQL can use stale model expressions or a widget cannot find the requested dimension in its result | Render the full model set together and preserve the dashboard-facing names for joined dimensions |
| A table result omits a column referenced by a display, sparkline, pivot dimension, or color rule | The table can show a blank value, lose a style, or show no trend | Keep declared column names and cross-column references aligned with returned result columns |
| A pivot applies ordinary sorting or uses formatted headers as dimensions | Totals and groups can move out of alignment or clicks can send the wrong filter value | Preserve pivot row and column order and retain raw dimension coordinates separately from labels |
| A column group has only one member or an invalid summary position | The table shows a misleading toggle or applies group behavior to the wrong column | Build groups from consecutive members and use the first member as the summary column |
| A table format is invalid or receives a non-numeric value | The cell falls back to its raw display rather than the requested number format | Keep format specs valid and provide values that match the column’s display type |
| A sparkline value is oversized, malformed, or has invalid point fields | The cell shows no trend or the grand-total trend uses incomplete data | Keep series inputs bounded and use numeric y values with string or finite numeric x values |
| A grand-total result is missing or does not use the table’s column names | The table omits the total row or shows blank or misplaced totals | Keep the optional grand-total result aligned with the table result columns and label contract |
| A metric value encoding names a missing field | The metric uses the first returned value or shows an empty loading state instead of the intended measure | Keep value encodings aligned with returned result columns |
| An image value is relative, same-origin, non-HTTPS, oversized, or otherwise unsafe | The image is not rendered | Pass image values through the shared external HTTPS URL check |
| A Vega-Lite specification uses an outside data URL | The chart cannot use the dashboard result contract and reports a render error | Require Vega-Lite data to come from the widget result |
| A Vega-Lite view cannot fit its frame or a composed view exceeds it | Labels or chart content can be clipped or trigger page overflow | Force simple and layered views to container size and scale composed SVG views within the frame |
| A row or widget height uses a value that the layout cannot parse for content sizing | The visual block can fall back to natural sizing even when its CSS height is set | Keep numeric or pixel height values aligned with the dashboard types and responsive layout rules |
| A description popover loses its trigger position during scroll or opens beyond the viewport | The description can cover the wrong area or become hard to read | Recalculate the position on scroll and resize, prefer the requested side when it fits, and clamp long text to the viewport |
| The file watcher cannot start | The service can still serve dashboards, but edits do not trigger live reload and the events endpoint is unavailable | Treat watcher setup as optional and surface the unavailable reload path |
| A requested code language is not in the lazy highlighter set | The definition view cannot render the expected syntax highlighting | Keep supported view languages and Shiki language loading aligned |
| No admin password is configured | The admin route is not available for connection management | Enable and protect admin routes only when an explicit password is set |
| A static dashboard user changes a filter | The page has no live backend request from which to obtain new data | Treat static results as a fixed snapshot and use the local service for live queries |
| The MCP host does not provide the expected app callbacks or preview result | The embedded page stays in its loading or connection error state | Keep the host bridge and dashboard-preview-tool result shape aligned with the embedded app |
| An MCP dashboard tries to use an external data or image URL | The embedded page blocks the resource or shows a chart error | Keep data in the supplied widget result and apply the shared safe image policy |
| An MCP widget definition throws during rendering | One widget shows an error boundary while the rest of the dashboard remains available | Keep each widget inside its own render boundary |
Key files
| File | Why to read it |
|---|---|
| cmd/serve.go | Shows how the serve command joins project selection, server settings, frontend delivery, and startup. |
| pkg/…/server.go | Defines the service boundary, route groups, frontend serving, validation, and watcher startup. |
| pkg/…/api.go | Shows how dashboard metadata, filters, and widget results move to the browser. It also defines the shared result identity for widgets and tabs. |
| pkg/…/filter_options.go | Shows how one filter’s query-driven choices are resolved without running widget queries. |
| pkg/…/filter_options_resolution.go | Shows how query and semantic filter options become safe values with optional display metrics and formats. |
| pkg/…/semantic.go | Explains how semantic dashboard work becomes filtered SQL and how joined result columns keep dashboard names. |
| pkg/…/watcher.go | Explains the file-change signal used by local live reload. |
| frontend/package.json | Defines the browser package entry points and the build paths for the local app, reusable UI package, and MCP page. |
| frontend/vite.mcp.config.ts | Defines the self-contained embedded dashboard build and its release output. |
| frontend/…/dashboard.html | Defines the embedded page shell and its network policy. |
| frontend/…/dashboard.tsx | Shows how the MCP host selects a dashboard, supplies data through the preview tool, and exposes refresh, full-screen, and cloud-link actions. |
| frontend/…/theme.ts | Defines the light and dark dashboard tokens used by the embedded experience. |
| frontend/…/dashboard.css | Defines the embedded page layout, responsive behavior, loading state, and export-control rules. |
| frontend/…/App.tsx | Shows the browser routes, template setup, query provider, and static versus service-backed modes. |
| frontend/…/client.ts | Defines the browser’s contract with dashboard, query, filter option, theme, and admin endpoints. |
| frontend/…/dataClient.ts | Defines the shared dashboard data contract and keeps separate clients from sharing cached results. |
| frontend/…/useFilterOptions.ts | Shows how query-driven filter choices load independently and follow their declared filter dependencies. |
| frontend/…/useWidgetQuery.ts | Shows how each data-bearing widget loads, caches, and refreshes its result. |
| frontend/…/useCrossFilter.ts | Shows how chart and table selections become shared filter changes and widget-level resets. |
| frontend/…/crossFilter.ts | Defines filter binding, safe clicked values, date-range selection, preview rules, and source-widget query scope. |
| frontend/…/filterParams.ts | Defines the typed URL forms for dates, ranges, numbers, and repeated multi-select values. |
| frontend/…/dashboard.ts | Defines the shared dashboard, filter, option metric, row, widget, chart, table, pivot, grand-total, and widget-result shapes that connect service data to the page. |
| frontend/…/DashboardView.tsx | Connects dashboard state, global and tab-scoped filters, cross-filter selections, tabs, widgets, YAML inspection, and exports into one page flow. |
| frontend/…/DashboardWidget.tsx | Shows the single-widget and per-tab data boundary used by the dashboard page. |
| frontend/…/TemplateProvider.tsx | Shows how layout components and theme tokens reach the dashboard and its widgets. |
| frontend/…/DashboardLayout.tsx | Illustrates the dashboard header, navigation, filters, and content layout. |
| frontend/…/FilterBar.tsx | Illustrates date-range controls, local-time presets, typed date entry, and option metrics. |
| frontend/…/WidgetFrame.tsx | Shows the shared widget boundary for loading, errors, descriptions, query details, exports, cross-filter reset, and data-driven images. |
| frontend/…/InfoTooltip.tsx | Shows the accessible widget description control and its visible help text behavior. |
| frontend/…/usePopover.ts | Defines the shared popover state, placement, dismissal, and position updates used by description help. |
| frontend/…/ChartWidget.tsx | Illustrates how returned rows become themed chart views and analytical visual forms with selectable marks. |
| frontend/…/VegaLiteChart.tsx | Shows how declarative chart specifications use widget data, fit or scale within the page, support mark selection and label hover help, and restrict outside data and image sources. |
| frontend/…/TableWidget.tsx | Illustrates how a returned table result becomes a sortable, formatted, scrollable view with images, sparklines, pivots, groups, grand totals, copying, and selections. |
| frontend/…/sparkline.ts | Defines the bounded structured or JSON series accepted by table sparklines and their grand-total aggregation. |
| frontend/…/pivot.ts | Defines client-side pivot shaping, totals, formats, and raw dimension coordinates used by the table. |
| frontend/…/ExportMenuButton.tsx | Provides the shared dashboard and widget export menu behavior. |
| frontend/…/QueryInfo.tsx | Provides the on-demand SQL view and copy action for a widget result. |
| frontend/…/dac.css | Defines shared responsive row and widget sizing, chart sizing, tooltip theme, font, and widget presentation rules. |
| frontend/…/dashboardImage.ts | Defines the shared safety rule for image URLs from dashboard data. |
| frontend/…/format.ts | Defines the shared number and date display rules used by value and axis encodings. |
| frontend/…/useShikiHighlight.ts | Shows how definition code highlighting loads only when the browser needs it. |
| frontend/…/Admin.tsx | Illustrates the connection management experience and its user-facing safeguards. |
| pkg/…/render.go | Shows how a queried dashboard becomes a self-contained static web delivery. |