Skip to content

[BUG] Agent delete confirmation modal names the wrong agent #827

Description

@wayneeseguin

On the admin agents page, clicking delete on any row opens a confirmation modal that always names the first agent in the list instead of the agent we clicked.

The handler reads the correct UUID from the clicked row and then builds the modal from the wrong object (web/htdocs/js/shield.js:715-717):

} else if (action == 'delete') {
  var agent_uuid = $(event.target).extract('agent-uuid');
  modal($($.template('agents-delete', { agent: data.agents[0] }))

The DELETE request a few lines down uses agent_uuid, so the correct agent is removed and no data is lost. The defect is confined to the confirmation text. With one agent registered nobody notices. With several, the modal asks the operator to confirm an irreversible action against a name they did not choose, which is where a display bug does real damage.

The fix is to find the clicked agent in data.agents by UUID and pass that to the template.

Introduced in 7391134 (2019-12-17), still present on develop at 21bea2f.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions