-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/bootstrap5' into nightly
- Loading branch information
Showing
28 changed files
with
426 additions
and
277 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
jQuery(function($){ | ||
|
||
$(".refresh_table").on('click', function(e) { | ||
e.preventDefault(); | ||
var table_name = $(this).data('table'); | ||
$('#' + table_name).DataTable().ajax.reload(); | ||
}); | ||
|
||
// Queue item | ||
$('#showQueuedMsg').on('show.bs.modal', function (e) { | ||
$('#queue_msg_content').text(lang.loading); | ||
button = $(e.relatedTarget) | ||
if (button != null) { | ||
$('#queue_id').text(button.data('queue-id')); | ||
} | ||
$.ajax({ | ||
type: 'GET', | ||
url: '/api/v1/get/postcat/' + button.data('queue-id'), | ||
dataType: 'text', | ||
complete: function (data) { | ||
$('#queue_msg_content').text(data.responseText); | ||
} | ||
}); | ||
}) | ||
|
||
function draw_queue() { | ||
// just recalc width if instance already exists | ||
if ($.fn.DataTable.isDataTable('#queuetable') ) { | ||
$('#queuetable').DataTable().columns.adjust().responsive.recalc(); | ||
return; | ||
} | ||
|
||
$('#queuetable').DataTable({ | ||
processing: true, | ||
serverSide: false, | ||
language: lang_datatables, | ||
ajax: { | ||
type: "GET", | ||
url: "/api/v1/get/mailq/all", | ||
dataSrc: function(data){ | ||
$.each(data, function (i, item) { | ||
item.chkbox = '<input type="checkbox" data-id="mailqitems" name="multi_select" value="' + item.queue_id + '" />'; | ||
rcpts = $.map(item.recipients, function(i) { | ||
return escapeHtml(i); | ||
}); | ||
item.recipients = rcpts.join('<hr style="margin:1px!important">'); | ||
item.action = '<div class="btn-group">' + | ||
'<a href="#" data-bs-toggle="modal" data-bs-target="#showQueuedMsg" data-queue-id="' + encodeURI(item.queue_id) + '" class="btn btn-xs btn-secondary">' + lang.queue_show_message + '</a>' + | ||
'</div>'; | ||
}); | ||
return data; | ||
} | ||
}, | ||
columns: [ | ||
{ | ||
// placeholder, so checkbox will not block child row toggle | ||
title: '', | ||
data: null, | ||
searchable: false, | ||
orderable: false, | ||
defaultContent: '' | ||
}, | ||
{ | ||
title: '', | ||
data: 'chkbox', | ||
searchable: false, | ||
orderable: false, | ||
defaultContent: '' | ||
}, | ||
{ | ||
title: 'QID', | ||
data: 'queue_id', | ||
defaultContent: '' | ||
}, | ||
{ | ||
title: 'Queue', | ||
data: 'queue_name', | ||
defaultContent: '' | ||
}, | ||
{ | ||
title: lang.arrival_time, | ||
data: 'arrival_time', | ||
defaultContent: '', | ||
render: function (data, type){ | ||
var date = new Date(data ? data * 1000 : 0); | ||
return date.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"}); | ||
} | ||
}, | ||
{ | ||
title: lang.message_size, | ||
data: 'message_size', | ||
defaultContent: '', | ||
render: function (data, type){ | ||
return humanFileSize(data); | ||
} | ||
}, | ||
{ | ||
title: lang.sender, | ||
data: 'sender', | ||
defaultContent: '' | ||
}, | ||
{ | ||
title: lang.recipients, | ||
data: 'recipients', | ||
defaultContent: '' | ||
}, | ||
{ | ||
title: lang.action, | ||
data: 'action', | ||
className: 'text-md-end dt-sm-head-hidden dt-body-right', | ||
defaultContent: '' | ||
}, | ||
] | ||
}); | ||
} | ||
|
||
draw_queue(); | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.