NO-JIRA Fix indention in browser.js

This commit is contained in:
Sebastian Thomschke 2019-11-06 13:50:33 +01:00 committed by GitHub
parent b733ea4c79
commit a1266e63f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 437 additions and 460 deletions

View File

@ -21,55 +21,45 @@ 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; var attributes = defaultAttributes;
if (sessionStorage.getItem('browseColumnDefs')) { if (sessionStorage.getItem('browseColumnDefs')) {
attributes = JSON.parse(sessionStorage.getItem('browseColumnDefs')); attributes = JSON.parse(sessionStorage.getItem('browseColumnDefs'));
@ -218,8 +208,7 @@ var ARTEMIS = (function(ARTEMIS) {
return (otherQueues) ? otherQueues.map(function(n) { return (otherQueues) ? otherQueues.map(function(n) {
return n.title; return n.title;
}) : []; }) : [];
} } else {
else {
return []; return [];
} }
}; };
@ -232,8 +221,7 @@ var ARTEMIS = (function(ARTEMIS) {
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) {
@ -256,8 +244,7 @@ var ARTEMIS = (function(ARTEMIS) {
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)";
@ -276,8 +263,7 @@ var ARTEMIS = (function(ARTEMIS) {
s = "0" + s; s = "0" + s;
} }
bytesArr.push(s); bytesArr.push(s);
} } else {
else {
// just show as is without spacing out, as that is usually more used for hex than decimal // just show as is without spacing out, as that is usually more used for hex than decimal
var s = b.toString(10); var s = b.toString(10);
bytesArr.push(s); bytesArr.push(s);
@ -291,8 +277,7 @@ var ARTEMIS = (function(ARTEMIS) {
var lenTxt = "" + textArr.length; var lenTxt = "" + textArr.length;
body = "bytes:\n" + bytesData + "\n\ntext:\n" + textData; body = "bytes:\n" + bytesData + "\n\ntext:\n" + textData;
message.textMode = "bytes (" + len + " bytes) and text (" + lenTxt + " chars)"; message.textMode = "bytes (" + len + " bytes) and text (" + lenTxt + " chars)";
} } else {
else {
// bytes only // bytes only
var len = message.BodyPreview.length; var len = message.BodyPreview.length;
body = bytesData; body = bytesData;
@ -300,8 +285,7 @@ var ARTEMIS = (function(ARTEMIS) {
} }
} }
return body; return body;
} } else {
else {
message.textMode = "unsupported"; message.textMode = "unsupported";
return "Unsupported message body type which cannot be displayed by hawtio"; return "Unsupported message body type which cannot be displayed by hawtio";
} }
@ -382,8 +366,7 @@ var ARTEMIS = (function(ARTEMIS) {
$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];
@ -398,8 +381,7 @@ var ARTEMIS = (function(ARTEMIS) {
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;}));
@ -437,8 +419,7 @@ var ARTEMIS = (function(ARTEMIS) {
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);
@ -446,8 +427,7 @@ var ARTEMIS = (function(ARTEMIS) {
$.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 {
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])); matched = matched && (message[condition.column] && condition.regex.test(message[condition.column])) || (message.StringProperties && message.StringProperties[condition.column] && condition.regex.test(message.StringProperties[condition.column]));
} }
}); });
@ -480,8 +460,7 @@ var ARTEMIS = (function(ARTEMIS) {
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'));
} }
} }
@ -505,8 +484,7 @@ var ARTEMIS = (function(ARTEMIS) {
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({
@ -523,8 +501,7 @@ var ARTEMIS = (function(ARTEMIS) {
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;
} }
} }