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

Updated frontend to send a single bulk delete request instead of one request for each record #2985

Merged
merged 8 commits into from Jul 11, 2023

Conversation

thesujai
Copy link
Contributor

@thesujai thesujai commented Jul 1, 2023

Fixes #2701

Technical details

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the develop branch of the repository
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@rajatvijay rajatvijay added this to the Backlog milestone Jul 5, 2023
@rajatvijay rajatvijay added the pr-status: review A PR awaiting review label Jul 5, 2023
Copy link
Contributor

@seancolsen seancolsen left a comment

Choose a reason for hiding this comment

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

Thanks for this pr, @thesujai. It mostly looks great. There's one more thing I'd like to handle though...

It's possible that attempting to delete records will fail at the DB layer. For example, you might be trying to delete a record which is referenced by other records. We don't yet support deleting via CASCADE, so the related records will need to be deleted first.

  • Before this PR:

    Failure to delete such records had decent error behavior, allowing the user to understand what happened and understand the steps needed to fix it.

    image

  • After this PR:

    When a single record is being deleted, the UI handles errors nicely. Good!

    image

    But when multiple records are being deleted, the UI does not handle errors very well.

    image

Changes I'd like to see to improve the problematic error scenario noted above

  • All loading spinners should clear when the request resolves.
  • The error message from the API should display in the toast message. (No need to display it in the row header cells, because the API doesn't give us per-row error messages.)

@thesujai
Copy link
Contributor Author

Hey @seancolsen, Thank you for the review
I made the suggested changes, here are some UI which will looks different:

  • When deleting multiple records containing rows with foreign references:
    Screenshot from 2023-07-11 13-26-26

  • When deleting a single row with foreign reference:
    Screenshot from 2023-07-11 13-26-08

Earlier when multiple rows were selected containing ones with foreign references, some were deleted leaving the ones with foreign reference untouched. But with the new changes if the selection contain any foreign reference row, it will not delete any of the rows(Which i think would be more safe)

- Use `pluralize` function.
- Small readability improvements.
- Organize imports.
Copy link
Contributor

@seancolsen seancolsen left a comment

Choose a reason for hiding this comment

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

Looks great, @thesujai. Thanks!

I also added 00a06e9 to make use of our pluralize function for the error message.

@seancolsen seancolsen added this pull request to the merge queue Jul 11, 2023
Merged via the queue into mathesar-foundation:develop with commit 4bee347 Jul 11, 2023
7 checks passed
@thesujai thesujai deleted the delete-bulk branch July 11, 2023 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: review A PR awaiting review
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Update frontend to send a single bulk delete request instead of one request for each record
3 participants