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.
This commit is contained in:
Petr Vobornik
2011-08-05 17:12:21 +02:00
committed by Endi S. Dewata
parent 966fbd6485
commit 08905eb9a9
6 changed files with 163 additions and 67 deletions

View File

@@ -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 || {};