Update error display format

This commit is contained in:
denz
2015-06-04 11:12:31 +09:00
parent 954538966d
commit 136da734f0
3 changed files with 57 additions and 9 deletions
@@ -15,10 +15,19 @@
return this.$parent;
}.bind(this);
this.showError = function (msg) {
this.showError = function (vResult) {
$timeout(function () {
this.getElement('.error').show();
this.getElement('.error .msg').text(msg);
this.getElement('.error').show();
if ( typeof msg == "string" ) {
this.getElement('.error .msg').text(vResult);
} else {
this.getElement('.error .msg').text(vResult.message);
this.getElement('.error .method').text(vResult.request.method);
this.getElement('.error .header').html(this._transTableFormat(vResult.request.heads));
this.getElement('.error .parameters').html(this._transTableFormat(vResult.request.parameters));
this.getElement('.error .url').text(vResult.request.url);
this.getElement('.error .stacktrace').text(vResult.stacktrace);
}
}.bind(this), 300);
}.bind(this);
this.hideError = function () {
@@ -54,6 +63,16 @@
this.getElement = function (selector) {
return this.$parent ? $(selector, this.$parent) : $(selector);
}.bind(this);
this._transTableFormat = function( obj ) {
var str = [ "<table>"];
for( var p in obj ) {
str.push("<tr>");
str.push("<td>" + p + "</td><td style='padding-left:20px'>" + obj[p] + "</td>");
str.push("</tr>");
}
str.push("</table>");
return str.join("");
}
};
}]);
})();
@@ -191,9 +191,13 @@
});
} else {
ServerMapDaoService.getServerMapData(htLastQuery, function (err, query, mapData) {
if (err) {
if (err || mapData.exception ) {
oProgressBarService.stopLoading();
oAlertService.showError('There is some error.');
if ( err ) {
oAlertService.showError('There is some error.');
} else {
oAlertService.showError(mapData.exception);
}
scope.$emit('serverMapDirective.hasNoData');
return false;
}
+29 -4
View File
@@ -133,12 +133,37 @@
<!-- ng-template -->
<script id="error" type="text/ng-template">
<div class="error" style="position:absolute;top:38%;width:90%;margin-left:5%;display:none;z-index:10">
<div class="error" style="position:absolute;top:10%;width:90%;margin-left:5%;display:none;z-index:10">
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4>Error!</h4>
<div class="msg"></div>
<h2>Error!</h2>
<h4 class="msg" style="color:red"></h4>
<button class="openDetail" onclick="jQuery('#detailErrorResult').toggle()">+</button>
<div class="detail" style="display:none" id="detailErrorResult">
<hr>
<table style="width:100%">
<tr>
<td style="padding-bottom:5px">Method</td>
<td class="method" style="padding:0px 0px 5px 20px;color:black"></td>
</tr>
<tr>
<td style="padding-bottom:5px">Header</td>
<td class="header" style="padding:0px 0px 5px 20px;color:black"></td>
</tr>
<tr>
<td style="padding-bottom:5px">Parameters</td>
<td class="parameters" style="padding:0px 0px 5px 20px;color:black"></td>
</tr>
<tr>
<td style="padding-bottom:5px">URL</td>
<td class="url" style="padding:0px 0px 5px 20px;color:black"></td>
</tr>
<tr>
<td style="padding-bottom:5px">Stacktrace</td>
<td style="padding:0px 0px 5px 20px;color:black"><textarea class="stacktrace" disabled style="width:100%;height:340px"></textarea></td>
</tr>
</table>
</div>
</div>
</div>
</script>