From 69877296dc9da05e89a8f2585165becc7bbd9c99 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Fri, 4 May 2012 14:02:01 +0200 Subject: 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 --- install/ui/dns.js | 7 +++++++ install/ui/field.js | 8 ++++++++ install/ui/host.js | 12 ++++++++++++ 3 files changed, 27 insertions(+) diff --git a/install/ui/dns.js b/install/ui/dns.js index 7b436c72..83934516 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -33,6 +33,13 @@ IPA.dns.config_entity = function(spec) { var that = IPA.entity(spec); that.init = function() { + + if (!IPA.dns_enabled) { + throw { + expected: true + }; + } + that.entity_init(); that.builder.details_facet({ diff --git a/install/ui/field.js b/install/ui/field.js index 162ec81b..03401dff 100644 --- a/install/ui/field.js +++ b/install/ui/field.js @@ -715,6 +715,14 @@ IPA.link_field = function(spec) { 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({ entity: that.other_entity.name, method: 'show', diff --git a/install/ui/host.js b/install/ui/host.js index 8c67f636..d07d63d9 100644 --- a/install/ui/host.js +++ b/install/ui/host.js @@ -353,6 +353,18 @@ IPA.host_adder_dialog = function(spec) { spec = spec || {}; 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); that.create = function() { -- cgit