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

Part 2: Change report flow to POST request for Setup Scan and Saving report #3182

Conversation

Rieven
Copy link
Contributor

@Rieven Rieven commented Jul 3, 2024

Changes

  • This is part 2 of changing report requests to POST
  • An extension of : Change report flow to POST requests #3174
  • handles post request from choosing report types to the configuration page
  • handles post request from the setup scan page to the generate report
  • Sometimes from report type selection is goes directly to the generate report when all required plugins are enabled

Issue link

#3279

Closes #3279

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.

@@ -115,109 +108,11 @@ def get_context_data(self, **kwargs):
return context


class SaveGenerateReportMixin(ReportPluginView):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to mixins.py

@@ -134,72 +131,6 @@ def get_context_data(self, **kwargs):
return context


class SaveAggregateReportMixin(ReportPluginView):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to mixins.py

Copy link
Contributor

@dekkers dekkers Aug 5, 2024

Choose a reason for hiding this comment

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

This is aggregate specific code and not a general reporting mixin. What is the reason to moving it to a mixins file instead of keeping it in the aggregate specific file? It doesn't seem a logical place to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you hadn't unnecessarily move this there also wouldn't have been merge conflicts here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have move this code to mixins to keep the flow of the report wizard in the code more readable. As it follows a path top down.

Copy link
Contributor Author

@Rieven Rieven Aug 5, 2024

Choose a reason for hiding this comment

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

I can also put it at the bottom of the file.

@Rieven Rieven mentioned this pull request Jul 4, 2024
9 tasks
…vws/nl-kat-coordination into feat/report-flow-post-request-part-2
…vws/nl-kat-coordination into feat/report-flow-post-request-part-2
…vws/nl-kat-coordination into feat/report-flow-post-request-part-2
@Rieven Rieven self-assigned this Jul 9, 2024
…vws/nl-kat-coordination into feat/report-flow-post-request-part-2
…vws/nl-kat-coordination into feat/report-flow-post-request-part-2
…vws/nl-kat-coordination into feat/report-flow-post-request-part-2
@Rieven Rieven marked this pull request as ready for review July 23, 2024 10:23
@Rieven Rieven requested a review from a team as a code owner July 23, 2024 10:23
class="inline layout-wide">
{% csrf_token %}
{% include "forms/report_form_fields.html" %}
<form novalidate
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this novalidate needed?

Copy link
Contributor Author

@Rieven Rieven Jul 24, 2024

Choose a reason for hiding this comment

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

This validation has the HTML styling, we use our own Django validations with messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean also Manon styling for showing form errors

Copy link
Contributor

Choose a reason for hiding this comment

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

If validation can already be done by the browser / before submitting the form in my opinion that it is better user experience then having it done after the form is submitted. If there are styling issues with the validation errors we should fix those syling issues instead of not doing the validation.

…vws/nl-kat-coordination into feat/report-flow-post-request-part-2
@TwistMeister
Copy link
Contributor

TwistMeister commented Aug 2, 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:

  • I believe I was able to verify that the mentioned API calls were done as POST requests, for either "select oois", "select report types" and "setup scan".
Screenshot 2024-08-02 at 13 01 36
Screenshot 2024-08-02 at 13 01 10
Screenshot 2024-08-02 at 13 00 50

What doesn't work:

  • n.a.

Bug or feature?:

  • n.a.

@Rieven Rieven merged commit b3e1041 into feat/report-flow-post-request-part-1 Aug 5, 2024
10 checks passed
@Rieven Rieven deleted the feat/report-flow-post-request-part-2 branch August 5, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Change report type selection and generate report requests to POST requests
4 participants