WebUI: Add confirmation dialog for changing default user/host group

Changing default group on automember rules page is too easy.
Add a confirmation dialog to avoid misclick in the case.

Ticket: https://pagure.io/freeipa/issue/8322

Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
This commit is contained in:
Serhii Tsymbaliuk 2020-05-13 15:54:17 +02:00
parent 8de73c1590
commit 33ca074558
No known key found for this signature in database
GPG Key ID: 632C7F5C1BC85519
2 changed files with 19 additions and 5 deletions

View File

@ -601,11 +601,22 @@ IPA.automember.default_group_widget = function(spec) {
if (group === that.group) return;
if (group === '') {
that.remove_default_group();
} else {
that.set_default_group(group);
}
var dialog = IPA.confirm_dialog({
title: that.get_title(),
message: text.get('@i18n:objects.automember.default_group_confirm'),
on_ok: function() {
if (group === '') {
that.remove_default_group();
} else {
that.set_default_group(group);
}
},
on_cancel: function() {
that.group_select.update([that.group]);
}
});
dialog.open();
};
that.load = function(data) {

View File

@ -522,6 +522,9 @@ class i18n_messages(Command):
"Add exclusive condition into '${primary_key}'"
),
"attribute": _("Attribute"),
"default_group_confirm": _(
"Are you sure you want to change default group?"
),
"default_host_group": _("Default host group"),
"default_user_group": _("Default user group"),
"exclusive": _("Exclusive"),