diff options
author | Alex Rudyy <orudyy@apache.org> | 2013-04-24 13:35:27 +0000 |
---|---|---|
committer | Alex Rudyy <orudyy@apache.org> | 2013-04-24 13:35:27 +0000 |
commit | 77179da3f70ec38c849be4e1c0736e124743e810 (patch) | |
tree | 4649fb04cab061b9d37d2adbb7bf9da41767b53f | |
parent | 036d9119982e67f5c1d784862b7001819d5f5a7f (diff) | |
download | qpid-python-77179da3f70ec38c849be4e1c0736e124743e810.tar.gz |
QPID-4773: Add functionality to display information about http errors which might occur when communicating with the broker
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1471409 13f79535-47bb-0310-9956-ffa450edef68
3 files changed, 58 insertions, 2 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html index 2117ef361d..4b97c464ec 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html @@ -85,6 +85,22 @@ <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'"> <div qpid-type="footer"></div> </div> + + <div class="dijitHidden"> + <div data-dojo-type="dijit.Dialog" data-dojo-props="title: 'Connection Error'" id="errorDialog"> + <div style="width:400px; overflow: auto"> + <div><strong><span id="errorMessage">An error occurred when communicating with the broker.</span></strong></div> + <div><span id="statusMessage"></span></div> + <div style="margin-top: 10px; margin-bottom: 8px"><span id="reloadMessage">Please try to reload.</span></div> + <div id="errorDetails" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Details', open:false"> + <span id="errorDetailsMessage"></span> + </div> + </div> + <div class="dijitDialogPaneActionBar"> + <input type="button" value="Close" label="Close" dojoType="dijit.form.Button" onClick="dijit.byId('errorDialog').hide();"/> + </div> + </div> + </div> </div> </body> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js index 77ae1ccf47..2c2096d390 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js @@ -309,8 +309,49 @@ define(["dojo/_base/xhr", var maxHeight = Math.max(Math.floor(viewport.h * 0.6), 100); dialogContentArea.style.overflow= "auto"; dialogContentArea.style.height = Math.min(aproximateHeight, maxHeight ) + "px"; + setAttributesDialog.on("hide", function(e){setAttributesDialog.destroy();}); setAttributesDialog.show(); }; + util.xhrErrorHandler = function(error) + { + if (error) + { + if (error.hasOwnProperty("status")) + { + if (error.status == 401) + { + dojo.byId("statusMessage").innerHTML = "401 - Authentication required."; + } + else if (error.status == 403) + { + dojo.byId("statusMessage").innerHTML = "403 - Access denied."; + } + else + { + dojo.byId("statusMessage").innerHTML = "HTTP status code: " + error.status; + } + } + else + { + dojo.byId("statusMessage").innerHTML = ""; + } + if (error.hasOwnProperty("message")) + { + dojo.byId("errorDetailsMessage").innerHTML = error.message; + dojo.byId("errorDetails").style.display = "block"; + } + else + { + dojo.byId("errorDetails").style.display = "none"; + } + var dialog = dijit.byId("errorDialog"); + if (!dialog.open) + { + dialog.show(); + } + } + }; + return util; });
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js index 7bb52b938f..05df5e24b7 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js @@ -42,7 +42,6 @@ define(["dojo/_base/xhr", this.onDelete = function (object) { // fired when an object is deleted }; - } @@ -297,7 +296,7 @@ define(["dojo/_base/xhr", else { thisObj.buildModel(data); } - }); + }, util.xhrErrorHandler); }; |