ARTEMIS-2993 Sanitize artemis plugin console components

This commit is contained in:
Domenico Francesco Bruscino 2020-11-13 18:46:56 +01:00 committed by Justin Bertram
parent aa7e3f4519
commit 89c93ce3f0
6 changed files with 51 additions and 34 deletions

View File

@ -56,7 +56,7 @@ var Artemis;
.name;
function AddressesController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, pagination, artemisAddress) {
function AddressesController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisAddress) {
var ctrl = this;
ctrl.pagination = pagination;
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
@ -116,7 +116,7 @@ var Artemis;
{ header: 'ID', itemField: 'id' },
{ header: 'Name', itemField: 'name' },
{ header: 'Routing Types', itemField: 'routingTypes' },
{ header: 'Queue Count', itemField: 'queueCount' , templateFn: function(value, item) { return '<a href="#" onclick="selectQueues(\'' + item.name + '\')">' + value + '</a>' }}
{ header: 'Queue Count', itemField: 'queueCount' , templateFn: function(value, item) { return '<a href="#" onclick="selectQueues(' + item.idx + ')">' + $sanitize(value) + '</a>' }}
];
ctrl.refresh = function () {
@ -141,7 +141,8 @@ var Artemis;
ctrl.filter.values.value = artemisAddress.address.address;
}
selectQueues = function (address) {
selectQueues = function (idx) {
var address = ctrl.addresses[idx].name;
Artemis.log.debug("navigating to queues:" + address)
artemisAddress.address = { address: address };
$location.path("artemis/artemisQueues");
@ -201,6 +202,7 @@ var Artemis;
var data = JSON.parse(response.value);
ctrl.addresses = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.addresses.push(value);
});
ctrl.pagination.page(data["count"]);
@ -211,7 +213,7 @@ var Artemis;
ctrl.pagination.load();
}
AddressesController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', 'pagination', 'artemisAddress'];
AddressesController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisAddress'];
})(Artemis || (Artemis = {}));

View File

@ -68,7 +68,7 @@ var Artemis;
.name;
function ConnectionsController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, pagination, artemisConnection, artemisSession) {
function ConnectionsController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisConnection, artemisSession) {
var ctrl = this;
ctrl.pagination = pagination;
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
@ -126,13 +126,14 @@ var Artemis;
{ header: 'Client ID', itemField: 'clientID' },
{ header: 'Users', itemField: 'users' },
{ header: 'protocol', itemField: 'protocol' },
{ header: 'Session Count', itemField: 'sessionCount', templateFn: function(value, item) { return '<a href="#" onclick="selectSessions(\'' + item.connectionID + '\')">' + value + '</a>' }},
{ header: 'Session Count', itemField: 'sessionCount', templateFn: function(value, item) { return '<a href="#" onclick="selectSessions(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Remote Address', itemField: 'remoteAddress' },
{ header: 'Local Address', itemField: 'localAddress' },
{ header: 'Creation Time', itemField: 'creationTime' }
];
selectSessions = function (connection) {
selectSessions = function (idx) {
var connection = ctrl.connections[idx].connectionID;
Artemis.log.debug("navigating to connection:" + connection)
artemisConnection.connection = { connectionID: connection };
$location.path("artemis/artemisSessions");
@ -213,6 +214,7 @@ var Artemis;
var data = JSON.parse(response.value);
ctrl.connections = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.connections.push(value);
});
ctrl.pagination.page(data["count"]);
@ -223,7 +225,7 @@ var Artemis;
ctrl.pagination.load();
}
ConnectionsController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', 'pagination', 'artemisConnection', 'artemisSession'];
ConnectionsController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisConnection', 'artemisSession'];
})(Artemis || (Artemis = {}));

View File

