mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
DNS UI: added A,AAAA create reverse options to adder dialog
To DNS record adder dialog were added a_extra_create_reverse and aaaa_extra_create_reverse options. It's UI part of #2009. https://fedorahosted.org/freeipa/ticket/2349
This commit is contained in:
parent
a1f8c39f88
commit
fbf46fb78c
@ -534,6 +534,10 @@ IPA.dns.get_record_metadata = function() {
|
|||||||
{
|
{
|
||||||
name: 'a_part_ip_address',
|
name: 'a_part_ip_address',
|
||||||
validators: [IPA.ip_v4_address_validator()]
|
validators: [IPA.ip_v4_address_validator()]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'checkbox',
|
||||||
|
name: 'a_extra_create_reverse'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
columns: [
|
columns: [
|
||||||
@ -549,6 +553,10 @@ IPA.dns.get_record_metadata = function() {
|
|||||||
{
|
{
|
||||||
name:'aaaa_part_ip_address',
|
name:'aaaa_part_ip_address',
|
||||||
validators: [IPA.ip_v6_address_validator()]
|
validators: [IPA.ip_v6_address_validator()]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'checkbox',
|
||||||
|
name: 'aaaa_extra_create_reverse'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
columns: [
|
columns: [
|
||||||
@ -1045,7 +1053,7 @@ IPA.dns.extend_spec = function(spec, fields, widgets) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IPA.dns.record_prepare_editor_for_type = function(type, fields, widgets) {
|
IPA.dns.record_prepare_editor_for_type = function(type, fields, widgets, update) {
|
||||||
|
|
||||||
var set_defined = function(property, object, name) {
|
var set_defined = function(property, object, name) {
|
||||||
if (property !== undefined) {
|
if (property !== undefined) {
|
||||||
@ -1069,19 +1077,27 @@ IPA.dns.record_prepare_editor_for_type = function(type, fields, widgets) {
|
|||||||
for (var i=0; i<type.attributes.length;i++) {
|
for (var i=0; i<type.attributes.length;i++) {
|
||||||
var attribute = type.attributes[i];
|
var attribute = type.attributes[i];
|
||||||
|
|
||||||
|
if (typeof attribute === 'string') {
|
||||||
|
attribute = {
|
||||||
|
name: attribute
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var metadata = IPA.get_entity_param('dnsrecord', attribute.name);
|
||||||
|
if (metadata && update && metadata.flags &&
|
||||||
|
metadata.flags.indexOf('no_update') > -1) continue;
|
||||||
|
|
||||||
//create field
|
//create field
|
||||||
var field = {};
|
var field = {};
|
||||||
if (typeof attribute === 'string') {
|
|
||||||
field.name = attribute;
|
field.name = attribute.name;
|
||||||
} else {
|
field.label = attribute.label ||
|
||||||
field.name = attribute.name;
|
IPA.dns.record_get_attr_label(attribute.name);
|
||||||
field.label = attribute.label ||
|
set_defined(attribute.type, field, 'type');
|
||||||
IPA.dns.record_get_attr_label(attribute.name);
|
set_defined(attribute.validators, field, 'validators');
|
||||||
set_defined(attribute.type, field, 'type');
|
set_defined(attribute.required, field, 'required');
|
||||||
set_defined(attribute.validators, field, 'validators');
|
copy_obj(widget, attribute.field_opt);
|
||||||
set_defined(attribute.required, field, 'required');
|
|
||||||
copy_obj(widget, attribute.field_opt);
|
|
||||||
}
|
|
||||||
field.widget = type.name+'.'+field.name;
|
field.widget = type.name+'.'+field.name;
|
||||||
fields.push(field);
|
fields.push(field);
|
||||||
|
|
||||||
@ -1213,6 +1229,9 @@ IPA.dns.record_get_attr_label = function(part_name) {
|
|||||||
|
|
||||||
if (part_name.indexOf('_part_') > -1) {
|
if (part_name.indexOf('_part_') > -1) {
|
||||||
|
|
||||||
|
label = label.substring(label.indexOf(' '));
|
||||||
|
} else if (part_name.indexOf('_extra_') > -1) {
|
||||||
|
|
||||||
label = label.substring(label.indexOf(' '));
|
label = label.substring(label.indexOf(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1293,16 +1312,18 @@ IPA.dnsrecord_adder_dialog_type_policy = function(spec) {
|
|||||||
var fields = that.container.fields.get_fields();
|
var fields = that.container.fields.get_fields();
|
||||||
|
|
||||||
for (var i=0; i<fields.length; i++) {
|
for (var i=0; i<fields.length; i++) {
|
||||||
|
|
||||||
var field = fields[i];
|
var field = fields[i];
|
||||||
|
|
||||||
var fieldtype;
|
var fieldtype;
|
||||||
var index = field.name.indexOf('_part_');
|
var attr_types = ['_part_', '_extra_', 'record'];
|
||||||
if (index > -1) {
|
|
||||||
fieldtype = field.name.substring(0, index);
|
|
||||||
} else {
|
|
||||||
fieldtype = field.name.substring(0, field.name.indexOf('record'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (var j=0; j<attr_types.length; j++) {
|
||||||
|
var index = field.name.indexOf(attr_types[j]);
|
||||||
|
if (index > -1) {
|
||||||
|
fieldtype = field.name.substring(0, index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
field.enabled = (field.name === 'idnsname' ||
|
field.enabled = (field.name === 'idnsname' ||
|
||||||
field.name === that.type_field_name ||
|
field.name === that.type_field_name ||
|
||||||
@ -1657,7 +1678,7 @@ IPA.dns.record_type_table_widget = function(spec) {
|
|||||||
var type = IPA.dns.get_record_type(dnstype+'record');
|
var type = IPA.dns.get_record_type(dnstype+'record');
|
||||||
|
|
||||||
IPA.dns.record_prepare_editor_for_type(type, dialog_spec.fields,
|
IPA.dns.record_prepare_editor_for_type(type, dialog_spec.fields,
|
||||||
dialog_spec.widgets);
|
dialog_spec.widgets, true);
|
||||||
|
|
||||||
var dialog = IPA.entity_adder_dialog(dialog_spec);
|
var dialog = IPA.entity_adder_dialog(dialog_spec);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user