NO-JIRA Fix indention in browser.js
This commit is contained in:
parent
b733ea4c79
commit
a1266e63f9
|
@ -19,520 +19,497 @@
|
||||||
*/
|
*/
|
||||||
var ARTEMIS = (function(ARTEMIS) {
|
var ARTEMIS = (function(ARTEMIS) {
|
||||||
|
|
||||||
ARTEMIS.BrowseQueueController = function ($scope, workspace, ARTEMISService, jolokia, localStorage, artemisMessage, $location, $timeout) {
|
ARTEMIS.BrowseQueueController = function($scope, workspace, ARTEMISService, jolokia, localStorage, artemisMessage, $location, $timeout) {
|
||||||
|
|
||||||
var defaultAttributes = [
|
var defaultAttributes = [{
|
||||||
{
|
|
||||||
field: 'messageID',
|
field: 'messageID',
|
||||||
displayName: 'Message ID',
|
displayName: 'Message ID',
|
||||||
cellTemplate: '<div class="ngCellText"><a ng-click="openMessageDialog(row)">{{row.entity.messageID}}</a></div>',
|
cellTemplate: '<div class="ngCellText"><a ng-click="openMessageDialog(row)">{{row.entity.messageID}}</a></div>',
|
||||||
// for ng-grid
|
// for ng-grid
|
||||||
width: '10%'
|
width: '10%'
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
field: 'userID',
|
field: 'userID',
|
||||||
displayName: 'User ID',
|
displayName: 'User ID',
|
||||||
width: '10%'
|
width: '10%'
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
field: 'type',
|
field: 'type',
|
||||||
displayName: 'Type',
|
displayName: 'Type',
|
||||||
width: '10%'
|
width: '10%'
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
field: 'durable',
|
field: 'durable',
|
||||||
displayName: 'Durable',
|
displayName: 'Durable',
|
||||||
width: '10%'
|
width: '10%'
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
field: 'priority',
|
field: 'priority',
|
||||||
displayName: 'Priority',
|
displayName: 'Priority',
|
||||||
width: '7%'
|
width: '7%'
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
field: 'timestamp',
|
field: 'timestamp',
|
||||||
displayName: 'Timestamp',
|
displayName: 'Timestamp',
|
||||||
width: '19%'
|
width: '19%'
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
field: 'expiration',
|
field: 'expiration',
|
||||||
displayName: 'Expires',
|
displayName: 'Expires',
|
||||||
width: '10%'
|
width: '10%'
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
field: 'redelivered',
|
field: 'redelivered',
|
||||||
displayName: 'Redelivered',
|
displayName: 'Redelivered',
|
||||||
width: '10%'
|
width: '10%'
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
field: 'largeMessage',
|
field: 'largeMessage',
|
||||||
displayName: 'Large',
|
displayName: 'Large',
|
||||||
width: '10%'
|
width: '10%'
|
||||||
|
}];
|
||||||
|
var attributes = defaultAttributes;
|
||||||
|
if (sessionStorage.getItem('browseColumnDefs')) {
|
||||||
|
attributes = JSON.parse(sessionStorage.getItem('browseColumnDefs'));
|
||||||
}
|
}
|
||||||
];
|
$scope.$on('ngGridEventColumns', function(newColumns) {
|
||||||
var attributes = defaultAttributes;
|
ARTEMIS.log.debug('ngGridEventColumns:', newColumns);
|
||||||
if (sessionStorage.getItem('browseColumnDefs')) {
|
var visibles = newColumns.targetScope.columns.reduce(function(visibles, column) {
|
||||||
attributes = JSON.parse(sessionStorage.getItem('browseColumnDefs'));
|
visibles[column.field] = column.visible;
|
||||||
}
|
return visibles;
|
||||||
$scope.$on('ngGridEventColumns', function (newColumns) {
|
}, {});
|
||||||
ARTEMIS.log.debug('ngGridEventColumns:', newColumns);
|
ARTEMIS.log.debug('ngGridEventColumns: visibles =', visibles);
|
||||||
var visibles = newColumns.targetScope.columns.reduce(function (visibles, column) {
|
attributes.forEach(function(attribute) {
|
||||||
visibles[column.field] = column.visible;
|
attribute.visible = visibles[attribute.field];
|
||||||
return visibles;
|
});
|
||||||
}, {});
|
sessionStorage.setItem('browseColumnDefs', JSON.stringify(attributes));
|
||||||
ARTEMIS.log.debug('ngGridEventColumns: visibles =', visibles);
|
|
||||||
attributes.forEach(function (attribute) {
|
|
||||||
attribute.visible = visibles[attribute.field];
|
|
||||||
});
|
});
|
||||||
sessionStorage.setItem('browseColumnDefs', JSON.stringify(attributes));
|
$scope.pagingOptions = {
|
||||||
});
|
pageSizes: [50, 100, 200],
|
||||||
$scope.pagingOptions = {
|
pageSize: 100,
|
||||||
pageSizes: [50, 100, 200],
|
currentPage: 1
|
||||||
pageSize: 100,
|
};
|
||||||
currentPage: 1
|
$scope.totalServerItems = 0;
|
||||||
};
|
$scope.searchText = '';
|
||||||
$scope.totalServerItems = 0;
|
$scope.allMessages = [];
|
||||||
$scope.searchText = '';
|
$scope.messages = [];
|
||||||
$scope.allMessages = [];
|
$scope.headers = {};
|
||||||
$scope.messages = [];
|
$scope.mode = 'text';
|
||||||
$scope.headers = {};
|
$scope.deleteDialog = false;
|
||||||
$scope.mode = 'text';
|
$scope.moveDialog = false;
|
||||||
$scope.deleteDialog = false;
|
$scope.gridOptions = {
|
||||||
$scope.moveDialog = false;
|
pagingOptions: $scope.pagingOptions,
|
||||||
$scope.gridOptions = {
|
enablePaging: true,
|
||||||
pagingOptions: $scope.pagingOptions,
|
totalServerItems: 'totalServerItems',
|
||||||
enablePaging: true,
|
showFooter: true,
|
||||||
totalServerItems: 'totalServerItems',
|
selectedItems: [],
|
||||||
showFooter: true,
|
data: 'messages',
|
||||||
selectedItems: [],
|
displayFooter: false,
|
||||||
data: 'messages',
|
showFilter: false,
|
||||||
displayFooter: false,
|
showColumnMenu: true,
|
||||||
showFilter: false,
|
enableColumnResize: true,
|
||||||
showColumnMenu: true,
|
enableColumnReordering: true,
|
||||||
enableColumnResize: true,
|
enableHighlighting: true,
|
||||||
enableColumnReordering: true,
|
filterOptions: {
|
||||||
enableHighlighting: true,
|
filterText: '',
|
||||||
filterOptions: {
|
useExternalFilter: true
|
||||||
filterText: '',
|
},
|
||||||
useExternalFilter: true
|
selectWithCheckboxOnly: true,
|
||||||
},
|
showSelectionCheckbox: true,
|
||||||
selectWithCheckboxOnly: true,
|
maintainColumnRatios: false,
|
||||||
showSelectionCheckbox: true,
|
columnDefs: attributes,
|
||||||
maintainColumnRatios: false,
|
afterSelectionChange: afterSelectionChange
|
||||||
columnDefs: attributes,
|
};
|
||||||
afterSelectionChange: afterSelectionChange
|
$scope.showMessageDetails = false;
|
||||||
};
|
var ignoreColumns = ["PropertiesText", "BodyPreview", "text"];
|
||||||
$scope.showMessageDetails = false;
|
var flattenColumns = ["BooleanProperties", "ByteProperties", "ShortProperties", "IntProperties", "LongProperties", "FloatProperties", "DoubleProperties", "StringProperties"];
|
||||||
var ignoreColumns = ["PropertiesText", "BodyPreview", "text"];
|
$scope.$watch('workspace.selection', function() {
|
||||||
var flattenColumns = ["BooleanProperties", "ByteProperties", "ShortProperties", "IntProperties", "LongProperties", "FloatProperties", "DoubleProperties", "StringProperties"];
|
if (workspace.moveIfViewInvalid()) {
|
||||||
$scope.$watch('workspace.selection', function () {
|
return;
|
||||||
if (workspace.moveIfViewInvalid()) {
|
}
|
||||||
return;
|
// lets defer execution as we may not have the selection just yet
|
||||||
}
|
setTimeout(loadTable, 50);
|
||||||
// lets defer execution as we may not have the selection just yet
|
});
|
||||||
setTimeout(loadTable, 50);
|
$scope.$watch('gridOptions.filterOptions.filterText', function(filterText) {
|
||||||
});
|
filterMessages(filterText);
|
||||||
$scope.$watch('gridOptions.filterOptions.filterText', function (filterText) {
|
});
|
||||||
filterMessages(filterText);
|
$scope.$watch('pagingOptions', function(newVal, oldVal) {
|
||||||
});
|
if (parseInt(newVal.currentPage) && newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
|
||||||
$scope.$watch('pagingOptions', function (newVal, oldVal) {
|
loadTable();
|
||||||
if (parseInt(newVal.currentPage) && newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
|
}
|
||||||
loadTable();
|
if (parseInt(newVal.pageSize) && newVal !== oldVal && newVal.pageSize !== oldVal.pageSize) {
|
||||||
}
|
$scope.pagingOptions.currentPage = 1;
|
||||||
if (parseInt(newVal.pageSize) && newVal !== oldVal && newVal.pageSize !== oldVal.pageSize) {
|
loadTable();
|
||||||
$scope.pagingOptions.currentPage = 1;
|
}
|
||||||
loadTable();
|
}, true);
|
||||||
}
|
$scope.openMessageDialog = function(message) {
|
||||||
}, true);
|
ARTEMIS.selectCurrentMessage(message, "messageID", $scope);
|
||||||
$scope.openMessageDialog = function (message) {
|
if ($scope.row) {
|
||||||
ARTEMIS.selectCurrentMessage(message, "messageID", $scope);
|
$scope.mode = CodeEditor.detectTextFormat($scope.row.Text);
|
||||||
if ($scope.row) {
|
$scope.showMessageDetails = true;
|
||||||
$scope.mode = CodeEditor.detectTextFormat($scope.row.Text);
|
}
|
||||||
$scope.showMessageDetails = true;
|
};
|
||||||
}
|
$scope.refresh = loadTable;
|
||||||
};
|
ARTEMIS.decorate($scope);
|
||||||
$scope.refresh = loadTable;
|
$scope.moveMessages = function() {
|
||||||
ARTEMIS.decorate($scope);
|
var selection = workspace.selection;
|
||||||
$scope.moveMessages = function () {
|
var mbean = selection.objectName;
|
||||||
var selection = workspace.selection;
|
if (mbean && selection) {
|
||||||
var mbean = selection.objectName;
|
var selectedItems = $scope.gridOptions.selectedItems;
|
||||||
if (mbean && selection) {
|
$scope.message = "Moved " + Core.maybePlural(selectedItems.length, "message" + " to " + $scope.queueName);
|
||||||
var selectedItems = $scope.gridOptions.selectedItems;
|
angular.forEach(selectedItems, function(item, idx) {
|
||||||
$scope.message = "Moved " + Core.maybePlural(selectedItems.length, "message" + " to " + $scope.queueName);
|
var id = item.messageID;
|
||||||
angular.forEach(selectedItems, function (item, idx) {
|
if (id) {
|
||||||
var id = item.messageID;
|
var callback = (idx + 1 < selectedItems.length) ? intermediateResult : moveSuccess;
|
||||||
if (id) {
|
ARTEMISService.artemisConsole.moveMessage(mbean, jolokia, id, $scope.queueName, onSuccess(callback));
|
||||||
var callback = (idx + 1 < selectedItems.length) ? intermediateResult : moveSuccess;
|
}
|
||||||
ARTEMISService.artemisConsole.moveMessage(mbean, jolokia, id, $scope.queueName, onSuccess(callback));
|
});
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
$scope.resendMessage = function() {
|
||||||
};
|
var selection = workspace.selection;
|
||||||
$scope.resendMessage = function () {
|
var mbean = selection.objectName;
|
||||||
var selection = workspace.selection;
|
if (mbean && selection) {
|
||||||
var mbean = selection.objectName;
|
var selectedItems = $scope.gridOptions.selectedItems;
|
||||||
if (mbean && selection) {
|
// always assume a single message
|
||||||
var selectedItems = $scope.gridOptions.selectedItems;
|
artemisMessage.message = selectedItems[0];
|
||||||
//always assume a single message
|
$location.path('artemis/sendMessage');
|
||||||
artemisMessage.message = selectedItems[0];
|
}
|
||||||
$location.path('artemis/sendMessage');
|
};
|
||||||
}
|
$scope.deleteMessages = function() {
|
||||||
};
|
var selection = workspace.selection;
|
||||||
$scope.deleteMessages = function () {
|
var mbean = selection.objectName;
|
||||||
var selection = workspace.selection;
|
if (mbean && selection) {
|
||||||
var mbean = selection.objectName;
|
var selectedItems = $scope.gridOptions.selectedItems;
|
||||||
if (mbean && selection) {
|
$scope.message = "Deleted " + Core.maybePlural(selectedItems.length, "message");
|
||||||
var selectedItems = $scope.gridOptions.selectedItems;
|
angular.forEach(selectedItems, function(item, idx) {
|
||||||
$scope.message = "Deleted " + Core.maybePlural(selectedItems.length, "message");
|
var id = item.messageID;
|
||||||
angular.forEach(selectedItems, function (item, idx) {
|
if (id) {
|
||||||
var id = item.messageID;
|
var callback = (idx + 1 < selectedItems.length) ? intermediateResult : operationSuccess;
|
||||||
if (id) {
|
ARTEMISService.artemisConsole.deleteMessage(mbean, jolokia, id, onSuccess(callback));
|
||||||
var callback = (idx + 1 < selectedItems.length) ? intermediateResult : operationSuccess;
|
}
|
||||||
ARTEMISService.artemisConsole.deleteMessage(mbean, jolokia, id, onSuccess(callback));
|
});
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
$scope.retryMessages = function() {
|
||||||
};
|
var selection = workspace.selection;
|
||||||
$scope.retryMessages = function () {
|
var mbean = selection.objectName;
|
||||||
var selection = workspace.selection;
|
if (mbean && selection) {
|
||||||
var mbean = selection.objectName;
|
var selectedItems = $scope.gridOptions.selectedItems;
|
||||||
if (mbean && selection) {
|
$scope.message = "Retry " + Core.maybePlural(selectedItems.length, "message");
|
||||||
var selectedItems = $scope.gridOptions.selectedItems;
|
angular.forEach(selectedItems, function(item, idx) {
|
||||||
$scope.message = "Retry " + Core.maybePlural(selectedItems.length, "message");
|
var id = item.messageID;
|
||||||
angular.forEach(selectedItems, function (item, idx) {
|
if (id) {
|
||||||
var id = item.messageID;
|
var callback = (idx + 1 < selectedItems.length) ? intermediateResult : operationSuccess;
|
||||||
if (id) {
|
ARTEMISService.artemisConsole.retryMessage(mbean, jolokia, id, onSuccess(callback));
|
||||||
var callback = (idx + 1 < selectedItems.length) ? intermediateResult : operationSuccess;
|
}
|
||||||
ARTEMISService.artemisConsole.retryMessage(mbean, jolokia, id, onSuccess(callback));
|
});
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
$scope.queueNames = function(completionText) {
|
||||||
};
|
var queuesFolder = ARTEMIS.getSelectionQueuesFolder(workspace);
|
||||||
$scope.queueNames = function (completionText) {
|
if (queuesFolder) {
|
||||||
var queuesFolder = ARTEMIS.getSelectionQueuesFolder(workspace);
|
var selectedQueue = workspace.selection.key;
|
||||||
if (queuesFolder) {
|
var otherQueues = queuesFolder.children.exclude(function(child) {
|
||||||
var selectedQueue = workspace.selection.key;
|
return child.key == selectedQueue;
|
||||||
var otherQueues = queuesFolder.children.exclude(function (child) {
|
});
|
||||||
return child.key == selectedQueue;
|
return (otherQueues) ? otherQueues.map(function(n) {
|
||||||
});
|
return n.title;
|
||||||
return (otherQueues) ? otherQueues.map(function (n) {
|
}) : [];
|
||||||
return n.title;
|
} else {
|
||||||
}) : [];
|
return [];
|
||||||
}
|
}
|
||||||
else {
|
};
|
||||||
return [];
|
function populateTable(response) {
|
||||||
}
|
var data = response.value;
|
||||||
};
|
ARTEMIS.log.info("loading data:" + data);
|
||||||
function populateTable(response) {
|
|
||||||
var data = response.value;
|
|
||||||
ARTEMIS.log.info("loading data:" + data);
|
|
||||||
|
|
||||||
if (!angular.isArray(data)) {
|
if (!angular.isArray(data)) {
|
||||||
$scope.allMessages = [];
|
$scope.allMessages = [];
|
||||||
angular.forEach(data, function (value, idx) {
|
angular.forEach(data, function(value, idx) {
|
||||||
$scope.allMessages.push(value);
|
$scope.allMessages.push(value);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
$scope.allMessages = data;
|
||||||
$scope.allMessages = data;
|
}
|
||||||
}
|
angular.forEach($scope.allMessages, function(message) {
|
||||||
angular.forEach($scope.allMessages, function (message) {
|
message.headerHtml = createHeaderHtml(message);
|
||||||
message.headerHtml = createHeaderHtml(message);
|
message.bodyText = createBodyText(message);
|
||||||
message.bodyText = createBodyText(message);
|
});
|
||||||
});
|
filterMessages($scope.gridOptions.filterOptions.filterText);
|
||||||
filterMessages($scope.gridOptions.filterOptions.filterText);
|
Core.$apply($scope);
|
||||||
Core.$apply($scope);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For some reason using ng-repeat in the modal dialog doesn't work so lets
|
* For some reason using ng-repeat in the modal dialog doesn't work so lets
|
||||||
* just create the HTML in code :)
|
* just create the HTML in code :)
|
||||||
*/
|
*/
|
||||||
function createBodyText(message) {
|
function createBodyText(message) {
|
||||||
|
|
||||||
ARTEMIS.log.info("loading message:" + message);
|
ARTEMIS.log.info("loading message:" + message);
|
||||||
if (message.text) {
|
if (message.text) {
|
||||||
var body = message.text;
|
var body = message.text;
|
||||||
var lenTxt = "" + body.length;
|
var lenTxt = "" + body.length;
|
||||||
message.textMode = "text (" + lenTxt + " chars)";
|
message.textMode = "text (" + lenTxt + " chars)";
|
||||||
return body;
|
return body;
|
||||||
}
|
} else if (message.BodyPreview) {
|
||||||
else if (message.BodyPreview) {
|
var code = Core.parseIntValue(localStorage["ARTEMISBrowseBytesMessages"] || "1", "browse bytes messages");
|
||||||
var code = Core.parseIntValue(localStorage["ARTEMISBrowseBytesMessages"] || "1", "browse bytes messages");
|
var body;
|
||||||
var body;
|
message.textMode = "bytes (turned off)";
|
||||||
message.textMode = "bytes (turned off)";
|
if (code != 99) {
|
||||||
if (code != 99) {
|
var bytesArr = [];
|
||||||
var bytesArr = [];
|
var textArr = [];
|
||||||
var textArr = [];
|
message.BodyPreview.forEach(function(b) {
|
||||||
message.BodyPreview.forEach(function (b) {
|
if (code === 1 || code === 2) {
|
||||||
if (code === 1 || code === 2) {
|
// text
|
||||||
// text
|
textArr.push(String.fromCharCode(b));
|
||||||
textArr.push(String.fromCharCode(b));
|
}
|
||||||
}
|
if (code === 1 || code === 4) {
|
||||||
if (code === 1 || code === 4) {
|
// hex and must be 2 digit so they space out evenly
|
||||||
// hex and must be 2 digit so they space out evenly
|
var s = b.toString(16);
|
||||||
var s = b.toString(16);
|
if (s.length === 1) {
|
||||||
if (s.length === 1) {
|
s = "0" + s;
|
||||||
s = "0" + s;
|
}
|
||||||
}
|
bytesArr.push(s);
|
||||||
bytesArr.push(s);
|
} else {
|
||||||
}
|
// just show as is without spacing out, as that is usually more used for hex than decimal
|
||||||
else {
|
var s = b.toString(10);
|
||||||
// just show as is without spacing out, as that is usually more used for hex than decimal
|
bytesArr.push(s);
|
||||||
var s = b.toString(10);
|
}
|
||||||
bytesArr.push(s);
|
});
|
||||||
}
|
var bytesData = bytesArr.join(" ");
|
||||||
});
|
var textData = textArr.join("");
|
||||||
var bytesData = bytesArr.join(" ");
|
if (code === 1 || code === 2) {
|
||||||
var textData = textArr.join("");
|
// bytes and text
|
||||||
if (code === 1 || code === 2) {
|
var len = message.BodyPreview.length;
|
||||||
// bytes and text
|
var lenTxt = "" + textArr.length;
|
||||||
var len = message.BodyPreview.length;
|
body = "bytes:\n" + bytesData + "\n\ntext:\n" + textData;
|
||||||
var lenTxt = "" + textArr.length;
|
message.textMode = "bytes (" + len + " bytes) and text (" + lenTxt + " chars)";
|
||||||
body = "bytes:\n" + bytesData + "\n\ntext:\n" + textData;
|
} else {
|
||||||
message.textMode = "bytes (" + len + " bytes) and text (" + lenTxt + " chars)";
|
// bytes only
|
||||||
}
|
var len = message.BodyPreview.length;
|
||||||
else {
|
body = bytesData;
|
||||||
// bytes only
|
message.textMode = "bytes (" + len + " bytes)";
|
||||||
var len = message.BodyPreview.length;
|
}
|
||||||
body = bytesData;
|
}
|
||||||
message.textMode = "bytes (" + len + " bytes)";
|
return body;
|
||||||
}
|
} else {
|
||||||
}
|
message.textMode = "unsupported";
|
||||||
return body;
|
return "Unsupported message body type which cannot be displayed by hawtio";
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
message.textMode = "unsupported";
|
|
||||||
return "Unsupported message body type which cannot be displayed by hawtio";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For some reason using ng-repeat in the modal dialog doesn't work so lets
|
* For some reason using ng-repeat in the modal dialog doesn't work so lets
|
||||||
* just create the HTML in code :)
|
* just create the HTML in code :)
|
||||||
*/
|
*/
|
||||||
function createHeaderHtml(message) {
|
function createHeaderHtml(message) {
|
||||||
var headers = createHeaders(message);
|
var headers = createHeaders(message);
|
||||||
var properties = createProperties(message);
|
var properties = createProperties(message);
|
||||||
var headerKeys = Object.extended(headers).keys();
|
var headerKeys = Object.extended(headers).keys();
|
||||||
|
|
||||||
function sort(a, b) {
|
function sort(a, b) {
|
||||||
if (a > b)
|
if (a > b)
|
||||||
return 1;
|
return 1;
|
||||||
if (a < b)
|
if (a < b)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var propertiesKeys = Object.extended(properties).keys().sort(sort);
|
var propertiesKeys = Object.extended(properties).keys().sort(sort);
|
||||||
var jmsHeaders = headerKeys.filter(function (key) {
|
var jmsHeaders = headerKeys.filter(function(key) {
|
||||||
return key.startsWith("JMS");
|
return key.startsWith("JMS");
|
||||||
}).sort(sort);
|
}).sort(sort);
|
||||||
var remaining = headerKeys.subtract(jmsHeaders, propertiesKeys).sort(sort);
|
var remaining = headerKeys.subtract(jmsHeaders, propertiesKeys).sort(sort);
|
||||||
var buffer = [];
|
var buffer = [];
|
||||||
|
|
||||||
function appendHeader(key) {
|
function appendHeader(key) {
|
||||||
var value = headers[key];
|
var value = headers[key];
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
value = '';
|
value = '';
|
||||||
}
|
}
|
||||||
buffer.push('<tr><td class="propertyName"><span class="green">Header</span> - ' + key + '</td><td class="property-value">' + value + '</td></tr>');
|
buffer.push('<tr><td class="propertyName"><span class="green">Header</span> - ' + key + '</td><td class="property-value">' + value + '</td></tr>');
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendProperty(key) {
|
function appendProperty(key) {
|
||||||
var value = properties[key];
|
var value = properties[key];
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
value = '';
|
value = '';
|
||||||
}
|
}
|
||||||
buffer.push('<tr><td class="propertyName">' + key + '</td><td class="property-value">' + value + '</td></tr>');
|
buffer.push('<tr><td class="propertyName">' + key + '</td><td class="property-value">' + value + '</td></tr>');
|
||||||
}
|
}
|
||||||
|
|
||||||
jmsHeaders.forEach(appendHeader);
|
jmsHeaders.forEach(appendHeader);
|
||||||
remaining.forEach(appendHeader);
|
remaining.forEach(appendHeader);
|
||||||
propertiesKeys.forEach(appendProperty);
|
propertiesKeys.forEach(appendProperty);
|
||||||
return buffer.join("\n");
|
return buffer.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function createHeaders(row) {
|
function createHeaders(row) {
|
||||||
var answer = {};
|
var answer = {};
|
||||||
angular.forEach(row, function (value, key) {
|
angular.forEach(row, function(value, key) {
|
||||||
if (!ignoreColumns.any(key) && !flattenColumns.any(key)) {
|
if (!ignoreColumns.any(key) && !flattenColumns.any(key)) {
|
||||||
answer[Core.escapeHtml(key)] = Core.escapeHtml(value);
|
answer[Core.escapeHtml(key)] = Core.escapeHtml(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createProperties(row) {
|
function createProperties(row) {
|
||||||
ARTEMIS.log.debug("properties: ", row);
|
ARTEMIS.log.debug("properties: ", row);
|
||||||
var answer = {};
|
var answer = {};
|
||||||
angular.forEach(row, function (value, key) {
|
angular.forEach(row, function(value, key) {
|
||||||
if (!ignoreColumns.any(key) && flattenColumns.any(key)) {
|
if (!ignoreColumns.any(key) && flattenColumns.any(key)) {
|
||||||
angular.forEach(value, function (v2, k2) {
|
angular.forEach(value, function(v2, k2) {
|
||||||
answer['<span class="green">' + key.replace('Properties', ' Property') + '</span> - ' + Core.escapeHtml(k2)] = Core.escapeHtml(v2);
|
answer['<span class="green">' + key.replace('Properties', ' Property') + '</span> - ' + Core.escapeHtml(k2)] = Core.escapeHtml(v2);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadTable() {
|
function loadTable() {
|
||||||
ARTEMIS.log.info("loading table")
|
ARTEMIS.log.info("loading table")
|
||||||
var objName;
|
var objName;
|
||||||
$scope.gridOptions.selectedItems.length = 0;
|
$scope.gridOptions.selectedItems.length = 0;
|
||||||
if (workspace.selection) {
|
if (workspace.selection) {
|
||||||
objName = workspace.selection.objectName;
|
objName = workspace.selection.objectName;
|
||||||
}
|
} else {
|
||||||
else {
|
// in case of refresh
|
||||||
// in case of refresh
|
var key = location.search()['nid'];
|
||||||
var key = location.search()['nid'];
|
var node = workspace.keyToNodeMap[key];
|
||||||
var node = workspace.keyToNodeMap[key];
|
objName = node.objectName;
|
||||||
objName = node.objectName;
|
}
|
||||||
}
|
if (objName) {
|
||||||
if (objName) {
|
$scope.dlq = false;
|
||||||
$scope.dlq = false;
|
var queueName = jolokia.getAttribute(objName, "Name");
|
||||||
var queueName = jolokia.getAttribute(objName, "Name");
|
|
||||||
|
|
||||||
var artemisDLQ = localStorage['artemisDLQ'] || "DLQ";
|
var artemisDLQ = localStorage['artemisDLQ'] || "DLQ";
|
||||||
var artemisExpiryQueue = localStorage['artemisExpiryQueue'] || "ExpiryQueue";
|
var artemisExpiryQueue = localStorage['artemisExpiryQueue'] || "ExpiryQueue";
|
||||||
ARTEMIS.log.info("loading table" + artemisExpiryQueue);
|
ARTEMIS.log.info("loading table" + artemisExpiryQueue);
|
||||||
if (queueName == artemisDLQ || queueName == artemisExpiryQueue) {
|
if (queueName == artemisDLQ || queueName == artemisExpiryQueue) {
|
||||||
onDlq(true);
|
onDlq(true);
|
||||||
}
|
} else {
|
||||||
else {
|
onDlq(false);
|
||||||
onDlq(false);
|
}
|
||||||
}
|
jolokia.request({ type: 'exec', mbean: objName, operation: 'countMessages()'}, onSuccess(function(response) {$scope.totalServerItems = response.value;}));
|
||||||
jolokia.request({ type: 'exec', mbean: objName, operation: 'countMessages()'}, onSuccess(function(response) {$scope.totalServerItems = response.value;}));
|
jolokia.request({ type: 'exec', mbean: objName, operation: 'browse(int, int)', arguments: [$scope.pagingOptions.currentPage, $scope.pagingOptions.pageSize] }, onSuccess(populateTable));
|
||||||
jolokia.request({ type: 'exec', mbean: objName, operation: 'browse(int, int)', arguments: [$scope.pagingOptions.currentPage, $scope.pagingOptions.pageSize] }, onSuccess(populateTable));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function onDlq(response) {
|
function onDlq(response) {
|
||||||
ARTEMIS.log.info("onDLQ=" + response);
|
ARTEMIS.log.info("onDLQ=" + response);
|
||||||
$scope.dlq = response;
|
$scope.dlq = response;
|
||||||
Core.$apply($scope);
|
Core.$apply($scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
function intermediateResult() {
|
function intermediateResult() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function operationSuccess() {
|
function operationSuccess() {
|
||||||
$scope.messageDialog = false;
|
$scope.messageDialog = false;
|
||||||
deselectAll();
|
deselectAll();
|
||||||
Core.notification("success", $scope.message);
|
Core.notification("success", $scope.message);
|
||||||
loadTable();
|
loadTable();
|
||||||
setTimeout(loadTable, 50);
|
setTimeout(loadTable, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveSuccess() {
|
function moveSuccess() {
|
||||||
operationSuccess();
|
operationSuccess();
|
||||||
workspace.loadTree();
|
workspace.loadTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterMessages(filter) {
|
function filterMessages(filter) {
|
||||||
var searchConditions = buildSearchConditions(filter);
|
var searchConditions = buildSearchConditions(filter);
|
||||||
evalFilter(searchConditions);
|
evalFilter(searchConditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
function evalFilter(searchConditions) {
|
function evalFilter(searchConditions) {
|
||||||
if (!searchConditions || searchConditions.length === 0) {
|
if (!searchConditions || searchConditions.length === 0) {
|
||||||
$scope.messages = $scope.allMessages;
|
$scope.messages = $scope.allMessages;
|
||||||
}
|
} else {
|
||||||
else {
|
ARTEMIS.log.debug("Filtering conditions:", searchConditions);
|
||||||
ARTEMIS.log.debug("Filtering conditions:", searchConditions);
|
$scope.messages = $scope.allMessages.filter(function(message) {
|
||||||
$scope.messages = $scope.allMessages.filter(function (message) {
|
ARTEMIS.log.debug("Message:", message);
|
||||||
ARTEMIS.log.debug("Message:", message);
|
var matched = true;
|
||||||
var matched = true;
|
$.each(searchConditions, function(index, condition) {
|
||||||
$.each(searchConditions, function (index, condition) {
|
if (!condition.column) {
|
||||||
if (!condition.column) {
|
matched = matched && evalMessage(message, condition.regex);
|
||||||
matched = matched && evalMessage(message, condition.regex);
|
} else {
|
||||||
}
|
matched = matched && (message[condition.column] && condition.regex.test(message[condition.column])) || (message.StringProperties && message.StringProperties[condition.column] && condition.regex.test(message.StringProperties[condition.column]));
|
||||||
else {
|
}
|
||||||
matched = matched && (message[condition.column] && condition.regex.test(message[condition.column])) || (message.StringProperties && message.StringProperties[condition.column] && condition.regex.test(message.StringProperties[condition.column]));
|
});
|
||||||
}
|
return matched;
|
||||||
});
|
});
|
||||||
return matched;
|
}
|
||||||
});
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function evalMessage(message, regex) {
|
function evalMessage(message, regex) {
|
||||||
var jmsHeaders = ['JMSDestination', 'JMSDeliveryMode', 'JMSExpiration', 'JMSPriority', 'JMSmessageID', 'JMSTimestamp', 'JMSCorrelationID', 'JMSReplyTo', 'JMSType', 'JMSRedelivered'];
|
var jmsHeaders = ['JMSDestination', 'JMSDeliveryMode', 'JMSExpiration', 'JMSPriority', 'JMSmessageID', 'JMSTimestamp', 'JMSCorrelationID', 'JMSReplyTo', 'JMSType', 'JMSRedelivered'];
|
||||||
for (var i = 0; i < jmsHeaders.length; i++) {
|
for (var i = 0; i < jmsHeaders.length; i++) {
|
||||||
var header = jmsHeaders[i];
|
var header = jmsHeaders[i];
|
||||||
if (message[header] && regex.test(message[header])) {
|
if (message[header] && regex.test(message[header])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (message.StringProperties) {
|
if (message.StringProperties) {
|
||||||
for (var property in message.StringProperties) {
|
for ( var property in message.StringProperties) {
|
||||||
if (regex.test(message.StringProperties[property])) {
|
if (regex.test(message.StringProperties[property])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (message.bodyText && regex.test(message.bodyText)) {
|
if (message.bodyText && regex.test(message.bodyText)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRegExp(str, modifiers) {
|
function getRegExp(str, modifiers) {
|
||||||
try {
|
try {
|
||||||
return new RegExp(str, modifiers);
|
return new RegExp(str, modifiers);
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
return new RegExp(str.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\\|\||\.|\*|\+|\?)/g, '\\$1'));
|
||||||
return new RegExp(str.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\\|\||\.|\*|\+|\?)/g, '\\$1'));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function buildSearchConditions(filterText) {
|
function buildSearchConditions(filterText) {
|
||||||
var searchConditions = [];
|
var searchConditions = [];
|
||||||
var qStr;
|
var qStr;
|
||||||
if (!(qStr = $.trim(filterText))) {
|
if (!(qStr = $.trim(filterText))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var columnFilters = qStr.split(";");
|
var columnFilters = qStr.split(";");
|
||||||
for (var i = 0; i < columnFilters.length; i++) {
|
for (var i = 0; i < columnFilters.length; i++) {
|
||||||
var args = columnFilters[i].split(':');
|
var args = columnFilters[i].split(':');
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
var columnName = $.trim(args[0]);
|
var columnName = $.trim(args[0]);
|
||||||
var columnValue = $.trim(args[1]);
|
var columnValue = $.trim(args[1]);
|
||||||
if (columnName && columnValue) {
|
if (columnName && columnValue) {
|
||||||
searchConditions.push({
|
searchConditions.push({
|
||||||
column: columnName,
|
column: columnName,
|
||||||
columnDisplay: columnName.replace(/\s+/g, '').toLowerCase(),
|
columnDisplay: columnName.replace(/\s+/g, '').toLowerCase(),
|
||||||
regex: getRegExp(columnValue, 'i')
|
regex: getRegExp(columnValue, 'i')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
var val = $.trim(args[0]);
|
||||||
var val = $.trim(args[0]);
|
if (val) {
|
||||||
if (val) {
|
searchConditions.push({
|
||||||
searchConditions.push({
|
column: '',
|
||||||
column: '',
|
regex: getRegExp(val, 'i')
|
||||||
regex: getRegExp(val, 'i')
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return searchConditions;
|
||||||
return searchConditions;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function afterSelectionChange(rowItem, checkAll) {
|
function afterSelectionChange(rowItem, checkAll) {
|
||||||
if (checkAll === void 0) {
|
if (checkAll === void 0) {
|
||||||
// then row was clicked, not select-all checkbox
|
// then row was clicked, not select-all checkbox
|
||||||
$scope.gridOptions['$gridScope'].allSelected = rowItem.config.selectedItems.length == $scope.messages.length;
|
$scope.gridOptions['$gridScope'].allSelected = rowItem.config.selectedItems.length == $scope.messages.length;
|
||||||
}
|
} else {
|
||||||
else {
|
$scope.gridOptions['$gridScope'].allSelected = checkAll;
|
||||||
$scope.gridOptions['$gridScope'].allSelected = checkAll;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function deselectAll() {
|
function deselectAll() {
|
||||||
$scope.gridOptions['$gridScope'].allSelected = false;
|
$scope.gridOptions['$gridScope'].allSelected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ARTEMIS;
|
return ARTEMIS;
|
||||||
} (ARTEMIS || {}));
|
}(ARTEMIS || {}));
|
||||||
|
|
Loading…
Reference in New Issue