summaryrefslogtreecommitdiffstats
path: root/install/static/associate.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-09-29 00:52:56 -0500
committerAdam Young <ayoung@redhat.com>2010-09-29 15:43:23 -0400
commit4b4ecef4a32319932f31413feaf60e0dbfa96973 (patch)
treed1aec20a48073b23719efe81d0b5263e830a4bcc /install/static/associate.js
parent09555fae17dcd142c4b39643e3f7d376ed8d4841 (diff)
downloadfreeipa.git-4b4ecef4a32319932f31413feaf60e0dbfa96973.tar.gz
freeipa.git-4b4ecef4a32319932f31413feaf60e0dbfa96973.tar.xz
freeipa.git-4b4ecef4a32319932f31413feaf60e0dbfa96973.zip
Added error handler for ipa_cmd().
The ipa_cmd() has been modified such that when an error occurs a dialog box will appear showing the error message with 2 buttons: Retry and Cancel. If Retry is clicked, it will attempt to execute the same operation again. If Cancel is clicked, the operation will be canceled and the control is returned to the caller. New unit tests have been added to test ipa_cmd() on successfull and unsuccessfull cases. The associate.js, details.js, entity.js, search.js, and webui.js have been modified to display the error message inside the page. This behavior can be changed in the future (e.g. redirect to error page). The navigation.js and webui.js have been modified to render only the visible tabs. This improves the performance and reduce hidden errors. The navigation unit test has been modified to reflect this behavior. Some variables/functions also have been renamed for consistency.
Diffstat (limited to 'install/static/associate.js')
-rw-r--r--install/static/associate.js42
1 files changed, 21 insertions, 21 deletions
diff --git a/install/static/associate.js b/install/static/associate.js
index 207c745c..c3453e96 100644
--- a/install/static/associate.js
+++ b/install/static/associate.js
@@ -222,30 +222,30 @@ function AssociationList(obj, pkey, manyObj, associationColumns, jobj)
this.manyObj = manyObj;
this.parentTab = jobj;
- this.populate = function(userData) {
- var tbody = this.parentTab.find('.search-table tbody');
- tbody.empty();
- var associationList = userData.result.result[this.associationColumns[0].column];
- for (var j = 0; j < associationList.length; j++){
- var row = $("<tr/>").appendTo(tbody);
- for (var k = 0; k < associationColumns.length ;k++){
- var column = this.associationColumns[k].column;
- $("<td></td>",{
- html: userData.result.result[column][j]
- }).appendTo(row);
+ this.refresh = function() {
+
+ function refresh_on_success(userData) {
+ var tbody = this.parentTab.find('.search-table tbody');
+ tbody.empty();
+ var associationList = userData.result.result[this.associationColumns[0].column];
+ for (var j = 0; j < associationList.length; j++){
+ var row = $("<tr/>").appendTo(tbody);
+ for (var k = 0; k < associationColumns.length ;k++){
+ var column = this.associationColumns[k].column;
+ $("<td></td>",{
+ html: userData.result.result[column][j]
+ }).appendTo(row);
+ }
}
}
- }
- this.refresh = function() {
- ipa_cmd( 'show', [this.pkey], {},
- function(result){
- form.populate(result);
- },
- function(){
- alert("associationListFailure");
- },
- form.obj);
+ function refresh_on_error(xhr, text_status, error_thrown) {
+ var search_results = $('.search-results', jobj).empty();
+ search_results.append('<p>Error: '+error_thrown.name+'</p>');
+ search_results.append('<p>'+error_thrown.message+'</p>');
+ }
+
+ ipa_cmd('show', [this.pkey], {}, refresh_on_success, refresh_on_error, form.obj);
}
this.setup = function() {