Class: DashboardService
Defined in: server/insights/services/dashboard-service.ts:106
READ-ONLY dashboard execution. It composes the two PR0 services rather than
reaching for the registry itself: ModelService resolves the
dashboard/tile/canned-report metadata (and owns the UnknownDashboardError
lookup), QueryService compiles and runs data-backed tiles. Static text
cells return directly from their code-defined metadata.
This service never writes — dashboards are code-configured through
defineReportingModel, so there is nothing to persist.
Constructors
Constructor
new DashboardService(deps: DashboardServiceDeps): DashboardService;Defined in: server/insights/services/dashboard-service.ts:107
Parameters
| Parameter | Type |
|---|---|
deps | DashboardServiceDeps |
Returns
DashboardService
Methods
resolveFilterOptions()
resolveFilterOptions(dashboardKey: string, ctx: FilterOptionsContext): Promise<Record<string, {
label: string;
value: string;
}[]>>;Defined in: server/insights/services/dashboard-service.ts:242
Resolve the choices for every select filter on a dashboard from the DATA,
keyed by filter id — the choices are never authored on the descriptor.
For each select filter, the first tile subject that carries the field
(filterable) decides how its options are enumerated: a groupable field
runs a governed DISTINCT query (a groupBy on that field alone, tenant
predicate injected, capped at MAX_FILTER_OPTIONS), so the list is
exactly the values present in the caller's own data; a non-groupable enum
field falls back to its declared enumValues. The queries run SEQUENTIALLY
for the same reason runMetric's two queries do — the transactional test
environment shares one connection, so overlapping runs interleave and abort.
The consumer runs this server-side and hands the result to
DashboardFilterBar, keeping the client lane presentational.
Parameters
| Parameter | Type |
|---|---|
dashboardKey | string |
ctx | FilterOptionsContext |
Returns
Promise<Record<string, {
label: string;
value: string;
}[]>>
runTile()
runTile(
dashboardKey: string,
tileId: string,
ctx: RunTileContext
): Promise<TileResult>;Defined in: server/insights/services/dashboard-service.ts:122
Run one tile of one dashboard.
Resolution: dashboard by key (throws UnknownDashboardError) → tile by id
(throws UnknownDashboardTileError) → dispatch by kind: return a
text-cell directly, call queryService.runMetric(ref) for metric, or
call queryService.run(cannedReport.definition) for canned-report.
The tile's summary config is echoed back UNCOMPUTED so the client can
render the big number from the series it already received — the server
never aggregates it a second time in JS (money columns in particular are
only ever summed in SQL).
Parameters
| Parameter | Type |
|---|---|
dashboardKey | string |
tileId | string |
ctx | RunTileContext |
Returns
Promise<TileResult>