-
Notifications
You must be signed in to change notification settings - Fork 58
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
Change plugins enabling in report flow to checkboxes #3747
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍 I just have a few tiny remarks, shouldn't be much work
|
||
for selected_plugin in selected_plugins: | ||
try: | ||
get_katalogus(self.organization.code).enable_boefje_by_id(selected_plugin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See earlier remark about the client
@@ -18,7 +18,7 @@ | |||
{% endfor %} | |||
{% endif %} | |||
{% for required_optional_plugin, plugins_ in plugins.items %} | |||
{% for plugin in plugins_ %}<input type="hidden" name="plugin" value="{{ plugin.id }}">{% endfor %} | |||
{% for plugin in plugins_ %}<input type="hidden" name="all_plugins" value="{{ plugin.id }}">{% endfor %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be sure: The views still seem to refer to the plugin
query parameter, so I'm unsure if this change works. Regardless, I think plugins
as a query parameter list would've been a better name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah weird right. It seems that this variable is and was not used... But I'm afraid to delete it.
Checklist for QA:
What works:Seems to work. Couldn't find anything that breaks obviously. What doesn't work:n/a Bug or feature?:n/a |
for selected_plugin in selected_plugins: | ||
try: | ||
client.enable_boefje_by_id(selected_plugin) | ||
except HTTPError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate that we bubble up the http errors from the client to here. Lets move that away asap, the katalogusclient already has some localized exceptions for other issues.
def post(self, request, *args, **kwargs): | ||
selected_plugins = request.POST.getlist("plugin", []) | ||
|
||
client = get_katalogus(self.organization.code) | ||
for selected_plugin in selected_plugins: | ||
try: | ||
client.enable_boefje_by_id(selected_plugin) | ||
except HTTPError: | ||
messages.error( | ||
request, | ||
_("An error occurred while enabling {}. The plugin is not available.").format(selected_plugin), | ||
) | ||
return self.post(request, *args, **kwargs) | ||
return super().post(request, *args, **kwargs) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this post to the ReportFinalSettingsView
in base.py? Then it will be implemented for aggregate and multireport
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure that the user knows that by checking the checkboxes that it means enable and continue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm no I cant move it to there because these plugins are enabled only in the export step, and not taken all the way to the final step like the other settings.
And the button already says: enable and continue
Permission checking now works. Can be tested by:
|
Quality Gate failedFailed conditions |
Changes
This PR changes the plugin tiles in the report flow to use checkboxes. This fixes the report flow because the checkboxes use a post request.
Issue link
Please add the link to the issue after "Closes".
Closes ...
Demo
QA notes
There might be regressions in the report flow because I renamed a variable that I think is unused, but I am not sure about that.
Code Checklist
.env
changes files if required and changed the.env-dist
accordingly.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.