NMS-20154: Migrate the Generate System Report page to Vue UI - #8735
NMS-20154: Migrate the Generate System Report page to Vue UI#8735joseanesONMS wants to merge 10 commits into
Conversation
…t page Adds a read-only SystemReportRestService exposing the visible report plugins and formatters as JSON so a PrimeVue Generate System Report page can build its form. The systemReport bean is wired into the REST v2 context through the SOA service registry, mirroring the legacy dispatcher wiring, and the endpoints are gated to ROLE_ADMIN since the report bundles logs and configuration. Report generation itself continues to stream from the existing SystemReportController.
Replaces the legacy systemReport JSP form with a PrimeVue page at /system-report: plugin checkboxes with an All master toggle, a report-type Select, and an optional file name. The page loads its options from /api/v2/system-report and, on Generate, posts operation=run to the existing SystemReportController through a hidden iframe so the browser streams the report download without navigating away. The route is admin-gated to match the endpoint.
serviceRegistry is a root-context bean (applicationContext-soa.xml) and the CXF /api/v2 servlet context has the root as its parent, so a direct ref resolves it — matching the legacy dispatcher wiring. Replaces the earlier onmsgi:reference, which had no matching OSGi service registration.
Repoints the "Generate System Report" menu item from the legacy admin/support/systemReportList.htm JSP to the PrimeVue page at ui/index.html#/system-report.
Adds a SystemReportRestService unit test covering the visible-only filtering and DTO mapping for plugins and formatters. The page now shows a notice on Generate that the report is being built and may take a while on a large system, since the report is produced on demand (plugins run and logs/config are gathered and compressed before the streamed download begins) and the browser cannot signal when that download completes.
…ename The Generate flow now detects when the hidden download frame loads an error page (a failed download never loads it) and surfaces the failure instead of silently doing nothing. The optional filename is sanitized to word characters the same way the server does, and omitted when it would collapse to an empty name. The default report format returns to the legacy 'text', plugin checkbox ids are made whitespace-safe, the context path is derived from the URL when the menu base is unavailable, and a non-admin deep-link no longer flashes a load error before the route guard redirects. Also drops the dead JSON-shape fallback in the service.
|
@joseanesONMS A few comments before reviewing further. Make sure to use the new Also in future, PR title should reference Run Need to fix integration and smoke tests. Will need to at least fix I want to look closer at this. Instead of the sort of hack of loading the generated report into an |
|
|
The Support -> Generate System Report menu entry now opens the PrimeVue page (ui/index.html#/system-report), which renders the /ui breadcrumb (div.breadcrumbs) and an OnmsButton. MenuHeaderIT still waited on the legacy JSP DOM (ol.breadcrumb 'System Reports' and a Bootstrap submit input), so testMenuEntries timed out. Point it at the new page's breadcrumb link and generate button.
Address review on the Generate System Report page: - Swap direct PrimeVue (Card, Checkbox, Select, InputText) for the @opennms/onms-ui wrappers (OnmsCard/OnmsCheckbox/OnmsSelect/ OnmsInputText); the binary OnmsCheckbox drives per-plugin selection through an explicit add/remove toggle. - Replace the hidden-iframe form POST to the legacy systemReport.htm with a POST /api/v2/system-report/generate that streams the report as an attachment, consumed via composables/useDownload. The endpoint ports FormatterView (resolve formatter, run selected plugins, sanitize filename) and rejects unknown/non-streaming formatters and empty plugin sets with 400s. Generation is admin-only in spring-security. - Cover the endpoint (stream order, attachment header, filename sanitising, the 400 paths) and rewrite the page test for the new flow.
|
@synqotik — addressed all five:
|
|
@dino2gnt Looking for parity first, we will decide about functionality (or lack thereof) later. |
…eir test classpath features/status/rest and features/bsm/rest/impl boot opennms-webapp-rest's shared applicationContext-cxf-rest-v2.xml in their ITs. That context now instantiates SystemReportRestService and defines the systemReport bean (class org.opennms.systemreport.SystemReport), which opennms-webapp-rest declares provided (non-transitive), so those ITs failed to load the whole context with a ClassNotFoundException. Add system-report as a test-scope dependency in both modules, mirroring the existing topology-views/jsonStore entries that cover the same shared-context requirement.
@joseanesONMS thanks, looks good. A few more things:
If those are all OK, looks good to me, ping me to approve. |
Replaces the legacy Generate System Report JSP form with a PrimeVue page backed by a new REST metadata endpoint.
Report generation is unchanged — it still streams from the existing SystemReportController — so this is a UI/metadata migration, not a change to what the report contains.
/api/v2/system-report/pluginsand/formattersexpose the visible report plugins and formatters as JSON; both are admin-gated./system-reportoffers plugin checkboxes with an All toggle, a report-type Select, an optional file name, and Generate; the route is admin-gated.operation=runto the existing streaming controller through a hidden iframe, and a failed generation (500, expired session, plugin error) is now surfaced instead of silently doing nothing.text(matching the legacy form), the file name is sanitized the way the server sanitizes it, and the Support menu entry is repointed to the new page.SystemReportRestServiceunit test and aSystemReport.vuecomponent test (form contract, filename sanitization, iframe-error path); fulluisuite green.