Skip to content

Leverage HTMX for confirmation dialogs #8231

@jeremystretch

Description

@jeremystretch

NetBox version

v3.1.4

Feature type

Change to existing functionality

Proposed functionality

Currently, when deleting an object, two requests are made:

  1. The user clicks delete and is taken to the deletion confirmation form.
  2. The user submits the confirmation form, the object is deleted, and the user is redirected to the return URL.

It should be trivial to instead use a modal dialog to display the confirmation form. The proposed workflow would be:

  1. The user clicks delete and an HTMX request is made to retrieve the confirmation form (and any relevant information, such as related objects). The form is rendered in a modal and displayed, but the user remains on the original page.
  2. The user submits the confirmation form, the object is deleted, and the user is redirected to the return URL.

Although we're still technically making two requests, the first loads only the confirmation form and avoids a complete page request.

We should be able to implement this entirely within the relevant generic view classes.

Use case

Loading the confirmation dialog via HTMX avoids a full page refresh and greatly reduces the time needed to delete an object (and especially to abort the deletion of an object).

Database changes

No response

External dependencies

No response

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions