Some small improvements to email channel management.
This commit is contained in:
parent
ad732e298c
commit
a009cb0935
3 changed files with 85 additions and 63 deletions
|
@ -236,12 +236,12 @@ class App.ChannelEmailAccountOverview extends App.Controller
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
|
|
||||||
# load assets
|
# load assets
|
||||||
App.Collection.loadAssets( data.assets )
|
App.Collection.loadAssets(data.assets)
|
||||||
|
|
||||||
@render()
|
@render(accounts_fixed: data.accounts_fixed)
|
||||||
)
|
)
|
||||||
|
|
||||||
render: =>
|
render: (params = {}) =>
|
||||||
|
|
||||||
# get channels
|
# get channels
|
||||||
channels = App.Channel.search( filter: { area: 'Email::Account' } )
|
channels = App.Channel.search( filter: { area: 'Email::Account' } )
|
||||||
|
@ -260,9 +260,10 @@ class App.ChannelEmailAccountOverview extends App.Controller
|
||||||
channel = App.Channel.search( filter: { area: 'Email::Notification', active: true } )[0]
|
channel = App.Channel.search( filter: { area: 'Email::Notification', active: true } )[0]
|
||||||
|
|
||||||
@html App.view('channel/email_account_overview')(
|
@html App.view('channel/email_account_overview')(
|
||||||
channels: channels
|
channels: channels
|
||||||
email_addresses_not_used: email_addresses_not_used
|
email_addresses_not_used: email_addresses_not_used
|
||||||
channel: channel
|
channel: channel
|
||||||
|
accounts_fixed: params.accounts_fixed
|
||||||
)
|
)
|
||||||
|
|
||||||
wizard: (e) =>
|
wizard: (e) =>
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
<h1><%- @T('Email Accounts') %></h1>
|
<h1><%- @T('Email Accounts') %></h1>
|
||||||
|
|
||||||
|
<% if @accounts_fixed: %>
|
||||||
|
<h2><%- @T('Fixed email addresses') %></h2>
|
||||||
|
<ul>
|
||||||
|
<% for email_address in @accounts_fixed: %>
|
||||||
|
<li><%= email_address.realname %><<%= email_address.email %>>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if !_.isEmpty(@email_addresses_not_used): %>
|
<% if !_.isEmpty(@email_addresses_not_used): %>
|
||||||
<h2><%- @T('Not linked email addresses') %></h2>
|
<h2><%- @T('Not linked email addresses') %></h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -9,63 +18,67 @@
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<table class="table table-hover user-list">
|
<% if _.isEmpty(@channels): %>
|
||||||
<thead>
|
<p><%- @T('You have no configured account right now.') %></p>
|
||||||
<tr>
|
<% else: %>
|
||||||
<th><%- @T('Inbound') %></th>
|
<table class="table table-hover user-list">
|
||||||
<th><%- @T('Outbound') %></th>
|
<thead>
|
||||||
<th><%- @T('Email Adresses') %></th>
|
<tr>
|
||||||
<th><%- @T('Action') %></th>
|
<th><%- @T('Inbound') %></th>
|
||||||
</tr>
|
<th><%- @T('Outbound') %></th>
|
||||||
</thead>
|
<th><%- @T('Email Adresses') %></th>
|
||||||
<tbody>
|
<th><%- @T('Action') %></th>
|
||||||
<% for channel in @channels: %>
|
</tr>
|
||||||
<tr data-id="<%- channel.id %>">
|
</thead>
|
||||||
<td class="<% if channel.status_in is 'ok': %>success<% else if channel.status_in is 'error': %>danger<% else: %>warning<% end %>">
|
<tbody>
|
||||||
<%- @T('State') %>: <%- @T(channel.status_in || 'unknown') %><br>
|
<% for channel in @channels: %>
|
||||||
<a href="#" data-type="edit-inbound">
|
<tr data-id="<%- channel.id %>">
|
||||||
<%= channel.options.inbound.options.user %><br>
|
<td class="<% if channel.status_in is 'ok': %>success<% else if channel.status_in is 'error': %>danger<% else: %>warning<% end %>">
|
||||||
<%= channel.options.inbound.options.host %> (<%= channel.options.inbound.adapter %>)
|
<%- @T('State') %>: <%- @T(channel.status_in || 'unknown') %><br>
|
||||||
</a>
|
<a href="#" data-type="edit-inbound">
|
||||||
</td>
|
<%= channel.options.inbound.options.user %><br>
|
||||||
<td class="<% if channel.status_out is 'ok': %>success<% else if channel.status_out is 'error': %>danger<% else: %>warning<% end %>">
|
<%= channel.options.inbound.options.host %> (<%= channel.options.inbound.adapter %>)
|
||||||
<%- @T('State') %>: <%- @T(channel.status_out || 'unknown') %><br>
|
</a>
|
||||||
<a href="#" data-type="edit-outbound">
|
</td>
|
||||||
<% if channel.options.outbound && channel.options.outbound.options: %>
|
<td class="<% if channel.status_out is 'ok': %>success<% else if channel.status_out is 'error': %>danger<% else: %>warning<% end %>">
|
||||||
<%= channel.options.outbound.options.user %><br>
|
<%- @T('State') %>: <%- @T(channel.status_out || 'unknown') %><br>
|
||||||
<%= channel.options.outbound.options.host %>
|
<a href="#" data-type="edit-outbound">
|
||||||
<% end %>
|
<% if channel.options.outbound && channel.options.outbound.options: %>
|
||||||
(<%= channel.options.outbound.adapter %>)</a>
|
<%= channel.options.outbound.options.user %><br>
|
||||||
</td>
|
<%= channel.options.outbound.options.host %>
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<% if !_.isEmpty(channel.email_addresses): %>
|
|
||||||
<% for email_address in channel.email_addresses: %>
|
|
||||||
<li data-id="<%= email_address.id %>"><a href="" data-type="email-address-edit"><%= email_address.email %></a>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else: %>
|
(<%= channel.options.outbound.adapter %>)</a>
|
||||||
<li><%- @T('none') %></li>
|
</td>
|
||||||
<% end %>
|
<td>
|
||||||
</ul>
|
<ul>
|
||||||
<a href="#" data-type="email-address-new" title="<%- @Ti('New Email Address') %>"><svg class="icon-trash"><use xlink:href="#icon-plus"></use></svg></a>
|
<% if !_.isEmpty(channel.email_addresses): %>
|
||||||
</td>
|
<% for email_address in channel.email_addresses: %>
|
||||||
<td>
|
<li data-id="<%= email_address.id %>"><a href="" data-type="email-address-edit"><%= email_address.email %></a>
|
||||||
<a href="#" data-type="delete" title="<%- @Ti('Delete') %>"><svg class="icon-trash"><use xlink:href="#icon-trash"></use></svg></a>
|
<% end %>
|
||||||
</td>
|
<% else: %>
|
||||||
</tr>
|
<li><%- @T('none') %></li>
|
||||||
<% if channel.status_in is 'error': %>
|
<% end %>
|
||||||
<tr>
|
</ul>
|
||||||
<td colspan="4"><%= channel.last_log_in %></td>
|
<a href="#" data-type="email-address-new" title="<%- @Ti('New Email Address') %>"><svg class="icon-trash"><use xlink:href="#icon-plus"></use></svg></a>
|
||||||
</tr>
|
</td>
|
||||||
<% end %>
|
<td>
|
||||||
<% if channel.status_out is 'error': %>
|
<a href="#" data-type="delete" title="<%- @Ti('Delete') %>"><svg class="icon-trash"><use xlink:href="#icon-trash"></use></svg></a>
|
||||||
<tr>
|
</td>
|
||||||
<td colspan="4"><%= channel.last_log_out %></td>
|
</tr>
|
||||||
</tr>
|
<% if channel.status_in is 'error': %>
|
||||||
<% end %>
|
<tr>
|
||||||
|
<td colspan="4"><%= channel.last_log_in %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% if channel.status_out is 'error': %>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4"><%= channel.last_log_out %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a data-type="new" class="btn btn--success"><%- @T('New') %></a>
|
<a data-type="new" class="btn btn--success"><%- @T('New') %></a>
|
||||||
|
|
||||||
|
|
|
@ -217,17 +217,25 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
|
||||||
def email_index
|
def email_index
|
||||||
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
||||||
system_online_service = Setting.get('system_online_service')
|
system_online_service = Setting.get('system_online_service')
|
||||||
|
accounts_fixed = []
|
||||||
assets = {}
|
assets = {}
|
||||||
Channel.all.each {|channel|
|
Channel.all.each {|channel|
|
||||||
next if system_online_service && channel.preferences && channel.preferences[:online_service_disable]
|
if system_online_service && channel.preferences && channel.preferences['online_service_disable']
|
||||||
|
email_addresses = EmailAddress.where(channel_id: channel.id)
|
||||||
|
email_addresses.each {|email_address|
|
||||||
|
accounts_fixed.push email_address
|
||||||
|
}
|
||||||
|
next
|
||||||
|
end
|
||||||
assets = channel.assets(assets)
|
assets = channel.assets(assets)
|
||||||
}
|
}
|
||||||
EmailAddress.all.each {|email_address|
|
EmailAddress.all.each {|email_address|
|
||||||
next if system_online_service && email_address.preferences && email_address.preferences[:online_service_disable]
|
next if system_online_service && email_address.preferences && email_address.preferences['online_service_disable']
|
||||||
assets = email_address.assets(assets)
|
assets = email_address.assets(assets)
|
||||||
}
|
}
|
||||||
render json: {
|
render json: {
|
||||||
assets: assets
|
accounts_fixed: accounts_fixed,
|
||||||
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue