add satisfy configuration to the ui

This commit is contained in:
Kyle Klaus
2020-04-11 00:26:54 -07:00
parent 8d432bd60a
commit 0f238a5021
8 changed files with 55 additions and 10 deletions

View File

@ -21,6 +21,16 @@
<input type="text" name="name" class="form-control" value="<%- name %>" required>
</div>
</div>
<div class="col-sm-6 col-md-6">
<div class="form-group">
<label class="custom-switch">
<input type="checkbox" class="custom-switch-input" name="satify_any" value="1"<%- typeof satify_any !== 'undefined' && satify_any ? ' checked' : '' %>>
<span class="custom-switch-indicator"></span>
<span class="custom-switch-description"><%- i18n('access-lists', 'satisfy-any') %></span>
</label>
</div>
</div>
</div>
</div>

View File

@ -65,17 +65,20 @@ module.exports = Mn.View.extend({
}
});
if (!items_data.length) {
alert('You must specify at least 1 Username and Password combination');
if (!items_data.length && !clients_data.length) {
alert('You must specify at least 1 Authorization or Access rule');
return;
}
let data = {
name: form_data.name,
items: items_data,
clients: clients_data
name: form_data.name,
satify_any: !!form_data.satify_any,
items: items_data,
clients: clients_data
};
console.log(data);
let method = App.Api.Nginx.AccessLists.create;
let is_new = true;

View File

@ -17,6 +17,13 @@
<td>
<%- i18n('access-lists', 'client-count', {count: clients.length || 0}) %>
</td>
<td>
<% if (satify_any) { %>
<%- i18n('str', 'any') %>
<%} else { %>
<%- i18n('str', 'all') %>
<% } %>
</td>
<td>
<%- i18n('access-lists', 'proxy-host-count', {count: proxy_host_count}) %>
</td>

View File

@ -3,6 +3,7 @@
<th><%- i18n('str', 'name') %></th>
<th><%- i18n('access-lists', 'authorization') %></th>
<th><%- i18n('access-lists', 'access') %></th>
<th><%- i18n('access-lists', 'satisfy') %></th>
<th><%- i18n('proxy-hosts', 'title') %></th>
<% if (canManage) { %>
<th>&nbsp;</th>