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

123 delete all button on report listing screen #181

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ceallen
Copy link
Contributor

@ceallen ceallen commented May 8, 2024

No description provided.

@ceallen ceallen linked an issue May 8, 2024 that may be closed by this pull request
@ceallen ceallen requested a review from jonbannister May 8, 2024 17:03
try:
get_serializer().delete_all_for_report_name(report_name)
get_all_result_keys(get_serializer(), limit=DEFAULT_RESULT_LIMIT, force_reload=True)
return jsonify({"status": "ok"}), 200
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs some enhancement - exposing the JSON to the end user is a bit too low-level

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've set this up to redirect to the front page.

Copy link
Collaborator

@jonbannister jonbannister left a comment

Choose a reason for hiding this comment

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

Looks promising! A couple things:

  • I think the serialiser implementation of delete_all_for_report_name() wasn't committed? We should at least have an abstract method.
  • Needs some tests - consider adding to some of our new frontend testing as well :)
  • Add to CHANGELOG.md please

e.preventDefault();
var confirmed = confirm('Are you sure you wish to delete all reports?');
if (confirmed) {
window.location.href = this.getAttribute('data-href');
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could take a long time - do we want to display a spinner or even a status update to the user?

:return: A JSON which contains "status" which will either be "ok" or "error".
"""
try:
get_serializer().delete_all_for_report_name(report_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is this implemented?



@run_report_bp.route("/delete_all_reports/<path:report_name>", methods=["GET", "POST"])
def delete_all_reports(report_name):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs a test please

Manually run this report
</a>
<button class="ui button red" id="deleteAllReportsButton" data-href="/delete_all_reports/{{ report_name }}">
Delete all reports
</button>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally we could add a Jest test for this as well please

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.

"Delete all" button on report listing screen
2 participants