2020-11-19 21:48:25 +08:00
|
|
|
dispatcher_add(function(sammy) {
|
2020-11-20 21:38:14 +08:00
|
|
|
sammy.get('#/stream/connections', function() {
|
2020-11-19 21:48:25 +08:00
|
|
|
renderStreamConnections();
|
|
|
|
});
|
2020-12-07 22:56:23 +08:00
|
|
|
sammy.get('#/stream/connections/:vhost/:name', function() {
|
|
|
|
var vhost = esc(this.params['vhost']);
|
|
|
|
var name = esc(this.params['name']);
|
|
|
|
render({'connection': {path: '/stream/connections/'+ vhost + '/' + name,
|
2020-12-07 23:50:26 +08:00
|
|
|
options: {ranges: ['data-rates-conn']}},
|
2020-12-08 00:52:03 +08:00
|
|
|
'consumers': '/stream/connections/' + vhost + '/' + name + '/consumers',
|
|
|
|
'publishers': '/stream/connections/' + vhost + '/' + name + '/publishers'},
|
2020-12-07 22:56:23 +08:00
|
|
|
'streamConnection', '#/stream/connections');
|
|
|
|
});
|
2020-11-19 21:48:25 +08:00
|
|
|
|
|
|
|
});
|
|
|
|
|
2020-11-20 21:38:14 +08:00
|
|
|
NAVIGATION['Stream'] = ['#/stream/connections', "monitoring"];
|
2020-11-19 21:48:25 +08:00
|
|
|
|
2020-12-07 23:50:26 +08:00
|
|
|
var ALL_STREAM_CONNECTION_COLUMNS =
|
2020-11-19 21:48:25 +08:00
|
|
|
{'Overview': [['user', 'User name', true],
|
|
|
|
['state', 'State', true]],
|
2021-05-27 17:15:30 +08:00
|
|
|
'Details': [['ssl', 'TLS', true],
|
|
|
|
['ssl_info', 'TLS details', false],
|
|
|
|
['protocol', 'Protocol', true],
|
2020-11-19 21:48:25 +08:00
|
|
|
['frame_max', 'Frame max', false],
|
|
|
|
['auth_mechanism', 'Auth mechanism', false],
|
|
|
|
['client', 'Client', false]],
|
|
|
|
'Network': [['from_client', 'From client', true],
|
|
|
|
['to_client', 'To client', true],
|
|
|
|
['heartbeat', 'Heartbeat', false],
|
|
|
|
['connected_at', 'Connected at', false]]};
|
|
|
|
|
2020-12-07 23:50:26 +08:00
|
|
|
var DISABLED_STATS_STREAM_CONNECTION_COLUMNS =
|
2020-11-19 21:48:25 +08:00
|
|
|
{'Overview': [['user', 'User name', true],
|
|
|
|
['state', 'State', true]]};
|
|
|
|
|
2020-12-07 23:50:26 +08:00
|
|
|
COLUMNS['streamConnections'] = disable_stats?DISABLED_STATS_STREAM_CONNECTION_COLUMNS:ALL_STREAM_CONNECTION_COLUMNS;
|
|
|
|
|
2020-11-19 21:48:25 +08:00
|
|
|
function renderStreamConnections() {
|
2020-11-20 21:38:14 +08:00
|
|
|
render({'connections': {path: url_pagination_template_context('stream/connections', 'streamConnections', 1, 100),
|
2020-11-19 21:48:25 +08:00
|
|
|
options: {sort:true}}},
|
2020-11-20 21:38:14 +08:00
|
|
|
'streamConnections', '#/stream/connections');
|
2020-11-19 21:48:25 +08:00
|
|
|
}
|
|
|
|
|
2021-01-21 00:01:31 +08:00
|
|
|
function link_stream_conn(vhost, name) {
|
2020-12-07 22:56:23 +08:00
|
|
|
return _link_to(short_conn(name), '#/stream/connections/' + esc(vhost) + '/' + esc(name));
|
|
|
|
}
|
|
|
|
|
2021-01-21 00:01:31 +08:00
|
|
|
RENDER_CALLBACKS['streamConnections'] = function() { renderStreamConnections() };
|
|
|
|
|
|
|
|
CONSUMER_OWNER_FORMATTERS.push({
|
|
|
|
order: 0, formatter: function(consumer) {
|
|
|
|
if (consumer.consumer_tag.startsWith('stream.subid-')) {
|
|
|
|
return link_stream_conn(
|
|
|
|
consumer.queue.vhost,
|
|
|
|
consumer.channel_details.connection_name
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-09-09 23:41:38 +08:00
|
|
|
CONSUMER_OWNER_FORMATTERS.sort(CONSUMER_OWNER_FORMATTERS_COMPARATOR);
|
|
|
|
|
|
|
|
QUEUE_EXTRA_CONTENT_REQUESTS.push(function(vhost, queue) {
|
2021-09-10 21:14:09 +08:00
|
|
|
return {'extra_stream_publishers' : '/stream/publishers/' + esc(vhost) + '/' + esc(queue)};
|
2021-09-09 23:41:38 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
QUEUE_EXTRA_CONTENT.push(function(queue, extraContent) {
|
|
|
|
if (is_stream(queue)) {
|
2021-09-10 21:14:09 +08:00
|
|
|
var publishers = extraContent['extra_stream_publishers'];
|
|
|
|
if (publishers !== undefined) {
|
|
|
|
return '<div class="section"><h2>Stream publishers</h2><div class="hider updatable">' +
|
|
|
|
format('streamPublishersList', {'publishers': publishers}) +
|
|
|
|
'</div></div>';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
2021-09-09 23:41:38 +08:00
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
});
|