[Web] Fix symbol options encoding in rspamd item view

[Web] Feature: Allow to view mailq item content via postcat
[Web] Fix Rspamd not drawing
This commit is contained in:
andryyy
2020-05-19 20:20:05 +02:00
parent 3ccc9c07c1
commit 21a153c2a7
9 changed files with 153 additions and 94 deletions

View File

@@ -248,6 +248,7 @@ jQuery(function($){
}},
{"name":"sender","title":lang.sender, "type": "text","breakpoints":"xs sm"},
{"name":"recipients","title":lang.recipients, "type": "text","style":{"word-break":"break-all","min-width":"300px"},"breakpoints":"xs sm md"},
{"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"220px","width":"220px"},"type":"html","title":lang.action,"breakpoints":"xs sm md"}
],
"rows": $.ajax({
dataType: 'json',
@@ -301,6 +302,9 @@ jQuery(function($){
return escapeHtml(i);
});
item.recipients = rcpts.join('<hr style="margin:1px!important">');
item.action = '<div class="btn-group">' +
'<a href="#" data-toggle="modal" data-target="#showQueuedMsg" data-queue-id="' + encodeURI(item.queue_id) + '" class="btn btn-xs btn-default">' + lang.queue_show_message + '</a>' +
'</div>';
});
} else if (table == 'forwardinghoststable') {
$.each(data, function (i, item) {
@@ -413,6 +417,22 @@ jQuery(function($){
$('#transport_type').val(button.data('transport-type'));
}
})
// Queue item
$('#showQueuedMsg').on('show.bs.modal', function (e) {
$('#queue_msg_content').text("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);
}
});
})
$('#test_transport').on('click', function (e) {
e.preventDefault();
prev = $('#test_transport').text();

View File

@@ -404,7 +404,7 @@ jQuery(function($){
function rspamd_pie_graph() {
$.ajax({
url: '/api/v1/get/rspamd/actions',
async: false,
async: true,
success: function(data){
var total = 0;
@@ -438,17 +438,25 @@ jQuery(function($){
}
}
};
var chartcanvas = document.getElementById('rspamd_donut');
Chart.plugins.register('ChartDataLabels');
var chart = new Chart(chartcanvas.getContext("2d"), {
plugins: [ChartDataLabels],
type: 'doughnut',
data: graphdata,
options: options
});
if(typeof chart == 'undefined') {
chart = new Chart(chartcanvas.getContext("2d"), {
plugins: [ChartDataLabels],
type: 'doughnut',
data: graphdata,
options: options
});
}
else {
chart.destroy();
chart = new Chart(chartcanvas.getContext("2d"), {
plugins: [ChartDataLabels],
type: 'doughnut',
data: graphdata,
options: options
});
}
}
});
}
@@ -534,7 +542,7 @@ jQuery(function($){
}
var str = '<strong>' + key + '</strong> ' + sym.score_formatted;
if (sym.options) {
str += ' [' + sym.options.join(", ") + "]";
str += ' [' + escapeHtml(sym.options.join(", ")) + "]";
}
return str
}).join('<br>\n');
@@ -703,7 +711,7 @@ jQuery(function($){
draw_rspamd_history();
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href");
if ((target == '#tab-rspamd-history')) {
if (target == '#tab-rspamd-history') {
rspamd_pie_graph();
}
});