Skip to content

Commit 37105d5

Browse files
ikavgodeadtrickster
authored andcommitted
ManagementUI - hide Delete button on queue details page if queue is protected
1 parent 64bee12 commit 37105d5

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

deps/rabbitmq_management/priv/www/js/main.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ function dispatcher_add(fun) {
7474
}
7575

7676
function dispatcher() {
77+
this.use('Title');
78+
this.setTitle('RabbitMQ - ');
7779
for (var i in dispatcher_modules) {
7880
dispatcher_modules[i](this);
7981
}
@@ -1763,6 +1765,10 @@ function select_queue_type(queuetype) {
17631765
update();
17641766
}
17651767

1768+
function is_internal(queue) {
1769+
return queue.internal;
1770+
}
1771+
17661772
function is_quorum(queue) {
17671773
if (queue["arguments"]) {
17681774
if (queue["arguments"]["x-queue-type"]) {

deps/rabbitmq_management/priv/www/js/tmpl/queue.ejs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
</div>
196196
<% } %>
197197

198+
<% if (!is_internal(queue)) { %>
198199
<div class="section-hidden">
199200
<h2>Delete</h2>
200201
<div class="hider">
@@ -206,6 +207,7 @@
206207
</form>
207208
</div>
208209
</div>
210+
<% } %>
209211

210212
<% if (QUEUE_TYPE(queue).actions.purge) { %>
211213
<div class="section-hidden">

deps/rabbitmq_management/src/rabbit_mgmt_wm_queue.erl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,15 @@ queue_with_totals(ReqData) ->
128128

129129
queue_with_totals(VHost, QName) ->
130130
Name = rabbit_misc:r(VHost, queue, QName),
131+
%% this somehow shares fields with mgmt_format:queue :-/
131132
case rabbit_amqqueue:lookup(Name) of
132133
{ok, Q} -> QueueInfo = rabbit_amqqueue:info(Q,
133134
[name, durable, auto_delete, exclusive,
134135
owner_pid, arguments, type, state,
135136
policy, totals, online, type_specific]),
137+
QueueInfo ++ [{internal, amqqueue:is_internal(Q)},
138+
{internal_owner, rabbit_mgmt_format:internal_owner(amqqueue:internal_owner(Q))}],
136139
rabbit_mgmt_format:queue_info(QueueInfo);
137140
{error, not_found} -> not_found
138141
end.
142+

0 commit comments

Comments
 (0)