fixed empty dns record update

https://fedorahosted.org/freeipa/ticket/1477

Redirection after updating empty DNS Record (which is deleted).
Added hook to details facet for post update operation.
This commit is contained in:
Petr Vobornik
2011-07-22 13:24:27 +02:00
committed by Adam Young
parent 9e7a3e7f3c
commit 9a4ce988df
3 changed files with 43 additions and 2 deletions

View File

@@ -245,6 +245,7 @@ IPA.details_facet = function(spec) {
var that = IPA.facet(spec);
that.pre_execute_hook = spec.pre_execute_hook;
that.post_update_hook = spec.post_update_hook;
that.label = spec.label || IPA.messages && IPA.messages.facets && IPA.messages.facets.details;
that.facet_group = spec.facet_group || 'settings';
@@ -526,7 +527,12 @@ IPA.details_facet = function(spec) {
on_win(data, text_status, xhr);
if (data.error)
return;
if (that.post_update_hook) {
that.post_update_hook(data, text_status);
return;
}
var result = data.result.result;
that.load(result);
}

View File

@@ -265,7 +265,17 @@ IPA.entity_factories.dnsrecord = function() {
return IPA.entity_builder().
entity('dnsrecord').
containing_entity('dnszone').
details_facet({
details_facet({
post_update_hook:function(data){
var result = data.result.result;
if (result.idnsname) {
this.load(result);
} else {
this.reset();
var dialog = IPA.dnsrecord_redirection_dialog();
dialog.open(this.container);
}
},
disable_breadcrumb: false,
sections:[
{
@@ -424,6 +434,28 @@ IPA.entity_factories.dnsrecord = function() {
build();
};
IPA.dnsrecord_redirection_dialog = function(spec) {
spec = spec || {};
spec.title = spec.title || IPA.messages.dialogs.redirection;
var that = IPA.dialog(spec);
that.create = function() {
$('<p/>', {
'text': IPA.messages.objects.dnsrecord.deleted_no_data
}).appendTo(that.container);
$('<p/>', {
'text': IPA.messages.objects.dnsrecord.redirection_dnszone
}).appendTo(that.container);
};
that.add_button(IPA.messages.buttons.ok, function() {
that.close();
IPA.nav.show_page('dnszone','default');
});
return that;
};
IPA.dnsrecord_host_link_widget = function(spec){
var that = IPA.entity_link_widget(spec);
that.other_pkeys = function(){