QutEcoacoustics / workbench-client

workbench-client: a client side browser application for interacting with acoustic workbenches
Other
8 stars 1 forks source link

Change delete model page to a delete confirmation modal #2042

Closed hudson-newey closed 1 year ago

hudson-newey commented 1 year ago

Change delete model page to a delete modal

At the moment, when deleting a project, region or site model, the client navigates to an entirely new page route to confirm. This is overkill and should instead use a modal.

Changes

Minor Changes

Moves menu item inheritance to the MenuItem interface
This interface is used by all menu items, allowing for all menu items to inherit each other now.

Historically, MenuRoute's could only be children of other MenuRoute's. This caused all the different menu items to cluster together into groups. e.g. all MenuRoute's would be clustered and sorted together. This process would then be repeated for the MenuModal's and MenuAction's.

This has now been changed so that MenuAction, MenuModal and MenuRoute's can now inherit and be children of each other (causing them to sort as a hierarchical cluster).

Minor changes / bug fixes unrelated to ticket:

Problems

  1. I have noticed that the menu items are not all of the same casing and is inconsistent across the client. We may want to consider using the Angular TitleCasePipe to standardize menu casing
  2. The tag_groups route has regressed in functionality and there is currently no way to verify that the delete modal is working on the tag_groups view. I have verified that the client has not regressed in functionality due to the changes made in this PR
  3. The delete Tag endpoint is not currently functional on the server side e.g. api.staging.ecosounds.org/admin/tags/2883

Issues

Fixes: #496

Visual Changes

Delete modals

Delete project modal: image

Batch upload annotations visual changes

The file input box did not have a border around it on Chrome

From image

To image

Final Checklist

hudson-newey commented 1 year ago

It would be interesting to use the RouteReuseStrategy in the future, however, from what I can see the RouterOutlet attach and detach events are only useful when there is a RouteReuseStrategy in place because it triggers when a reusable route is attached / detached.

If we end up using RouteReuseStrategy in the future is should be as simple as calling the existing onRouterOutlet method from the attach and detach routerOutelet events.

hudson-newey commented 1 year ago

Since your last review, I have added the delete modals to several more pages. I have outlined the changes since your last review below:

Tag Groups

Added a tag group delete modal menu item. This menu item is used on the edit tag groups page.

Added a method to delete tag groups from the list page. This method allows for a singular tag-group to be deleted through a modal from the list page if the "delete" button next to a tag is clicked. Since this button is embedded into the page, this async method uses the result value of the modal to assert if the user confirmed the deletion.

Added a method to delete tag groups from the edit page. This method is called when the "Delete tag" modal menu item is clicked and confirmed.

Added tests to assert that tag groups are correctly deleted from the list page

Added tests to assert that tag groups are correctly deleted from the edit page

Singular Tags

Added tag delete method on the tag edit page. This method is called by the tag delete modal menu item.

Added tests for the tag delete methods found on the tag edit page

Added a tag deletion method to the tag list page. This method allows for a singular tag to be deleted through a modal if the "delete" button next to a tag is clicked. Since this button is embedded into the page, this async method uses the result value of the modal to assert if the user confirmed the deletion.

Added test for the tags list page. These tests assert that a singular tag can be deleted if the "delete" button next to a tag is clicked.

Added a tag delete modal menu item. This menu item is used on the tag edit page.

Account cancellation

Added a cancelAccount method to the my-profile page component. This method is called when the "Cancel my account" menu button is clicked and the delete modal is confirmed.

Added tests to assert that the cancel account method works as expected

Added a "Cancel my account" modal menu item. This menu item is shown on the my-profile page component.