Access lists

This commit is contained in:
Jamie Curnow
2018-08-19 18:54:17 +10:00
parent 13f08df46c
commit 7d9e716c7c
8 changed files with 38 additions and 29 deletions

View File

@ -5,25 +5,17 @@
</td>
<td>
<div>
<% domain_names.map(function(host) {
%>
<span class="tag"><%- host %></span>
<%
});
%>
<%- name %>
</div>
<div class="small text-muted">
<%- i18n('str', 'created-on', {date: formatDbDate(created_on, 'Do MMMM YYYY')}) %>
</div>
</td>
<td>
<div class="text-monospace"><%- forward_ip %>:<%- forward_port %></div>
<%- i18n('access-lists', 'item-count', {count: item_count}) %>
</td>
<td>
<div><%- ssl_enabled && ssl_provider ? i18n('ssl', ssl_provider) : i18n('ssl', 'none') %></div>
</td>
<td>
<div><%- access_list_id ? access_list.name : i18n('str', 'public') %></div>
<%- i18n('access-lists', 'proxy-host-count', {count: proxy_host_count}) %>
</td>
<% if (canManage) { %>
<td class="text-right">
@ -31,10 +23,9 @@
<a href="#" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="#" class="edit dropdown-item"><i class="dropdown-icon fe fe-edit"></i> <%- i18n('str', 'edit') %></a>
<a href="#" class="logs dropdown-item"><i class="dropdown-icon fe fe-book"></i> <%- i18n('str', 'logs') %></a>
<div class="dropdown-divider"></div>
<a href="#" class="delete dropdown-item"><i class="dropdown-icon fe fe-trash-2"></i> <%- i18n('str', 'delete') %></a>
</div>
</div>
</td>
<% } %>
<% } %>

View File

@ -16,17 +16,17 @@ module.exports = Mn.View.extend({
events: {
'click @ui.edit': function (e) {
e.preventDefault();
App.Controller.showNginxProxyForm(this.model);
App.Controller.showNginxAccessListForm(this.model);
},
'click @ui.delete': function (e) {
e.preventDefault();
App.Controller.showNginxProxyDeleteConfirm(this.model);
App.Controller.showNginxAccessListDeleteConfirm(this.model);
}
},
templateContext: {
canManage: App.Cache.User.canManage('proxy_hosts')
canManage: App.Cache.User.canManage('access_lists')
},
initialize: function () {

View File

@ -1,9 +1,8 @@
<thead>
<th width="30">&nbsp;</th>
<th><%- i18n('str', 'source') %></th>
<th><%- i18n('str', 'destination') %></th>
<th><%- i18n('str', 'ssl') %></th>
<th><%- i18n('str', 'access') %></th>
<th><%- i18n('str', 'name') %></th>
<th><%- i18n('users', 'title') %></th>
<th><%- i18n('proxy-hosts', 'title') %></th>
<% if (canManage) { %>
<th>&nbsp;</th>
<% } %>

View File

@ -42,7 +42,7 @@ module.exports = Mn.View.extend({
onRender: function () {
let view = this;
App.Api.Nginx.AccessLists.getAll(['owner'])
App.Api.Nginx.AccessLists.getAll(['owner', 'items'])
.then(response => {
if (!view.isDestroyed()) {
if (response && response.length) {