Skip to content

NMS-20154: Migrate the Generate System Report page to Vue UI - #8735

Open
joseanesONMS wants to merge 10 commits into
developfrom
jira/NMS-20154-system-report
Open

NMS-20154: Migrate the Generate System Report page to Vue UI#8735
joseanesONMS wants to merge 10 commits into
developfrom
jira/NMS-20154-system-report

Conversation

@joseanesONMS

Copy link
Copy Markdown
Contributor

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.

  • New /api/v2/system-report/plugins and /formatters expose the visible report plugins and formatters as JSON; both are admin-gated.
  • The PrimeVue page at /system-report offers plugin checkboxes with an All toggle, a report-type Select, an optional file name, and Generate; the route is admin-gated.
  • Generate posts operation=run to 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.
  • The default report type stays 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.
  • Covered by a SystemReportRestService unit test and a SystemReport.vue component test (form contract, filename sanitization, iframe-error path); full ui suite green.

…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.
@synqotik

synqotik commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@joseanesONMS A few comments before reviewing further.

Make sure to use the new Onms-XXX UI components instead of using PrimeVue directly. These just landed in develop.

Also in future, PR title should reference Vue or Vue UI, instead of PrimeVue. e.g. NMS-20145: Migrate Generate System Report page to Vue UI or similar.

Run pnpm lint from the /ui directory before pushing code (and pnpm lint:fix to auto-fix), this should catch any formatting issues, but it will also prevent direct use of PrimeVue. (I will probably make sure this happens in CI soon).

Need to fix integration and smoke tests. Will need to at least fix MenuHeaderIT.java.

I want to look closer at this. Instead of the sort of hack of loading the generated report into an iframe, perhaps we can have a REST API to generate the report and return it. Then we can use composables/useDownload() like we do in src/components/SnmpConfiguration/SnmpConfigUploadDownloadTab.vue and elsewhere.

@dino2gnt

dino2gnt commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

<support-hat>
I would be fine with ignoring this and deprecating the System Report feature entirely instead. Support doesn't use it and never has as best I can tell.
</support-hat>

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.
@joseanesONMS joseanesONMS changed the title NMS-20154: PrimeVue Generate System Report page NMS-20154: Migrate the Generate System Report page to Vue UI Aug 4, 2026
@joseanesONMS

Copy link
Copy Markdown
Contributor Author

@synqotik — addressed all five:

  1. Onms-XXX wrappers. Swapped the direct PrimeVue Card/Checkbox/Select/InputText for OnmsCard/OnmsCheckbox/OnmsSelect/OnmsInputText (OnmsButton was already in). The binary OnmsCheckbox drives per-plugin selection through an explicit add/remove toggle.
  2. PR title now says "Vue UI".
  3. pnpm lint (and lint:fix) run clean — no primevue/* imports remain.
  4. Tests. MenuHeaderIT now points at the new page's div.breadcrumbs link and OnmsButton instead of the legacy ol.breadcrumb/submit input; the page test and the endpoint unit test were rewritten for the new flow.
  5. Dropped the iframe. Added POST /api/v2/system-report/generate, which streams the report as an attachment (ports FormatterView: resolve formatter, run the selected plugins, sanitize the filename) and returns 400 for unknown/non-streaming formatters or an empty plugin set. The page consumes it via composables/useDownload, matching SnmpConfigUploadDownloadTab. Generation is admin-only in applicationContext-spring-security.xml.

@joseanesONMS

Copy link
Copy Markdown
Contributor Author

@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.
@synqotik

synqotik commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@synqotik — addressed all five:

@joseanesONMS thanks, looks good. A few more things:

  1. rebase onto or merge from latest develop to get all changes
  2. make sure pnpm lint passes (no PrimeVue, etc.)
  3. Force smoke tests to run

If those are all OK, looks good to me, ping me to approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants