summaryrefslogtreecommitdiffstats
path: root/install/ui/host.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-09-10 11:54:02 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-09-23 13:13:10 +0000
commit390d017e321fd5ed56af094cf1f1c74f64e95735 (patch)
treeea90b38f292170059dd757f59ef6b757c5b9b5a5 /install/ui/host.js
parenta90e50cdf759a1b436381f0e9e91caf2d4288636 (diff)
downloadfreeipa-390d017e321fd5ed56af094cf1f1c74f64e95735.tar.gz
freeipa-390d017e321fd5ed56af094cf1f1c74f64e95735.tar.xz
freeipa-390d017e321fd5ed56af094cf1f1c74f64e95735.zip
Modified dialog to use sections.
The IPA.dialog has been modified to store sections instead of fields. If there is no sections specified, it will create a default section. The adder dialog for automount map has been modified such that the fields related to indirect map are stored in a section which will only be visible when the map type is set to indirect. The adder dialog for host has been modified such that it uses a custom section for hostname and DNS zone and standard section for the other fields. Ticket #1394
Diffstat (limited to 'install/ui/host.js')
-rw-r--r--install/ui/host.js158
1 files changed, 72 insertions, 86 deletions
diff --git a/install/ui/host.js b/install/ui/host.js
index 2b0a5a4ed..1a3ccadc6 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -119,37 +119,50 @@ IPA.entity_factories.host = function () {
factory: IPA.host_adder_dialog,
width: 400,
height: 250,
- fields: [
+ sections: [
{
- factory: IPA.widget,
+ factory: IPA.host_fqdn_section,
name: 'fqdn',
- optional: true,
- hidden: true
- },
- {
- factory: IPA.text_widget,
- name: 'hostname',
- label: IPA.messages.objects.service.host,
- undo: false
- },
- {
- factory: IPA.dnszone_select_widget,
- name: 'dnszone',
- label: IPA.metadata.objects.dnszone.label_singular,
- editable: true,
- empty_option: false,
- undo: false
- },
- {
- factory: IPA.force_host_add_checkbox_widget,
- name: 'force'
+ fields: [
+ {
+ factory: IPA.widget,
+ name: 'fqdn',
+ optional: true,
+ hidden: true
+ },
+ {
+ factory: IPA.text_widget,
+ name: 'hostname',
+ label: IPA.messages.objects.service.host,
+ param_info: { required: true },
+ undo: false
+ },
+ {
+ factory: IPA.dnszone_select_widget,
+ name: 'dnszone',
+ label: IPA.metadata.objects.dnszone.label_singular,
+ editable: true,
+ empty_option: false,
+ param_info: { required: true },
+ undo: false
+ }
+ ]
},
{
- factory: IPA.text_widget,
- name: 'ip_address',
- label: IPA.get_method_option('host_add','ip_address')['label'],
- tooltip: IPA.get_method_option('host_add','ip_address')['doc'],
- undo: false
+ name: 'other',
+ fields: [
+ {
+ factory: IPA.text_widget,
+ name: 'ip_address',
+ param_info: IPA.get_method_option('host_add', 'ip_address'),
+ undo: false
+ },
+ {
+ factory: IPA.force_host_add_checkbox_widget,
+ name: 'force',
+ param_info: IPA.get_method_option('host_add', 'force')
+ }
+ ]
}
]
}).
@@ -159,91 +172,55 @@ IPA.entity_factories.host = function () {
build();
};
-IPA.host_adder_dialog = function(spec) {
+IPA.host_fqdn_section = function(spec) {
spec = spec || {};
- spec.retry = typeof spec.retry !== 'undefined' ? spec.retry : false;
- var that = IPA.add_dialog(spec);
-
- that.create = function() {
+ var that = IPA.details_section(spec);
- that.container.addClass('host-adder-dialog');
+ that.create = function(container) {
+ that.container = container;
var hostname = that.get_field('hostname');
var dnszone = that.get_field('dnszone');
var table = $('<table/>', {
- name: 'fqdn'
+ 'class': 'fqdn'
}).appendTo(that.container);
var tr = $('<tr/>').appendTo(table);
- var td = $('<td/>', {
- name: hostname.name,
+ var th = $('<th/>', {
+ 'class': 'hostname',
title: hostname.label,
text: hostname.label
}).appendTo(tr);
- td = $('<td/>', {
- name: dnszone.name,
+ th = $('<th/>', {
+ 'class': 'dnszone',
title: dnszone.label,
text: dnszone.label
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
- td = $('<td/>').appendTo(tr);
+ var td = $('<td/>', {
+ 'class': 'hostname'
+ }).appendTo(tr);
+
var span = $('<span/>', {
name: hostname.name
}).appendTo(td);
hostname.create(span);
- td = $('<td/>').appendTo(tr);
- span = $('<span/>', {
- name: dnszone.name
- }).appendTo(td);
- dnszone.create(span);
-
- table = $('<table/>', {
- name: 'other'
- }).appendTo(that.container);
-
- var force = that.get_field('force');
-
- tr = $('<tr/>').appendTo(table);
-
- td = $('<td/>', {
- title: force.label,
- text: force.label+':'
- }).appendTo(tr);
-
- td = $('<td/>', {
- title: force.label
- }).appendTo(tr);
-
- span = $('<span/>', {
- name: force.name
- }).appendTo(td);
- force.create(span);
-
- var ip_address = that.get_field('ip_address');
-
- tr = $('<tr/>').appendTo(table);
-
td = $('<td/>', {
- title: ip_address.label,
- text: ip_address.label+':'
- }).appendTo(tr);
-
- td = $('<td/>', {
- title: ip_address.label
+ 'class': 'dnszone'
}).appendTo(tr);
span = $('<span/>', {
- name: ip_address.name
+ name: dnszone.name
}).appendTo(td);
- ip_address.create(span);
+ dnszone.create(span);
var hostname_input = $('input', hostname.container);
var dnszone_input = $('input', dnszone.container);
@@ -271,13 +248,22 @@ IPA.host_adder_dialog = function(spec) {
field = that.get_field('dnszone');
var dnszone = field.save()[0];
- record.fqdn = hostname && dnszone ? hostname+'.'+dnszone : null;
+ record.fqdn = hostname && dnszone ? [ hostname+'.'+dnszone ] : [];
+ };
+
+ return that;
+};
+
+IPA.host_adder_dialog = function(spec) {
- field = that.get_field('force');
- record.force = field.save()[0];
+ spec = spec || {};
+ spec.retry = typeof spec.retry !== 'undefined' ? spec.retry : false;
- field = that.get_field('ip_address');
- record.ip_address = field.save()[0];
+ var that = IPA.add_dialog(spec);
+
+ that.create = function() {
+ that.dialog_create();
+ that.container.addClass('host-adder-dialog');
};
that.on_error = function(xhr, text_status, error_thrown) {
@@ -660,8 +646,8 @@ IPA.host_password_widget = function(spec) {
var record = {};
dialog.save(record);
- var new_password = record.password1;
- var repeat_password = record.password2;
+ var new_password = record.password1[0];
+ var repeat_password = record.password2[0];
if (new_password != repeat_password) {
alert(IPA.messages.password.password_must_match);