webui: allow --force in dnszone-mod and dnsrecord-add

Allow to use --force when changing authoritative nameserver address in DNS zone.

Same for dnsrecord-add for NS record.

https://fedorahosted.org/freeipa/ticket/4573

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-10-03 18:24:33 +02:00
parent 68825e7ac6
commit 741c31c2b4
3 changed files with 71 additions and 5 deletions

View File

@ -516,6 +516,55 @@ IPA.dnszone_details_facet = function(spec, no_init) {
return batch;
};
that.update = function (on_success, on_error) {
// If update touches 'idnssoamname', open dialog to allow to skip
// DNS resolution check (--force option)
var command = that.create_update_command();
command.on_success = function (data, text_status, xhr) {
that.update_on_success(data, text_status, xhr);
if (on_success) on_success.call(this, data, text_status, xhr);
};
command.on_error = function (xhr, text_status, error_thrown) {
that.update_on_error(xhr, text_status, error_thrown);
if (on_error) on_error.call(this, xhr, text_status, error_thrown);
};
if (command.options.idnssoamname === undefined) {
command.execute();
return;
}
var dialog = IPA.confirm_dialog({
title: '@i18n:objects.dnszone.soamname_change_title',
message: '@i18n:objects.dnszone.soamname_change_message',
ok_label: '@i18n:objects.realmdomains.check_dns',
on_ok: function () {
command.execute();
}
});
var cancel_button = dialog.get_button('cancel');
dialog.buttons.remove('cancel');
dialog.create_button({
name: 'force',
label: '@i18n:objects.realmdomains.force_update',
visible: true,
click: function () {
command.set_option('force', true);
command.execute();
dialog.close();
}
});
dialog.add_button(cancel_button);
dialog.open();
};
that.update_on_success = function(data, text_status, xhr) {
that.refresh();
that.on_update.notify();
@ -979,9 +1028,16 @@ IPA.dns.get_record_metadata = function() {
{
name: 'nsrecord',
attributes: [
'ns_part_hostname'
'ns_part_hostname',
{
$type: 'checkbox',
name: 'force',
label: '@i18n:objects.dnszone.skip_dns_check'
}
],
adder_attributes: [
'force'
],
adder_attributes: [],
columns: ['ns_part_hostname']
},
{
@ -1301,8 +1357,12 @@ IPA.dns.record_prepare_editor_for_type = function(type, fields, widgets, update)
}
var metadata = IPA.get_entity_param('dnsrecord', attribute.name);
if (metadata && update && metadata.flags &&
metadata.flags.indexOf('no_update') > -1) continue;
var no_update = metadata && metadata.flags &&
metadata.flags.indexOf('no_update') > -1;
var adder_attr = type.adder_attributes &&
type.adder_attributes.indexOf(attribute.name) > -1;
if (update && (no_update || adder_attr)) continue;
//create field
var field = {};

View File

@ -298,7 +298,10 @@
"add_permission": "Add Permission",
"add_permission_confirm":"Are you sure you want to add permission for DNS Zone ${object}?",
"remove_permission": "Remove Permission",
"remove_permission_confirm": "Are you sure you want to remove permission for DNS Zone ${object}?"
"remove_permission_confirm": "Are you sure you want to remove permission for DNS Zone ${object}?",
"skip_dns_check": "Skip DNS check",
"soamname_change_message": "Do you want to check if new authoritative nameserver address is in DNS",
"soamname_change_title": "Authoritative nameserver change"
},
"group": {
"details": "Group Settings",

View File

@ -443,6 +443,9 @@ class i18n_messages(Command):
"add_permission_confirm":_("Are you sure you want to add permission for DNS Zone ${object}?"),
"remove_permission": _("Remove Permission"),
"remove_permission_confirm": _("Are you sure you want to remove permission for DNS Zone ${object}?"),
"skip_dns_check": _("Skip DNS check"),
"soamname_change_message": _("Do you want to check if new authoritative nameserver address is in DNS"),
"soamname_change_title": _("Authoritative nameserver change"),
},
"group": {
"details": _("Group Settings"),