Skip to content

Commit

Permalink
Bit of work on #613, sort the JMX headers first alphabetically misc p…
Browse files Browse the repository at this point in the history
…roperties at the end of the list. Also fix #696.
  • Loading branch information
gashcrumb committed Oct 31, 2013
1 parent ada4c74 commit 5ffccc8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
8 changes: 6 additions & 2 deletions hawtio-web/src/main/webapp/app/activemq/html/browseQueue.html
Expand Up @@ -40,7 +40,11 @@
<div class="pull-right">
<form class="form-horizontal no-bottom-margin">

<div class="btn-group" hawtio-pager="messages" on-index-change="selectRowIndex" row-index="rowIndex"></div>
<div class="btn-group"
style="margin-top: 9px;"
hawtio-pager="messages"
on-index-change="selectRowIndex"
row-index="rowIndex"></div>

<button class="btn" ng-disabled="!gridOptions.selectedItems.length" ng-click="moveDialog = true"
title="Move the selected messages to another destination" data-placement="bottom">
Expand All @@ -64,7 +68,7 @@
<div class="row-fluid">
<div class="expandable closed">
<div title="Headers" class="title">
<i class="expandable-indicator"></i> Headers
<i class="expandable-indicator"></i> Headers & Properties
</div>
<div class="expandable-body well">
<table class="table table-condensed table-striped">
Expand Down
42 changes: 36 additions & 6 deletions hawtio-web/src/main/webapp/app/activemq/js/browse.ts
Expand Up @@ -183,15 +183,45 @@ module ActiveMQ {
*/
function createHeaderHtml(message) {
var headers = createHeaders(message);
var buffer = "";
angular.forEach(headers, (value, key) => {
buffer += "<tr><td class='property-name'>" + key + "</td>" +
"<td class='property-value'>" + value + "</td></tr>";
});
return buffer;

var keys = Object.extended(headers).keys();

function sort(a, b) {
if (a > b) return 1;
if (a < b) return -1;
return 0;
}

var jmsHeaders = keys.filter((key) => {
return key.startsWith("JMS");
}).sort(sort);

var remaining = keys.subtract(jmsHeaders).sort(sort);

var buffer = [];

function append(key) {

var value = headers[key];
if (value === null) {
value = '';
}

buffer.push('<tr><td class="propertyName">' +
key +
'</td><td class="property-value">' +
value +
'</td></tr>');
}

jmsHeaders.forEach(append);
remaining.forEach(append);

return buffer.join("\n");
}

function createHeaders(row) {
log.debug("headers: ", row);
var answer = {};
angular.forEach(row, (value, key) => {
if (!ignoreColumns.any(key)) {
Expand Down

0 comments on commit 5ffccc8

Please sign in to comment.