Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit report recipe #3690

Merged
merged 37 commits into from
Oct 28, 2024
Merged

Edit report recipe #3690

merged 37 commits into from
Oct 28, 2024

Conversation

madelondohmen
Copy link
Contributor

@madelondohmen madelondohmen commented Oct 16, 2024

NOTE: This PR uses the PR #3695


Changes

This PR makes it possible for a user to edit the ReportRecipe.

  • We've added a button to the Scheduled Reports page for each scheduled report in the table.
  • This button redirects the user to the OOI edit page, where the ReportRecipe can be edited.
  • After editing, the scheduler will be updated as well (to update the "deadline_at" and the "schedule" (schedule == cron-expression)

Issue link

Closes #3687

Demo

Opname.2024-10-16.092638.mp4

QA notes

  • Create a report and choose to schedule it
  • Go to the "Scheduled" tab on the Reports page
  • Open the row in the table
  • Click on the edit button
  • Try to edit all fields
  • Save
  • Check if the fields have been changed on the detail page
  • Also check if the fields have been changed on the Scheduled Reports page

Code Checklist

  • All the commits in this PR are properly PGP-signed and verified.
  • This PR only contains functionality relevant to the issue.
  • I have written unit tests for the changes or fixes I made.
  • I have checked the documentation and made changes where necessary.
  • I have performed a self-review of my code and refactored it to the best of my abilities.
  • Tickets have been created for newly discovered issues.
  • For any non-trivial functionality, I have added integration and/or end-to-end tests.
  • I have informed others of any required .env changes files if required and changed the .env-dist accordingly.
  • I have included comments in the code to elaborate on what is not self-evident from the code itself, including references to issues and discussions online, or implicit behavior of an interface.

Checklist for code reviewers:

Copy-paste the checklist from the docs/source/templates folder into your comment.


Checklist for QA:

Copy-paste the checklist from the docs/source/templates folder into your comment.

@madelondohmen madelondohmen self-assigned this Oct 16, 2024
@madelondohmen madelondohmen requested a review from a team as a code owner October 16, 2024 07:28
rocky/rocky/scheduler.py Show resolved Hide resolved
@madelondohmen madelondohmen marked this pull request as draft October 16, 2024 07:42
@madelondohmen madelondohmen marked this pull request as ready for review October 17, 2024 16:05
Copy link
Contributor

@ammar92 ammar92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, tiny remarks

rocky/reports/views/report_overview.py Outdated Show resolved Hide resolved
rocky/tools/forms/ooi_form.py Outdated Show resolved Hide resolved
@noamblitz
Copy link
Contributor

Tried to change the cron expression for a Report Recipe, got
image

@madelondohmen
Copy link
Contributor Author

madelondohmen commented Oct 23, 2024

Tried to change the cron expression for a Report Recipe, got ...

@noamblitz Did you try to restart the scheduler? A new endpoint ("/scheduled/search") has been added, so you have to restart the container to use it.

@noamblitz
Copy link
Contributor

noamblitz commented Oct 24, 2024

Checklist for QA:

  • I have checked out this branch, and successfully ran a fresh make reset.
  • I confirmed that there are no unintended functional regressions in this branch:
    • I have managed to pass the onboarding flow
    • Objects and Findings are created properly
    • Tasks are created and completed properly
  • I confirmed that the PR's advertised feature or hotfix works as intended.
  • I checked the logs for errors and/or warnings and made issues where necessary

What works:

image

Can update a recipe to run every minute. Reports are now created every minute.

image

What doesn't work:

n/a

Bug or feature?:

Naming of subreports is not correct.

@noamblitz
Copy link
Contributor

Not sure whether its a regression in this pr but in the other pr I tested, the naming of subreports works as expected.

@madelondohmen
Copy link
Contributor Author

madelondohmen commented Oct 25, 2024

Not sure whether its a regression in this pr but in the other pr I tested, the naming of subreports works as expected.

@noamblitz Naming of subreports should be fixed here:
#3726

@stephanie0x00
Copy link
Contributor

stephanie0x00 commented Oct 28, 2024

Editing reports works. This PR is an improvement 👍

The Cron field currently misses a front-end check that checks whether the input is expected/allowed or not. Entering a letter in this field throws the error as shown below. We can pick this up in a different Pr as it is a very specific fix. Corresponding bug report: #3741

image

underdarknl
underdarknl previously approved these changes Oct 28, 2024
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
70.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@underdarknl underdarknl merged commit 3c4b5c0 into main Oct 28, 2024
33 of 34 checks passed
@underdarknl underdarknl deleted the feature/edit-report-recipe branch October 28, 2024 12:32
jpbruinsslot added a commit that referenced this pull request Nov 6, 2024
* main:
  Fix reports with organization tags (#3790)
  Update README.rst - Fix guidelines URLs (#3789)
  Exclude Report from ooi list (#3768)
  Update `croniter` (#3767)
  Fixes for dropdowns (#3732)
  Fix scheduled Aggregate Report naming (#3748)
  Make systemctl call for kat-rocky-worker conditional (#3782)
  Fix vulnerability chapters in Aggregate table of content (#3780)
  Fix auth token middleware with wrong format header (#3755)
  Add rocky REST API for report recipes (#3746)
  Add exception handling to the rest api (#3708)
  Refactor Multi Report to comply to the new report flow (#3705)
  Fix report names for scheduled reports (#3726)
  Fix Multi Report recursion error (#3714)
  Bump waitress from 3.0.0 to 3.0.1 in /octopoes (#3760)
  Docs/add muted findings (#3699)
  Edit report recipe (#3690)
  Add start date to report schedule (#3701)
  Add REST API to list report and download pdf report (#3689)
  Fixes in Report Overview (#3707)
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.

Edit report recipe
7 participants