Aman-Mittal opened a new pull request, #343:
URL: https://github.com/apache/fineract-backoffice-ui/pull/343
Finishes the reporting engine epic: closes #301 and #302, completing #299.
## Cascading parameters (#301)
A report parameter can be scoped by another — Loan Officer by Office,
Product by Currency — and the platform declares that dependency in the
parameter template. Nothing read it. A dependent parameter therefore rendered
as a flat list of every value in the institution, and a selection survived a
change to its parent, so the report ran filtered to a combination the user
never chose, returned no rows, and said nothing about why.
Now:
- a dependent control is **disabled until its parent has a value**, and says
which parameter it is waiting on;
- its options are **refetched scoped by the parent's own query parameter** —
`R_currencyId` for a lookup written against `${currencyId}`;
- changing a parent **clears the child and everything downstream of it**,
rather than only refetching. The recursive clear is cycle-guarded, because the
parameter list is tenant data.
## Report type (#302)
The declared type was read from the query string and discarded, so a chart
report rendered as a table of numbers. Chart reports now render as a chart: the
`Pie` sub-type through the existing donut chart, `Bar` through a new bar chart
beside it. The sub-type travels with the type from the list screen, since the
run endpoint cannot supply it.
A chart report returns the **same generic resultset** a table report does —
the platform does no chart-specific work — so the series is derived from the
column types: the first numeric column is the value, the first column that is
not it is the category. A report declared as a chart but returning nothing
plottable falls back to the table and says why.
## Two platform findings that changed the scope
**There is no Pentaho or BIRT path, so none was built.** Posting a
definition with `reportType: "Pentaho"` answers:
```
validation.msg.report.reportType.is.not.one.of.expected.enumerations
args: [{"value":"Pentaho"}, {"value":["Table","Chart","SMS"]}]
```
Those three are the only types the platform accepts, so a Pentaho branch
would be unreachable. And `output-type=PDF` or `XLS` on a table report is
simply **ignored** — both come back `Content-Type: application/json` with the
ordinary resultset. A "Download PDF" button would have produced a file of JSON,
which is worse than not offering one. CSV, which does work, is unchanged.
**The stock loan-officer lookup is broken on PostgreSQL.** Its SQL compares
a bigint column against the substituted value, which is bound as a string:
```
ERROR: operator does not exist: bigint = character varying
```
It answers 403 whatever the UI sends, with or without a parent value. That
is platform-side and out of scope here, but it is exactly why a failed lookup
must be *visible*: an empty dropdown would read as "this office has no loan
officers". A failed lookup now shows an error, and because "All" is declared by
the parameter rather than discovered by the lookup, it survives the failure and
keeps such a report runnable unfiltered instead of blocking it outright. Most
stock loan reports share the same defect in their own SQL
(`o.id='${officeId}'`), which is why the backend test uses `Written-Off Loans`
— the one cascading report that does not carry the loan-officer parameter.
## Testing
- **937 unit specs pass** (up from 925). New coverage: a dependent control
disabled until its parent is set; the child lookup carrying the parent's query
parameter; a parent change clearing child *and* grandchild; a failed lookup
degrading to "All" with an error rather than an empty list; and each report
type taking its own branch, including the no-numeric-column fallback.
- **Backend e2e** against a real Fineract: Product scoped by Currency and
cleared when Currency changes (a second currency and a product in it are
seeded, so the scoping is observable rather than vacuous), and a seeded `Chart`
report rendering as a chart with no table.
- `lint`, `format:check`, `i18n:check` and `build` clean.
The parameter controls are rendered from a computed view model rather than
from template methods, which would hand Angular a fresh array identity on every
change-detection pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]