Skip to content

Commit

Permalink
Fix #340 and improve stack trace rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Aug 6, 2013
1 parent 8d4d68a commit 19fb7dc
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 4 deletions.
11 changes: 11 additions & 0 deletions hawtio-web/src/main/webapp/app/fabric/html/container.html
Expand Up @@ -151,6 +151,17 @@ <h1>{{row.id}}</h1>
</div>
</div>

<div ng-show="row.provisionExceptionArray" class="row-fluid">
<div class="span8">
<dl>
<dt>Provision Exception</dt>
<dd>
<div ng-bind-html-unsafe="formatStackTrace(row.provisionExceptionArray)"></div>
</dd>
</dl>
</div>
</div>

<div class="row-fluid">
<div class="span8">
<dl>
Expand Down
15 changes: 14 additions & 1 deletion hawtio-web/src/main/webapp/app/fabric/js/container.ts
Expand Up @@ -28,7 +28,6 @@ module Fabric {


$scope.connect = () => {
// TODO lets find these from somewhere! :)
if ($scope.saveCredentials) {
$scope.saveCredentials = false;
localStorage['fabric.userName'] = $scope.userName;
Expand Down Expand Up @@ -128,11 +127,25 @@ module Fabric {
}, onSuccess(render));
}

$scope.formatStackTrace = (exception) => {
if (!exception) {
return '';
}
var answer = '<ul class="unstyled">\n';
exception.each((line) => {
answer += "<li>" + Log.formatStackLine(line) + "</li>\n"
});
answer += "</ul>\n";
return answer;
}

function render(response) {
if (!Object.equal($scope.row, response.value)) {
$scope.row = response.value;
if ($scope.row) {
if ($scope.row.provisionException !== null) {
$scope.row.provisionExceptionArray = $scope.row.provisionException.lines();
}
$scope.services = getServiceList($scope.row);
if (angular.isDefined($scope.resolverWatch) && angular.isFunction($scope.resolverWatch)) {
$scope.resolverWatch();
Expand Down
3 changes: 2 additions & 1 deletion hawtio-web/src/main/webapp/app/log/html/logs.html
Expand Up @@ -53,7 +53,8 @@
<dl ng-hide="!row.exception">
<dt>Stack Trace:</dt>
<dd>
<ul ng-repeat="line in row.exception">
<ul class="unstyled" ng-repeat="line in row.exception">

<li class="stacktrace" ng-bind-html-unsafe="formatException(line)"></li>
</ul>
</dd>
Expand Down
4 changes: 2 additions & 2 deletions hawtio-web/src/main/webapp/app/log/js/helpers.ts
Expand Up @@ -51,10 +51,10 @@ module Log {
console.log("mvnCoords: " + mvnCoords);
console.log("Matched " + JSON.stringify(match));
*/
return "at <a href='" + link + "'>" + classAndMethod + "</a>(<span class='fileName'>" + fileName + "</span>:<span class='lineNumber'>" + line + "</span>)[<span class='mavenCoords'>" + mvnCoords + "</span>]";
return "<div class='stack-line'> at <a href='" + link + "'>" + classAndMethod + "</a>(<span class='fileName'>" + fileName + "</span>:<span class='lineNumber'>" + line + "</span>)[<span class='mavenCoords'>" + mvnCoords + "</span>]</div>";
}
}
return line;
return '<pre class="stack-line">' + line + '</pre>';
}

export function getLogCacheSize(localStorage) {
Expand Down
16 changes: 16 additions & 0 deletions hawtio-web/src/main/webapp/css/site-base.less
Expand Up @@ -1674,4 +1674,20 @@ input[type="checkbox"].ng-invalid {
border-bottom: 1px solid @control-border;
}

pre.stack-line {
padding: 0px;
margin: 0px;
background: inherit;
border: none;
border-radius: 0;
line-height: inherit;
font-size: 12px;
}

div.stack-line {
font-family: Monaco,Menlo,Consolas,"Courier New",monospace;
font-size: 12px;
white-space: pre-wrap;
word-break: break-all;
word-wrap: break-word;
}

0 comments on commit 19fb7dc

Please sign in to comment.