diff options
author | Petr VobornÃk <pvoborni@redhat.com> | 2012-02-23 11:26:05 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2012-02-29 12:59:13 +0100 |
commit | cf60e7e71e800bbbe5eb42039a375782af17c379 (patch) | |
tree | f22167fada58ed5bc75b7f1dfc73b7efc298ebff /install/ui/ipa.js | |
parent | 525bf04da56829ac2b7b6e086a7a2d965727ce02 (diff) | |
download | freeipa.git-cf60e7e71e800bbbe5eb42039a375782af17c379.tar.gz freeipa.git-cf60e7e71e800bbbe5eb42039a375782af17c379.tar.xz freeipa.git-cf60e7e71e800bbbe5eb42039a375782af17c379.zip |
Fixed DNS record add handling of 4304 error
Fixed hanling of 4304 error in DNS record add.
Code which handled this error in host-add was generalized and moved to IPA. DNS record add both in adder dialog and dns record table are using this generalized version.
https://fedorahosted.org/freeipa/ticket/2349
Diffstat (limited to 'install/ui/ipa.js')
-rw-r--r-- | install/ui/ipa.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 441e6468..d1bb0421 100644 --- a/install/ui/ipa.js +++ b/install/ui/ipa.js @@ -1178,6 +1178,46 @@ IPA.error_list = function() { return that; }; +IPA.create_4304_error_handler = function(adder_dialog) { + + var set_pkey = function(result) { + + var pkey_name = adder_dialog.entity.metadata.primary_key; + var args = adder_dialog.command.args; + var pkey = args[args.length-1]; + result[pkey_name] = pkey; + }; + + return function (xhr, text_status, error_thrown) { + + var ajax = this; + var command = adder_dialog.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: adder_dialog.title, + on_ok: function() { + data.result = { result: {} }; + set_pkey(data.result.result); + command.on_success.call(ajax, data, text_status, xhr); + } + }); + } else { + dialog = IPA.error_dialog({ + xhr: xhr, + text_status: text_status, + error_thrown: error_thrown, + command: command + }); + } + + dialog.open(adder_dialog.container); + }; +}; + IPA.limit_text = function(value, max_length) { if (!value) return ''; |