From 6039fdd6b3002f65ecd0121b7ca6d31e49b9590e Mon Sep 17 00:00:00 2001 From: Adam Young Date: Wed, 1 Jun 2011 09:34:44 -0400 Subject: redirect on error Code for redirecting on error has been moved to IPA.facet so it can be called from both details and assocaiton facets. --- install/ui/associate.js | 8 +------- install/ui/details.js | 17 +---------------- install/ui/entity.js | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 23 deletions(-) (limited to 'install') diff --git a/install/ui/associate.js b/install/ui/associate.js index 73a19021a..cb741652f 100644 --- a/install/ui/associate.js +++ b/install/ui/associate.js @@ -1086,12 +1086,6 @@ IPA.association_facet = function (spec) { that.refresh_table(); } - function on_error(xhr, text_status, error_thrown) { - var summary = $('span[name=summary]', that.table.tfoot).empty(); - summary.append('

Error: '+error_thrown.name+'

'); - summary.append('

'+error_thrown.message+'

'); - } - var pkey = IPA.get_entity(that.entity_name).get_primary_key(); IPA.command({ @@ -1099,7 +1093,7 @@ IPA.association_facet = function (spec) { method: 'show', args: pkey, on_success: on_success, - on_error: on_error + on_error: that.on_error }).execute(); }; diff --git a/install/ui/details.js b/install/ui/details.js index d9c948e97..80e7bd9e6 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -640,22 +640,7 @@ IPA.details_facet = function(spec) { that.load(data.result.result); }; - command.on_error = function(xhr, text_status, error_thrown) { - if (that.entity.redirect_facet) { - var current_entity = that.entity; - while (current_entity.containing_entity){ - current_entity = current_entity.containing_entity; - } - IPA.nav.show_page( - current_entity.name, - that.entity.redirect_facet); - return; - }else{ - var details = $('.details', that.container).empty(); - details.append('

Error: '+error_thrown.name+'

'); - details.append('

'+error_thrown.message+'

'); - } - }; + command.on_error = that.on_error; command.execute(); }; diff --git a/install/ui/entity.js b/install/ui/entity.js index 4b6ce1d0e..030bcb016 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -130,6 +130,25 @@ IPA.facet = function (spec) { return $('.content', that.container); }; + + that.on_error = function(xhr, text_status, error_thrown) { + if (that.entity.redirect_facet) { + var current_entity = that.entity; + while (current_entity.containing_entity){ + current_entity = current_entity.containing_entity; + } + IPA.nav.show_page( + current_entity.name, + that.entity.redirect_facet); + return; + }else{ + var details = $('.details', that.container).empty(); + details.append('

Error: '+error_thrown.name+'

'); + details.append('

'+error_thrown.message+'

'); + } + }; + + // methods that should be invoked by subclasses that.facet_init = that.init; that.facet_create_header = that.create_header; -- cgit