Skip to content

Commit

Permalink
Fixed queue message error
Browse files Browse the repository at this point in the history
  • Loading branch information
DerLinkman committed Oct 18, 2022
1 parent e5d7884 commit 75fdeb2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion data/Dockerfiles/dockerapi/dockerapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ async def container_post__exec__mailq__cat(self, container_id, request_json):
for container in (await self.docker_client.containers.list()):
if container._id == container_id:
postcat_exec = await container.exec(["/bin/bash", "-c", "/usr/sbin/postcat -q " + sanitized_string], user='postfix')
return exec_run_handler('utf8_text_only', postcat_exec)
return await exec_run_handler('utf8_text_only', postcat_exec)

# api call: container_post - post_action: exec - cmd: mailq - task: unhold
async def container_post__exec__mailq__unhold(self, container_id, request_json):
Expand Down
14 changes: 9 additions & 5 deletions data/web/js/site/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ jQuery(function($){
$('#' + table_name).DataTable().ajax.reload();
});


function humanFileSize(i){if(Math.abs(i)<1024)return i+" B";var B=["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],e=-1;do{i/=1024,++e}while(Math.abs(i)>=1024&&e<B.length-1);return i.toFixed(1)+" "+B[e]}

// Queue item
$('#showQueuedMsg').on('show.bs.modal', function (e) {
$('#queue_msg_content').text(lang.loading);
Expand All @@ -18,6 +21,7 @@ jQuery(function($){
url: '/api/v1/get/postcat/' + button.data('queue-id'),
dataType: 'text',
complete: function (data) {
console.log(data);
$('#queue_msg_content').text(data.responseText);
}
});
Expand Down Expand Up @@ -78,7 +82,7 @@ jQuery(function($){
defaultContent: ''
},
{
title: lang.arrival_time,
title: lang_admin.arrival_time,
data: 'arrival_time',
defaultContent: '',
render: function (data, type){
Expand All @@ -87,25 +91,25 @@ jQuery(function($){
}
},
{
title: lang.message_size,
title: lang_admin.message_size,
data: 'message_size',
defaultContent: '',
render: function (data, type){
return humanFileSize(data);
}
},
{
title: lang.sender,
title: lang_admin.sender,
data: 'sender',
defaultContent: ''
},
{
title: lang.recipients,
title: lang_admin.recipients,
data: 'recipients',
defaultContent: ''
},
{
title: lang.action,
title: lang_admin.action,
data: 'action',
className: 'text-md-end dt-sm-head-hidden dt-body-right',
defaultContent: ''
Expand Down
1 change: 1 addition & 0 deletions data/web/queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'acl_json' => json_encode($_SESSION['acl']),
'role' => $role,
'lang_admin' => json_encode($lang['admin']),
'lang_queue' => json_encode($lang['queue']),
'lang_datatables' => json_encode($lang['datatables'])
];

Expand Down
14 changes: 0 additions & 14 deletions data/web/templates/modals/admin.twig
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,6 @@
</div>
</div>
</div><!-- test transport modal -->
<!-- show queue item modal -->
<div class="modal fade" id="showQueuedMsg" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><i class="bi bi-card-checklist" style="font-size:18px"></i> ID <span id="queue_id"></span></h3>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<textarea class="form-control" id="queue_msg_content" name="content" rows="40"></textarea>
</div>
</div>
</div>
</div><!-- show queue item modal -->
<!-- priv key modal -->
<div class="modal fade" id="showDKIMprivKey" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
Expand Down
14 changes: 14 additions & 0 deletions data/web/templates/modals/queue.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- show queue item modal -->
<div class="modal fade" id="showQueuedMsg" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><i class="bi bi-card-checklist" style="font-size:18px"></i> ID <span id="queue_id"></span></h3>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<textarea class="form-control" id="queue_msg_content" name="content" rows="40"></textarea>
</div>
</div>
</div>
</div><!-- show queue item modal -->
5 changes: 4 additions & 1 deletion data/web/templates/queue.twig
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@
</div>
</div>

{% include 'modals/queue.twig' %}

<script type='text/javascript'>
var lang = {{ lang_admin|raw }};
var lang_admin = {{ lang_admin|raw }};
var lang = {{ lang_queue|raw }};
var lang_datatables = {{ lang_datatables|raw }};
var csrf_token = '{{ csrf_token }}';
var pagination_size = '{{ pagination_size }}';
Expand Down

0 comments on commit 75fdeb2

Please sign in to comment.