summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-01-18 12:12:47 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-01-18 12:35:14 -0500
commit5c105a5ff4dc027ba38dde39c2329d031deb1dc3 (patch)
tree9cc39e57b3e2dbc99e5bc4d8973562579086059b /install
parent17122d270546ff8864ae9c9c834abee03a68e204 (diff)
downloadfreeipa-5c105a5ff4dc027ba38dde39c2329d031deb1dc3.tar.gz
freeipa-5c105a5ff4dc027ba38dde39c2329d031deb1dc3.tar.xz
freeipa-5c105a5ff4dc027ba38dde39c2329d031deb1dc3.zip
Force flag for Hosts and Services.
The add dialogs for Hosts and Services have been updated to include a checkbox to force adding hosts/services that are not in DNS. The widgets has been updated to support tooltips.
Diffstat (limited to 'install')
-rw-r--r--install/static/add.js35
-rw-r--r--install/static/host.js14
-rw-r--r--install/static/service.js36
-rw-r--r--install/static/widget.js37
4 files changed, 88 insertions, 34 deletions
diff --git a/install/static/add.js b/install/static/add.js
index 69e0ad79b..69b1108c3 100644
--- a/install/static/add.js
+++ b/install/static/add.js
@@ -78,8 +78,7 @@ IPA.add_dialog = function (spec) {
state[that.entity_name + '-facet'] = 'details';
state[that.entity_name + '-pkey'] = pkey;
$.bbq.pushState(state);
- },
- function() { }
+ }
);
});
@@ -90,28 +89,30 @@ IPA.add_dialog = function (spec) {
that.dialog_init();
};
+ that.add = function(record, on_success, on_error) {
- function save_field(field, record, args, options){
var pkey_name = IPA.metadata[that.entity_name].primary_key;
- var value = record[field.name];
- if (!value) return;
- if (field.name == pkey_name) {
- args.push(value);
- } else {
- options[field.name] = value;
- }
- }
-
- that.add = function(record, on_success, on_error) {
- var args = [];
- var options = {};
+ var command = IPA.command({
+ method: that.entity_name+'_add',
+ on_success: on_success,
+ on_error: on_error
+ });
for (var i=0; i<that.fields.length; i++) {
- save_field(that.fields[i], record, args, options);
+ var field = that.fields[i];
+
+ var value = record[field.name];
+ if (!value) continue;
+
+ if (field.name == pkey_name) {
+ command.add_arg(value);
+ } else {
+ command.set_option(field.name, value);
+ }
}
- IPA.cmd('add', args, options, on_success, on_error, that.entity_name);
+ command.execute();
};
that.add_dialog_init = that.init;
diff --git a/install/static/host.js b/install/static/host.js
index dd435c56e..c3851ff75 100644
--- a/install/static/host.js
+++ b/install/static/host.js
@@ -88,9 +88,17 @@ IPA.host_add_dialog = function (spec) {
that.init = function() {
that.add_field(IPA.text_widget({
- 'name': 'fqdn',
- 'size': 40,
- 'undo': false
+ name: 'fqdn',
+ size: 40,
+ undo: false
+ }));
+
+ // TODO: Replace with i18n label
+ that.add_field(IPA.checkbox_widget({
+ name: 'force',
+ label: 'Force',
+ tooltip: 'force host name even if not in DNS',
+ undo: false
}));
that.add_dialog_init();
diff --git a/install/static/service.js b/install/static/service.js
index 4154b22d4..81f00ec77 100644
--- a/install/static/service.js
+++ b/install/static/service.js
@@ -100,6 +100,14 @@ IPA.service_add_dialog = function (spec) {
'undo': false
}));
+ // TODO: Replace with i18n label
+ that.add_field(IPA.checkbox_widget({
+ name: 'force',
+ label: 'Force',
+ tooltip: 'force principal name even if not in DNS',
+ undo: false
+ }));
+
that.add_dialog_init();
};
@@ -112,7 +120,8 @@ IPA.service_add_dialog = function (spec) {
var tr = $('<tr/>').appendTo(table);
var td = $('<td/>', {
- 'style': 'vertical-align: top;'
+ style: 'vertical-align: top;',
+ title: field.label
}).appendTo(tr);
td.append(field.label+': ');
@@ -128,7 +137,8 @@ IPA.service_add_dialog = function (spec) {
tr = $('<tr/>').appendTo(table);
td = $('<td/>', {
- 'style': 'vertical-align: top;'
+ style: 'vertical-align: top;',
+ title: field.label
}).appendTo(tr);
td.append(field.label+': ');
@@ -138,6 +148,23 @@ IPA.service_add_dialog = function (spec) {
span = $('<span/>', { 'name': 'host' }).appendTo(td);
field.create(span);
+
+ field = that.get_field('force');
+
+ tr = $('<tr/>').appendTo(table);
+
+ td = $('<td/>', {
+ style: 'vertical-align: top;',
+ title: field.label
+ }).appendTo(tr);
+ td.append(field.label+': ');
+
+ td = $('<td/>', {
+ 'style': 'vertical-align: top;'
+ }).appendTo(tr);
+
+ span = $('<span/>', { 'name': 'force' }).appendTo(td);
+ field.create(span);
};
that.get_record = function() {
@@ -151,6 +178,11 @@ IPA.service_add_dialog = function (spec) {
record['krbprincipalname'] = service+'/'+host;
+ field = that.get_field('force');
+ var force = field.save()[0];
+
+ record['force'] = force;
+
return record;
};
diff --git a/install/static/widget.js b/install/static/widget.js
index 9221e499c..576eef77b 100644
--- a/install/static/widget.js
+++ b/install/static/widget.js
@@ -30,6 +30,7 @@ IPA.widget = function(spec) {
that.id = spec.id;
that.name = spec.name;
that.label = spec.label;
+ that.tooltip = spec.tooltip;
that.read_only = spec.read_only;
that._entity_name = spec.entity_name;
@@ -81,10 +82,18 @@ IPA.widget = function(spec) {
}
function init() {
- if (that.entity_name && !that.label){
+ if (that.entity_name) {
that.param_info = IPA.get_param_info(that.entity_name, that.name);
- if ((that.param_info) && (that.label === undefined)){
- that.label = that.param_info.label;
+
+ if (that.param_info) {
+
+ if (that.label === undefined) {
+ that.label = that.param_info.label;
+ }
+
+ if (that.tooltip === undefined) {
+ that.tooltip = that.param_info.doc;
+ }
}
}
}
@@ -182,9 +191,10 @@ IPA.text_widget = function(spec) {
that.create = function(container) {
$('<input/>', {
- 'type': 'text',
- 'name': that.name,
- 'size': that.size
+ type: 'text',
+ name: that.name,
+ size: that.size,
+ title: that.tooltip
}).appendTo(container);
$('<span/>', {
@@ -269,7 +279,8 @@ IPA.checkbox_widget = function (spec) {
$('<input/>', {
type: 'checkbox',
name: that.name,
- checked : is_checked
+ checked : is_checked,
+ title: that.tooltip
}).appendTo(container);
if (that.undo) {
@@ -404,9 +415,10 @@ IPA.textarea_widget = function (spec) {
that.create = function(container) {
$('<textarea/>', {
- 'rows': that.rows,
- 'cols': that.cols,
- 'name': that.name
+ rows: that.rows,
+ cols: that.cols,
+ name: that.name,
+ title: that.tooltip
}).appendTo(container);
if (that.undo) {
@@ -904,12 +916,13 @@ IPA.dialog = function(spec) {
var tr = $('<tr/>').appendTo(table);
var td = $('<td/>', {
- 'style': 'vertical-align: top;'
+ style: 'vertical-align: top;',
+ title: field.label
}).appendTo(tr);
td.append(field.label+': ');
td = $('<td/>', {
- 'style': 'vertical-align: top;'
+ style: 'vertical-align: top;'
}).appendTo(tr);
var span = $('<span/>', { 'name': field.name }).appendTo(td);