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');
|
2025-04-27 19:01:09 +08:00
|
|
|
});
|
|
|
|
sammy.get('#/stream/super-streams', function() {
|
|
|
|
render({'vhosts': '/vhosts'}, 'superStreams', '#/stream/super-streams')
|
|
|
|
});
|
|
|
|
sammy.put('#/stream/super-streams', function() {
|
|
|
|
put_cast_params(this, '/stream/super-streams/:vhost/:name',
|
|
|
|
['name', 'pattern', 'policy'], ['priority'], []);
|
|
|
|
location.href = "/#/queues";
|
|
|
|
});
|
2021-09-13 21:17:49 +08:00
|
|
|
// not exactly dispatcher stuff, but we have to make sure this is called before
|
|
|
|
// HTTP requests are made in case of refresh of the queue page
|
|
|
|
QUEUE_EXTRA_CONTENT_REQUESTS.push(function(vhost, queue) {
|
|
|
|
return {'extra_stream_publishers' : '/stream/publishers/' + esc(vhost) + '/' + esc(queue)};
|
|
|
|
});
|
|
|
|
QUEUE_EXTRA_CONTENT.push(function(queue, extraContent) {
|
|
|
|
if (is_stream(queue)) {
|
|
|
|
var publishers = extraContent['extra_stream_publishers'];
|
|
|
|
if (publishers !== undefined) {
|
2021-09-14 23:18:49 +08:00
|
|
|
return '<div class="section-hidden"><h2 class="updatable">Stream publishers (' + Object.keys(publishers).length +')</h2><div class="hider updatable">' +
|
2021-09-13 22:31:06 +08:00
|
|
|
format('streamPublishersList', {'publishers': publishers, 'mode': 'queue'}) +
|
2021-09-13 21:17:49 +08:00
|
|
|
'</div></div>';
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
});
|
2020-11-19 21:48:25 +08:00
|
|
|
});
|
|
|
|
|
2023-06-10 22:57:16 +08:00
|
|
|
NAVIGATION['Stream Connections'] = ['#/stream/connections', "monitoring"];
|
2025-04-27 19:01:09 +08:00
|
|
|
NAVIGATION['Super Streams'] = ['#/stream/super-streams', "management"];
|
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);
|
|
|
|
|