From 39a51772c6f73b7838bc117850f1c98014116db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 13 Sep 2021 15:17:49 +0200 Subject: [PATCH] Add extension into dispatcher block code This is necessary to make sure the extension addition is actually done in case of refresh of the queue page. References #3389 --- .../priv/www/js/stream.js | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/deps/rabbitmq_stream_management/priv/www/js/stream.js b/deps/rabbitmq_stream_management/priv/www/js/stream.js index ac546ad51b10..2b881ed17318 100644 --- a/deps/rabbitmq_stream_management/priv/www/js/stream.js +++ b/deps/rabbitmq_stream_management/priv/www/js/stream.js @@ -11,7 +11,25 @@ dispatcher_add(function(sammy) { 'publishers': '/stream/connections/' + vhost + '/' + name + '/publishers'}, 'streamConnection', '#/stream/connections'); }); - + // 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) { + return '

Stream publishers

' + + format('streamPublishersList', {'publishers': publishers}) + + '
'; + } else { + return ''; + } + } else { + return ''; + } + }); }); NAVIGATION['Stream'] = ['#/stream/connections', "monitoring"]; @@ -63,22 +81,3 @@ CONSUMER_OWNER_FORMATTERS.push({ CONSUMER_OWNER_FORMATTERS.sort(CONSUMER_OWNER_FORMATTERS_COMPARATOR); -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) { - return '

Stream publishers

' + - format('streamPublishersList', {'publishers': publishers}) + - '
'; - - } else { - return ''; - } - } else { - return ''; - } -}); \ No newline at end of file