Host page fixed to work with disabled DNS support

When DNS support was disabled there were following errors in Web UI:
 1) Host details page was not filled with data
 2) Host adder dialog was broken -> unusable
 3) DNS tab was displayed in navigation

The bugs were fixed by:

1) Was caused by entity_link_widget. The widget was modified to do not show link if other_entity (in this case dnsrecord) is not present.

2) Was caused by host_fqdn_widget. The widget is unusable becouse withou DNS support it doesn't have access to DNS zone entity. The section with this widget was removed. Also IP address field was removed because it shouln't be used without DNS support. New 'fqdn' text box was added for specifying hostname.

3) New DNS config entity was initialized but it wasn't shown because it caused some JavaScript error. The dnsconfig's init method was modified to throw expected exception. Now no dns entity is initialized and therefore DNS tab in navigation is not displayed.

https://fedorahosted.org/freeipa/ticket/2728
This commit is contained in:
Petr Vobornik 2012-05-04 14:02:01 +02:00
parent abbecf450f
commit 69877296dc
3 changed files with 27 additions and 0 deletions

View File

@ -33,6 +33,13 @@ IPA.dns.config_entity = function(spec) {
var that = IPA.entity(spec); var that = IPA.entity(spec);
that.init = function() { that.init = function() {
if (!IPA.dns_enabled) {
throw {
expected: true
};
}
that.entity_init(); that.entity_init();
that.builder.details_facet({ that.builder.details_facet({

View File

@ -715,6 +715,14 @@ IPA.link_field = function(spec) {
that.check_entity_link = function() { that.check_entity_link = function() {
//In some cases other entity may not be present.
//For example when DNS is not configured.
if (!that.other_entity) {
that.widget.is_link = false;
that.widget.update(that.values);
return;
}
IPA.command({ IPA.command({
entity: that.other_entity.name, entity: that.other_entity.name,
method: 'show', method: 'show',

View File

@ -353,6 +353,18 @@ IPA.host_adder_dialog = function(spec) {
spec = spec || {}; spec = spec || {};
spec.retry = spec.retry !== undefined ? spec.retry : false; spec.retry = spec.retry !== undefined ? spec.retry : false;
if (!IPA.dns_enabled) {
//When server is installed without DNS support, a use of host_fqdn_widget
//is bad because there are no DNS zones. IP address field is useless as
//well. Special section and IP address field should be removed and normal
//fqdn textbox has to be added.
spec.sections.shift();
spec.sections[0].fields.shift();
spec.sections[0].fields.unshift('fqdn');
delete spec.height;
}
var that = IPA.entity_adder_dialog(spec); var that = IPA.entity_adder_dialog(spec);
that.create = function() { that.create = function() {