Skip to content

Commit

Permalink
#618: Added safeNull helper to avoid printing null for values in JMX …
Browse files Browse the repository at this point in the history
…tables which dont look nice.
  • Loading branch information
davsclaus committed Oct 18, 2013
1 parent ada916a commit 6913d38
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions hawtio-web/src/main/webapp/app/core/js/helpers.ts
Expand Up @@ -66,6 +66,14 @@ function humanizeValue(value:any):string {
return value;
}

function safeNull(value:any):string {
if (value) {
return value;
} else {
return "";
}
}

function trimQuotes(text:string) {
while (text.endsWith('"') || text.endsWith("'")) {
text = text.substring(0, text.length - 1);
Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/jmx/js/attribute.ts
Expand Up @@ -15,7 +15,7 @@ module Jmx {

function render(response) {
if (!Object.equal($scope.data, response.value)) {
$scope.data = response.value;
$scope.data = safeNull(response.value);
Core.$apply($scope);
}
}
Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/jmx/js/attributes.ts
Expand Up @@ -332,7 +332,7 @@ module Jmx {
if (angular.isArray(value)) {
value = value.map((v) => { return unwrapObjectName(v); });
}
var data = {key: key, name: humanizeValue(key), value: value};
var data = {key: key, name: humanizeValue(key), value: safeNull(value)};

generateSummaryAndDetail(data);
properties.push(data);
Expand Down

0 comments on commit 6913d38

Please sign in to comment.