rabbitmq-management3.9.29,user.ejs,limits.ejs文件异常,导致控制台报错问题

This commit is contained in:
钟文彬 2023-11-07 11:46:32 +08:00
parent 88ceef61da
commit 5218759835
3 changed files with 278 additions and 1 deletions

View File

@ -1,5 +1,8 @@
FROM rabbitmq:3.9-management
COPY ./users.ejs /opt/rabbitmq/plugins/rabbitmq_management-3.9.29/priv/www/js/tmpl
COPY ./limits.ejs /opt/rabbitmq/plugins/rabbitmq_management-3.9.29/priv/www/js/tmpl
RUN apt-get -o Acquire::Check-Date=false update && apt-get install -y curl
RUN curl -L https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/3.9.0/rabbitmq_delayed_message_exchange-3.9.0.ez > $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.9.0.ez

177
docker/rabbitmq/limits.ejs Normal file
View File

@ -0,0 +1,177 @@
<h1>Limits</h1>
<div class="section">
<h2>Virtual host Limits</h2>
<div class="hider">
<div class="updatable">
<% if (limits.length > 0) { %>
<table class="list">
<thead>
<tr>
<th>Virtual Host</th>
<th>Limit</th>
<th>Value</th>
<th class="administrator-only"></th>
</tr>
</thead>
<tbody>
<% for (var i = 0; i < limits.length; i++) {
var limit = limits[i];
var limit_values = Object.keys(limit.value).sort().map(
function(k) { return {name: k, value: limit.value[k]};});
%>
<% for (var j = 0; j < limit_values.length; j++) {
var limit_value = limit_values[j];
%>
<tr<%= alt_rows(j+1)%>>
<% if(j == 0) { %>
<td rowspan="<%= limit_values.length %>"> <%= fmt_string(limit.vhost) %> </td>
<% } %>
<td><%= limit_value.name %></td>
<td><%= limit_value.value %></td>
<td class="administrator-only">
<form action="#/limits" method="delete" class="confirm">
<input type="hidden" name="name" value="<%= fmt_string(limit_value.name) %>"/>
<input type="hidden" name="vhost" value="<%= fmt_string(limit.vhost) %>"/>
<input type="submit" value="Clear"/>
</form>
</td>
</tr>
<% } %>
<% } %>
</tbody>
</table>
<% } %>
</div>
</div>
</div>
<div class="section administrator-only">
<h2>Set / update a virtual host limit</h2>
<div class="hider">
<form action="#/limits" method="put">
<table class="form">
<tr>
<th><label>Virtual host:</label></th>
<td>
<select name="vhost">
<% for (var i = 0; i < vhosts.length; i++) { %>
<option value="<%= fmt_string(vhosts[i].name) %>">
<%= fmt_string(vhosts[i].name) %>
</option>
<% } %>
</select>
</td>
</tr>
<tr>
<th><label>Limit:</label></th>
<td>
<select name="name">
<option value="max-connections">max-connections</option>
<option value="max-queues">max-queues</option>
</select>
</td>
</tr>
<tr>
<th><label>Value:</label></th>
<td>
<input type="text" name="value"/>
<span class="mand">*</span>
</td>
</tr>
</table>
<input type="submit" value="Set / update limit"/>
</form>
</div>
</div>
<div class="section">
<h2>User Limits</h2>
<div class="hider">
<div class="updatable">
<% if (user_limits.length > 0) { %>
<table class="list">
<thead>
<tr>
<th>User</th>
<th>Limit</th>
<th>Value</th>
<th class="administrator-only"></th>
</tr>
</thead>
<tbody>
<% for (var i = 0; i < user_limits.length; i++) {
var user_limit = user_limits[i];
var user_limit_values = Object.keys(user_limit.value).sort().map(
function(k) { return {name: k, value: user_limit.value[k]};});
%>
<% for (var j = 0; j < user_limit_values.length; j++) {
var user_limit_value = user_limit_values[j];
%>
<tr<%= alt_rows(j+1)%>>
<% if(j == 0) { %>
<td rowspan="<%= user_limit_values.length %>"> <%= fmt_string(user_limit.user) %> </td>
<% } %>
<td><%= user_limit_value.name %></td>
<td><%= user_limit_value.value %></td>
<td class="administrator-only">
<form action="#/user-limits" method="delete" class="confirm">
<input type="hidden" name="name" value="<%= fmt_string(user_limit_value.name) %>"/>
<input type="hidden" name="user" value="<%= fmt_string(user_limit.user) %>"/>
<input type="submit" value="Clear"/>
</form>
</td>
</tr>
<% } %>
<% } %>
</tbody>
</table>
<% } %>
</div>
</div>
</div>
<div class="section administrator-only">
<h2>Set / update a user limit</h2>
<div class="hider">
<form action="#/user-limits" method="put">
<table class="form">
<tr>
<th><label>User:</label></th>
<td>
<select name="user">
<% for (var i = 0; i < users.length; i++) { %>
<option value="<%= fmt_string(users[i].name) %>">
<%= fmt_string(users[i].name) %>
</option>
<% } %>
</select>
</td>
</tr>
<tr>
<th><label>Limit:</label></th>
<td>
<select name="name">
<option value="max-connections">max-connections</option>
<option value="max-channels">max-channels</option>
</select>
</td>
</tr>
<tr>
<th><label>Value:</label></th>
<td>
<input type="text" name="value"/>
<span class="mand">*</span>
</td>
</tr>
</table>
<input type="submit" value="Set / update limit"/>
</form>
</div>
</div>

