feat: report on changes as well as facts - #45
Open
blaipr wants to merge 1 commit into
Open
Conversation
Reports could only be built from facts, so the filtering the Changes page offers could not be saved, shared or mailed on a schedule. A report now has a type. A changes report holds the filters of the Changes page, host, job template, playbook, role, module, job type, inventory, project and a search, plus a window in hours so a scheduled report covers last night rather than everything recorded. Its columns are fixed to the fields that page lists, and it produces the same row shape as a facts report, so the report and email templates render both without knowing which is which. Permissions, sorting, scheduling and mailing are the ones reports already had.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #22.
Problem
The Changes page has filters for host, job template, playbook, role, module, job type, inventory and project, and a search over the change data, but that view is only ever a session. It cannot be saved, handed to someone else, or mailed on a schedule. Reports can do all three, and they only build from facts.
The roles filter the issue also asked for was added separately in 3569435.
Change
A report now has a type, and a changes report is the Changes page saved as a report.
reports.typeisfactsorchanges, defaulting tofacts, added by a database upgrade so existing reports keep working untouched.Filter values are bound rather than interpolated into the query.
The Reports list gains a Type column and a second create button, and
/reports/new/changesis routed to it.Testing
Rendered and run against MariaDB in containers, with the schema from
ledger.sqland a few seeded changes:' OR '1'='1matches nothing rather than widening the queryreport_changes_edit.html,report.html,reports.htmland the report email compile and render with representative data, showing the current filters as selected, the delete links per field, and both report types in the listphp -lpasses on every changed fileNot run inside a deployed Ledger, so the pages have not been clicked through in a browser.