apache / apache/fineract-backoffice-ui

Reporting: honour the report type — chart rendering, and file output for Pentaho/BIRT reports

Open
#302 2 comments 0 reactions 0 assignees View on GitHub
effort: M enhancement help wanted impact: back-office priority: medium
Dominant language
TypeScript
Stars
15
Forks
60
Avg merge
10h 15m
Merged PRs (30d)
108

Description

Part of #299. Best taken after #300.

## Business value

`run-report.component.ts:250` reads the report type from the query string and never uses it again. Every report is run as tabular HTML (`:308`), so:

- **Chart reports render as a table of numbers.** The report was authored as a chart because the shape of the data is the point; a table of the same figures is not a substitute for a trend line in a board pack.
- **Pentaho and BIRT reports cannot be produced at all.** These are the document-shaped outputs — member statements, loan certificates, receipts, regulatory returns. An institution that must hand a member a statement cannot do it from this UI.

## What to build

Dispatch on the report type rather than discarding it:

| Type | Behaviour |
|---|---|
| Table / SMS | current tabular render (keep as-is) |
| Chart | render the returned series as a chart |
| Pentaho / BIRT | request the appropriate output type and deliver the returned file |

For charts, the app already has chart components under `src/app/shared/components/charts` used by the dashboard — reuse them rather than adding a second charting approach.

For file outputs, go through the `DOWNLOAD` adapter in `src/app/core/adapters`, not `window.open` or a synthesised anchor. That boundary exists for exactly this (ADR-0003), and a direct DOM download will fail lint.

## Two things to get right

1. **Pentaho parameters are named differently.** Pentaho-style reports use a distinct parameter naming convention from table reports, so the values collected by #300 may need mapping before they are sent. Verify against a live instance rather than assuming they pass through unchanged.
2. **A failed export must say so.** A download that silently does nothing is indistinguishable from a click that missed. Surface the failure.

## Testing

- **Unit spec:** each report type takes its own branch and requests the correct output type.
- **Unit spec:** a chart report passes the returned series to the chart component; a table report does not.
- **Unit spec:** file output goes through the `DOWNLOAD` adapter — assert against the fake from `provideFakeAdapters()` in `src/app/testing/adapters.ts`, which records downloads.
- **Mocked e2e:** run a chart report and assert a chart renders rather than a table.

## Scope

In scope: type dispatch, chart rendering, file output for document-shaped reports.

Out of scope: parameter discovery (#300) and cascading (#301); report definition CRUD; the export-to-CSV path that already exists at `:271`, beyond making sure it still works.

## Getting started

- `src/app/features/reporting/run-report.component.ts`
- Charts: `src/app/shared/components/charts`
- Download adapter: `src/app/core/adapters` — see `DOCS/adr/0003-adapter-boundary.md`
- `npm test`, `npm run lint:prune`, `npm run i18n:check`, `npm run build`

Contributor guide

Open the contributing guide

Research direction

Start in src/app/features/reporting/run-report.component.ts and trace the existing report-type handling, then read the chart components under src/app/shared/components/charts and DOCS/adr/0003-adapter-boundary.md. Use the DOWNLOAD adapter and the fake in src/app/testing/adapters.ts while covering each report branch, chart rendering, failed exports, and the existing CSV path with the stated unit and mocked e2e tests. Done means tables remain unchanged, charts render as charts, and Pentaho/BIRT outputs download or visibly report failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.