Skip to content

Commit

Permalink
Add extension into dispatcher block code
Browse files Browse the repository at this point in the history
This is necessary to make sure the extension addition is actually
done in case of refresh of the queue page.

References #3389
  • Loading branch information
acogoluegnes committed Sep 13, 2021
1 parent b570075 commit 39a5177
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions deps/rabbitmq_stream_management/priv/www/js/stream.js
Expand Up @@ -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 '<div class="section"><h2>Stream publishers</h2><div class="hider updatable">' +
format('streamPublishersList', {'publishers': publishers}) +
'</div></div>';
} else {
return '';
}
} else {
return '';
}
});
});

NAVIGATION['Stream'] = ['#/stream/connections', "monitoring"];
Expand Down Expand Up @@ -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 '<div class="section"><h2>Stream publishers</h2><div class="hider updatable">' +
format('streamPublishersList', {'publishers': publishers}) +
'</div></div>';

} else {
return '';
}
} else {
return '';
}
});

0 comments on commit 39a5177

Please sign in to comment.