in broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js [102:271]
function ConnectionUpdater(connectionTab)
{
var that = this;
this.tabObject = connectionTab;
this.contentPane = connectionTab.contentPane;
this.controller = connectionTab.controller;
this.management = connectionTab.controller.management;
this.modelObj = connectionTab.modelObj;
var containerNode = connectionTab.contentPane.containerNode;
function findNode(name)
{
return query("." + name, containerNode)[0];
}
function storeNodes(names)
{
for (var i = 0; i < names.length; i++)
{
that[names[i]] = findNode(names[i]);
}
}
this.connectionStatisticsNode = findNode("connectionStatistics");
storeNodes(["name",
"clientVersion",
"clientId",
"principal",
"port",
"transport",
"protocol",
"remoteProcessPid",
"remoteAddress",
"createdTime",
"transportInfo",
"transportInfoContainer",
"sessionCountLimit"]);
var userPreferences = this.management.userPreferences;
this.connectionData = {};
this.sessionsGrid = new QueryGrid({
detectChanges: true,
rowsPerPage: 10,
transformer: util.queryResultToObjects,
management: this.management,
parentObject: this.modelObj,
category: "Session",
selectClause: "id,name,consumerCount,unacknowledgedMessages,transactionStartTime,transactionUpdateTime",
where: "to_string($parent.id) = '" + this.modelObj.id + "'",
orderBy: "name",
columns: [
{
label: "Name",
field: "name"
}, {
label: "Consumers",
field: "consumerCount"
}, {
label: "Unacknowledged messages",
field: "unacknowledgedMessages"
}
]
}, findNode("sessions"));
this.sessionsGrid.on('rowBrowsed', lang.hitch(this, function(event){this.controller.showById(event.id);}));
this.sessionsGrid.startup();
this.consumersGrid = new QueryGrid({
detectChanges: true,
rowsPerPage: 10,
transformer: lang.hitch(this, this._transformConsumerData),
management: this.management,
parentObject: this.modelObj,
category: "Consumer",
selectClause: "id, name, distributionMode, $parent.id AS queueId, $parent.name AS queueName, "
+ "messagesOut, bytesOut, unacknowledgedMessages, unacknowledgedBytes",
where: "to_string(session.$parent.id) = '" + this.modelObj.id + "'",
orderBy: "name",
columns: [{
label: "Name",
field: "name"
}, {
label: "Mode",
field: "distributionMode"
}, {
label: "Queue",
field: "queueName"
}, {
label: "Unacknowledged (msgs)",
field: "unacknowledgedMessages"
}, {
label: "Unacknowledged (bytes)",
field: "unacknowledgedBytes",
formatter: formatter.formatBytes
}, {
label: "Msgs Rate",
field: "msgOutRate"
}, {
label: "Bytes Rate",
field: "bytesOutRate"
}
]
}, findNode("consumers"));
this.consumersGrid.on('rowBrowsed',
lang.hitch(this, function(event)
{
var queueId = this.consumersGrid.row(event.id).data.queueId;
this.controller.showById(queueId);
}));
this.consumersGrid.startup();
this.producersGrid = new QueryGrid({
detectChanges: true,
rowsPerPage: 10,
transformer: lang.hitch(this, this._transformProducerData),
management: this.management,
parentObject: this.modelObj,
category: "Producer",
selectClause: "id, name, deliveryType, destinationType, destination, destinationId, messagesOut, bytesOut",
where: "to_string($parent.$parent.id) = '" + this.modelObj.id + "'",
orderBy: "name",
columns: [{
label: "Name",
field: "name"
}, {
label: "Delivery Type",
field: "deliveryType"
}, {
label: "Destination Type",
field: "destinationType"
}, {
label: "Destination Name",
field: "destination"
}, {
label: "Msgs Out",
field: "messagesOut"
}, {
label: "Bytes Out",
field: "bytesOut",
formatter: formatter.formatBytes
}, {
label: "Msgs Rate",
field: "msgOutRate"
}, {
label: "Bytes Rate",
field: "bytesOutRate"
}
]
}, findNode("producers"));
this.producersGrid.on('rowBrowsed', lang.hitch(this, function(event)
{
const destinationId = this.producersGrid.row(event.id).data.destinationId;
this.controller.showById(destinationId);
}));
this.producersGrid.startup();
// Add onShow handler to work around an issue with not rendering of grid columns before first update.
// It seems if dgrid is created when tab is not shown (not active) the grid columns are not rendered.
this.contentPane.on("show",
lang.hitch(this, function()
{
this.consumersGrid.resize();
this.producersGrid.resize();
this.sessionsGrid.resize();
}));
}