From 08905eb9a9039b38c032275a87b4f5602e5a63dd Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Fri, 5 Aug 2011 17:12:21 +0200 Subject: Fixed adding host without DNS reverse zone https://fedorahosted.org/freeipa/ticket/1481 Shows status dialog instead of error dialog (error 4304 is treated like success). Refactored error dialog. Added generic message dialog (IPA.message_dialog) Modified core tests to work with dialog. --- install/ui/host.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'install/ui/host.js') diff --git a/install/ui/host.js b/install/ui/host.js index b8e849211..743196b08 100644 --- a/install/ui/host.js +++ b/install/ui/host.js @@ -102,6 +102,7 @@ IPA.entity_factories.host = function () { }). standard_association_facets(). adder_dialog({ + factory: IPA.host_adder_dialog, width: 400, height: 250, fields:[ @@ -128,6 +129,47 @@ IPA.entity_factories.host = function () { build(); }; +IPA.host_adder_dialog = function(spec) +{ + spec = spec || {}; + spec.retry = typeof spec.retry !== 'undefined' ? spec.retry : false; + + var that = IPA.add_dialog(spec); + + that.on_error = function(xhr, text_status, error_thrown) + { + var command = that.command; + var data = error_thrown.data; + var dialog = null; + + if(data && data.error && data.error.code === 4304) { + dialog = IPA.message_dialog({ + message: data.error.message, + title: spec.title, + on_ok: function() { + data.result = { + result: { + fqdn: that.get_field('fqdn').save() + } + }; + command.on_success(data, text_status, xhr); + } + }); + } else { + dialog = IPA.error_dialog({ + xhr: xhr, + text_status: text_status, + error_thrown: error_thrown, + command: command + }); + } + + dialog.open(that.container); + }; + + return that; +}; + IPA.host_deleter_dialog = function(spec) { spec = spec || {}; -- cgit