Bug 42638: Cannot delete an identity provider domain

This patch updates the identity provider domain page so that clicking
the "Delete" button from the list of existing identity providers works
correctly.

There's a lot of unfinished copy and paste from the SMTP servers page,
including a missing chuck of modal dialog HTML.

To test, apply the patch and go to Administration -> Identity providers.

- If necessary, add at least one identity provider.
- Click the "Manage domains" button for an identity provider.
- If necessary, add at least one identity provider domain.
- Click the delete button corresponding to the domain you added.
  - A confirmation modal should appear.
  - Clicking "Close" should close the modal without triggering any
    action.
  - Clicking "Delete" should delete the domain.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6572a5aec0)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
Owen Leonard 2026-05-18 14:08:53 -04:00 committed by Jacob O'Mara
parent c57a3117e5
commit eb7d288a66
No known key found for this signature in database
1 changed files with 26 additions and 4 deletions

View File

@ -321,6 +321,27 @@
</thead>
</table>
</div>
<div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="delete_confirm_modal_label">Confirm deletion of identity provider domain</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div id="delete_confirm_dialog"></div>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-danger" id="delete_confirm_modal_button" role="button">Delete</a>
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- #delete_confirm_modal -->
[% END %]
[% END %]
@ -450,7 +471,7 @@
{
data: function( row, type, val, meta ) {
var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&amp;identity_provider_id=[%- identity_provider_id | html -%]&amp;op=edit_form&amp;identity_provider_domain_id='+ encodeURIComponent(row.identity_provider_domain_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n";
result += '<a class="btn btn-default btn-xs delete_identity_provider_domain" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-auth-provider-domain-id="'+ encodeURIComponent(row.identity_provider_domain_id) +'" data-auth-provider-domain="'+ encodeURIComponent((row.domain || '').escapeHtml()) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>';
result += '<a class="btn btn-default btn-xs delete_identity_provider_domain" role="button" href="#" data-auth-provider-domain-id="'+ encodeURIComponent(row.identity_provider_domain_id) +'" data-auth-provider-domain="'+ encodeURIComponent((row.domain || '').escapeHtml()) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>';
return result;
},
searchable: false,
@ -473,6 +494,7 @@
);
$("#delete_confirm_modal_button").data('auth-provider-domain-id', identity_provider_domain_id);
$("#delete_confirm_modal_button").data('auth-provider-domain', identity_provider_domain);
$("#delete_confirm_modal").modal('show');
});
$("#delete_confirm_modal_button").on( "click", function () {
@ -485,11 +507,11 @@
url: identity_provider_domains_url+"/"+identity_provider_domain_id
}).success(function() {
window.identity_provider_domains.api().ajax.reload(function (data) {
$("#smtp_action_result_dialog").hide();
$("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(identity_provider_domain)).show();
$("#identity_provider_domain_action_result_dialog").hide();
$("#identity_provider_domain_delete_success").html(_("Domain '%s' deleted successfully.").format(identity_provider_domain)).show();
});
}).fail(function () {
$("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs for details.").format(identity_provider_domain)).show();
$("#smtp_delete_error").html(_("Error deleting domain '%s'. Check the logs for details.").format(identity_provider_domain)).show();
}).done(function () {
$("#delete_confirm_modal").modal('hide');
});