97
docker/rabbitmq/users.ejs Normal file
View File

@ -0,0 +1,97 @@
<h1>Users</h1>
<div class="section">
<%= paginate_ui(users, 'users') %>
</div>
<div class="updatable">
<% if (users.items.length > 0) { %>
<table class="list">
<thead>
<tr>
<th><%= fmt_sort('Name', 'name') %></th>
<th><%= fmt_sort('Tags', 'tags') %></th>
<th>Can access virtual hosts</th>
<th>Has password</th>
</tr>
</thead>
<tbody>
<%
for (var i = 0; i < users.items.length; i++) {
var user = users.items[i];
%>
<tr<%= alt_rows(i)%>>
<td><%= link_user(user.name) %></td>
<td class="c"><%= fmt_string(user.tags) %></td>
<td class="c"><%= fmt_permissions(user, permissions, 'user', 'vhost',
'<p class="warning">No access</p>') %></td>
<td class="c"><%= fmt_boolean(user.password_hash.length > 0) %></td>
</tr>
<% } %>
</tbody>
</table>
<% } else { %>
<p>... no users ...</p>
<% } %>
<p><span class="help" id="internal-users-only"></span></p>
</div>
</div>
</div>
<div class="section-hidden">
<h2>Add a user</h2>
<div class="hider">
<form action="#/users-add" method="put">
<table class="form">
<tr>
<th><label>Username:</label></th>
<td>
<input type="text" name="username"/>
<span class="mand">*</span>
</td>
</tr>
<tr>
<th>
<label>
<select name="has-password" class="narrow controls-appearance">
<option value="password">Password:</option>
<option value="no-password">No password</option>
</select>
</label>
</th>
<td>
<div id="password-div">
<input type="password" name="password" />
<span class="mand">*</span><br/>
<input type="password" name="password_confirm" />
<span class="mand">*</span>
(confirm)
</div>
<div id="no-password-div" style="display: none;">
User cannot log in using password.
</div>
</td>
</tr>
<tr>
<th><label>Tags:</label></th>
<td>
<input type="text" name="tags" id="tags" />
<span class="help" id="user-tags"/>
<table class="argument-links">
<tr>
<td>Set</td>
<td>
<span class="tag-link" tag="administrator">Admin</span> |
<span class="tag-link" tag="monitoring">Monitoring</span> |
<span class="tag-link" tag="policymaker">Policymaker</span><br />
<span class="tag-link" tag="management">Management</span> |
<span class="tag-link" tag="impersonator">Impersonator</span> |
<span class="tag-link" tag="">None</span>
</td>
</tr>
</table>
</td>
</tr>
</table>
<input type="submit" value="Add user"/>
</form>
</div>
</div>