Skip to content

Do not render Delete button for internal queues #13909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions deps/rabbitmq_management/priv/www/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1759,6 +1759,10 @@ function select_queue_type(queuetype) {
update();
}

function is_internal(queue) {
return queue.internal;
}

function get_queue_type (queue) {
return queue.type;
}
Expand Down
2 changes: 2 additions & 0 deletions deps/rabbitmq_management/priv/www/js/tmpl/queue.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
</div>
<% } %>

<% if (!is_internal(queue)) { %>
<div class="section-hidden" id="delete">
<h2>Delete</h2>
<div class="hider">
Expand All @@ -406,6 +407,7 @@
</form>
</div>
</div>
<% } %>

<% if (!is_stream(queue)) { %>
<div class="section-hidden">
Expand Down
7 changes: 5 additions & 2 deletions deps/rabbitmq_management/src/rabbit_mgmt_wm_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ queue_with_totals(ReqData) ->

queue_with_totals(VHost, QName) ->
Name = rabbit_misc:r(VHost, queue, QName),
%% this somehow shares fields with mgmt_format:queue :-/
case rabbit_amqqueue:lookup(Name) of
{ok, Q} -> QueueInfo = rabbit_amqqueue:info(Q,
{ok, Q} -> QueueInfo0 = rabbit_amqqueue:info(Q,
[name, durable, auto_delete, exclusive,
owner_pid, arguments, type, state,
policy, totals, online, type_specific]),
rabbit_mgmt_format:queue_info(QueueInfo);
QueueInfo1 = QueueInfo0 ++ [{internal, amqqueue:is_internal(Q)},
{internal_owner, rabbit_mgmt_format:internal_owner(amqqueue:internal_owner(Q))}],
rabbit_mgmt_format:queue_info(QueueInfo1);
{error, not_found} -> not_found
end.
13 changes: 11 additions & 2 deletions deps/rabbitmq_management_agent/src/rabbit_mgmt_format.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-export([format/2, ip/1, ipb/1, amqp_table/1, tuple/1]).
-export([parameter/1, now_to_str/0, now_to_str/1, strip_pids/1]).
-export([protocol/1, resource/1, queue/1, queue/2, queue_state/1, queue_info/1]).
-export([exchange/1, user/1, internal_user/1, binding/1, url/2]).
-export([exchange/1, user/1, internal_user/1, binding/1, url/2, internal_owner/1]).
-export([pack_binding_props/2, tokenise/1]).
-export([to_amqp_table/1, listener/1, web_context/1, properties/1, basic_properties/1]).
-export([record/2, to_basic_properties/1]).
Expand Down Expand Up @@ -401,10 +401,19 @@ queue(Q, Ctx) when ?is_amqqueue(Q) ->
{exclusive, is_pid(ExclusiveOwner)},
{owner_pid, ExclusiveOwner},
{arguments, amqp_table(Arguments)},
{pid, Pid}
{pid, Pid},
{internal, amqqueue:is_internal(Q)},
{internal_owner, internal_owner(amqqueue:internal_owner(Q))}
%% type specific stuff like, state, type, members etc is returned here
| rabbit_queue_type:format(Q, Ctx)].

internal_owner(undefined) ->
false;
internal_owner(#resource{} = Owner) ->
[{name, Owner#resource.name},
{kind, Owner#resource.kind},
{vhost, Owner#resource.virtual_host}].

queue_info(List) ->
format(List, {fun format_exchange_and_queue/1, false}).

Expand Down