Skip to content

Feature/670 add delete button endpoint details

Describe the MR

Adds a delete button with corresponding confirmation modal to the endpoint details view in watch.

Why was this MR needed?

Not being able to delete from the endpoint details view was annoying.

Extra-care points?

I had to make the "delete endpoint modal" a component to share code, but I'm not happy with the solution. The modal is still twice in the templates, when we should only have one modal.

At some point we'll have to take the time to create a centralized modal system, but I'm unhappy with most solutions out there. Vue Bootstrap seems to have nailed the solution, though. Actually, all solutions. It's a festival of APIs and I don't like it either.

Concerns on my mind:

  • who gets to open the modal? (easy: only the component that triggers the "show modal" event)
  • who gets to close the modal? (hard: the logical thing would be to copy "open" behaviour and leave that to the initial component. But that would mean rewriting "close on cancel" in each initial component. Write "close on cancel" in the modal, and you lose the symmetry, and also you lose the opportunity to customize cancel behaviour in the initial component.)
  • how do you listen for modal events? (hard-ish: if you have a centralized system for modals, does that mean you listen for events on a centralized component or plugin to act on confirm or close? this needs careful design and naming)
  • where does the business logic go? (harder: the simple answer is "the initial component reacts to the confirm event and performs business logic". But this MR is already a counter-example. In our "delete endpoint modal", we know the business logic will always be "delete the endpoint", so we want to share code at the modal level, so we don't have to rewrite it at the compoment level.)

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • CHANGELOG updated
  • Unit Tests added/updated

What are the relevant issue numbers?

Closes #670 (closed)

License and Developer Certificate of Origin

  • By contributing to Pantomath SAS, You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Pantomath SAS. Except for the license granted herein to Pantomath SAS and recipients of software distributed by Pantomath SAS, You reserve all right, title, and interest in and to Your Contributions. All Contributions are subject to the following Developer Certificate of Origin and License terms.

Merge request reports