@ -66,7 +66,7 @@ var Artemis;
.name;
function ConsumersController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, pagination, artemisConsumer, artemisQueue, artemisAddress, artemisSession) {
function ConsumersController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisConsumer, artemisQueue, artemisAddress, artemisSession) {
var ctrl = this;
ctrl.pagination = pagination;
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
@ -128,13 +128,13 @@ var Artemis;
};
ctrl.tableColumns = [
{ header: 'ID', itemField: 'id' },
{ header: 'Session', itemField: 'session' , templateFn: function(value, item) { return '<a href="#" onclick="selectSession(\'' + item.session + '\')">' + value + '</a>' }},
{ header: 'Session', itemField: 'session' , templateFn: function(value, item) { return '<a href="#" onclick="selectSession(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Client ID', itemField: 'clientID' },
{ header: 'Protocol', itemField: 'protocol' },
{ header: 'Queue', itemField: 'queue', templateFn: function(value, item) { return '<a href="#" onclick="selectQueue(\'' + item.queue + '\')">' + value + '</a>' }},
{ header: 'Queue', itemField: 'queue', templateFn: function(value, item) { return '<a href="#" onclick="selectQueue(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'queueType', itemField: 'queueType' },
{ header: 'Filter', itemField: 'filter' },
{ header: 'Address', itemField: 'address' , templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(\'' + item.address + '\')">' + value + '</a>' }},
{ header: 'Address', itemField: 'address' , templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Remote Address', itemField: 'remoteAddress' },
{ header: 'Local Address', itemField: 'localAddress' },
{ header: 'Creation Time', itemField: 'creationTime' }
@ -166,19 +166,22 @@ var Artemis;
ctrl.filter.values.value = artemisConsumer.consumer.sessionID;
}
selectQueue = function (queue) {
selectQueue = function (idx) {
var queue = ctrl.consumers[idx].queue;
Artemis.log.debug("navigating to queue:" + queue)
artemisQueue.queue = { queue: queue };
$location.path("artemis/artemisQueues");
};
selectAddress = function (address) {
selectAddress = function (idx) {
var address = ctrl.consumers[idx].address;
Artemis.log.debug("navigating to address:" + address)
artemisAddress.address = { address: address };
$location.path("artemis/artemisAddresses");
};
selectSession = function (session) {
selectSession = function (idx) {
var session = ctrl.consumers[idx].session;
Artemis.log.debug("navigating to session:" + session)
artemisSession.session = { session: session };
$location.path("artemis/artemisSessions");
@ -232,6 +235,7 @@ var Artemis;
var data = JSON.parse(response.value);
ctrl.consumers = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.consumers.push(value);
});
ctrl.pagination.page(data["count"]);
@ -242,7 +246,7 @@ var Artemis;
ctrl.pagination.load();
}
ConsumersController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', 'pagination', 'artemisConsumer', 'artemisQueue', 'artemisAddress', 'artemisSession'];
ConsumersController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisConsumer', 'artemisQueue', 'artemisAddress', 'artemisSession'];
})(Artemis || (Artemis = {}));

View File

@ -53,7 +53,7 @@ var Artemis;
.name;
function ProducersController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, pagination, artemisProducer, artemisAddress, artemisSession) {
function ProducersController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisProducer, artemisAddress, artemisSession) {
var ctrl = this;
ctrl.pagination = pagination;
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
@ -101,11 +101,11 @@ var Artemis;
};
ctrl.tableColumns = [
{ header: 'ID', itemField: 'id' },
{ header: 'Session', itemField: 'session' , templateFn: function(value, item) { return '<a href="#" onclick="selectSession(\'' + item.session + '\')">' + value + '</a>' }},
{ header: 'Session', itemField: 'session' , templateFn: function(value, item) { return '<a href="#" onclick="selectSession(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Client ID', itemField: 'clientID' },
{ header: 'Protocol', itemField: 'protocol' },
{ header: 'User', itemField: 'user' },
{ header: 'Address', itemField: 'address', templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(\'' + item.address + '\')">' + value + '</a>' }},
{ header: 'Address', itemField: 'address', templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Remote Address', itemField: 'remoteAddress' },
{ header: 'Local Address', itemField: 'localAddress' }
];
@ -129,13 +129,15 @@ var Artemis;
ctrl.pagination.load();
};
selectAddress = function (address) {
selectAddress = function (idx) {
var address = ctrl.producers[idx].address;
Artemis.log.debug("navigating to address:" + address)
artemisAddress.address = { address: address };
$location.path("artemis/artemisAddresses");
};
selectSession = function (session) {
selectSession = function (idx) {
var session = ctrl.producers[idx].session;
Artemis.log.debug("navigating to session:" + session)
artemisSession.session = { session: session };
$location.path("artemis/artemisSessions");
@ -178,6 +180,7 @@ var Artemis;
var data = JSON.parse(response.value);
ctrl.producers = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.producers.push(value);
});
ctrl.pagination.page(data["count"]);
@ -188,7 +191,7 @@ var Artemis;
ctrl.pagination.load();
}
ProducersController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', 'pagination', 'artemisProducer', 'artemisAddress', 'artemisSession'];
ProducersController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisProducer', 'artemisAddress', 'artemisSession'];
})(Artemis || (Artemis = {}));

View File

@ -56,7 +56,7 @@ var Artemis;
.name;
function QueuesController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, pagination, artemisQueue, artemisAddress) {
function QueuesController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisQueue, artemisAddress) {
var ctrl = this;
ctrl.pagination = pagination;
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
@ -128,7 +128,7 @@ var Artemis;
{ header: 'Name', itemField: 'name' },
{ header: 'Routing Types', itemField: 'routingTypes' },
{ header: 'Queue Count', itemField: 'queueCount' },
{ header: 'Address', itemField: 'address' , templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(\'' + item.address + '\')">' + value + '</a>' }},
{ header: 'Address', itemField: 'address' , templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Routing Type', itemField: 'routingType' },
{ header: 'Filter', itemField: 'filter' },
{ header: 'Durable', itemField: 'durable' },
@ -186,7 +186,8 @@ var Artemis;
function navigateToQueuesOps(action, item) {
$location.path("artemis/operations").search({"tab": "artemis", "nid": getQueuesNid(item, $location)});
};
selectAddress = function (address) {
selectAddress = function (idx) {
var address = ctrl.queues[idx].address;
Artemis.log.debug("navigating to address:" + address)
artemisAddress.address = { address: address };
$location.path("artemis/artemisAddresses");
@ -239,6 +240,7 @@ var Artemis;
var data = JSON.parse(response.value);
ctrl.queues = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.queues.push(value);
});
ctrl.pagination.page(data["count"]);
@ -249,7 +251,7 @@ var Artemis;
ctrl.pagination.load();
}
QueuesController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', 'pagination', 'artemisQueue', 'artemisAddress'];
QueuesController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisQueue', 'artemisAddress'];
})(Artemis || (Artemis = {}));

View File

@ -67,7 +67,7 @@ var Artemis;
.name;
function SessionsController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, pagination, artemisConnection, artemisSession, artemisConsumer, artemisProducer) {
function SessionsController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisConnection, artemisSession, artemisConsumer, artemisProducer) {
var ctrl = this;
ctrl.pagination = pagination;
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
@ -127,10 +127,10 @@ var Artemis;
};
ctrl.tableColumns = [
{ header: 'ID', itemField: 'id' },
{ header: 'Connection', itemField: 'connectionID', templateFn: function(value, item) { return '<a href="#" onclick="selectConnection(\'' + item.connectionID + '\')">' + value + '</a>' }},
{ header: 'Connection', itemField: 'connectionID', templateFn: function(value, item) { return '<a href="#" onclick="selectConnection(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'User', itemField: 'user' },
{ header: 'Consumer Count', itemField: 'consumerCount', templateFn: function(value, item) { return '<a href="#" onclick="selectConsumers(\'' + item.id + '\')">' + value + '</a>' }},
{ header: 'Producer Count', itemField: 'producerCount', templateFn: function(value, item) { return '<a href="#" onclick="selectProducers(\'' + item.id + '\')">' + value + '</a>' }},
{ header: 'Consumer Count', itemField: 'consumerCount', templateFn: function(value, item) { return '<a href="#" onclick="selectConsumers(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Producer Count', itemField: 'producerCount', templateFn: function(value, item) { return '<a href="#" onclick="selectProducers(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Creation Time', itemField: 'creationTime' }
];
@ -155,19 +155,22 @@ var Artemis;
ctrl.pagination.load();
};
selectConnection = function (connection) {
selectConnection = function (idx) {
var connection = ctrl.sessions[idx].connectionID;
Artemis.log.debug("navigating to connection:" + connection)
artemisSession.session = { connectionID: connection };
$location.path("artemis/artemisConnections");
};
selectConsumers = function (session) {
selectConsumers = function (idx) {
var session = ctrl.sessions[idx].id;
Artemis.log.debug("navigating to consumers:" + session)
artemisConsumer.consumer = { sessionID: session };
$location.path("artemis/artemisConsumers");
};
selectProducers = function (session) {
selectProducers = function (idx) {
var session = ctrl.sessions[idx].id;
Artemis.log.debug("navigating to producers:" + session)
artemisProducer.producer = { sessionID: session };
$location.path("artemis/artemisProducers");
@ -235,6 +238,7 @@ var Artemis;
var data = JSON.parse(response.value);
ctrl.sessions = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.sessions.push(value);
});
ctrl.pagination.page(data["count"]);
@ -245,7 +249,7 @@ var Artemis;
ctrl.pagination.load();
}
SessionsController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', 'pagination', 'artemisConnection', 'artemisSession', 'artemisConsumer', 'artemisProducer'];
SessionsController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisConnection', 'artemisSession', 'artemisConsumer', 'artemisProducer'];
})(Artemis || (Artemis = {}));