From: Anna Stakhova Date: Tue, 10 Jan 2017 16:35:11 +0000 (+0000) Subject: [WebUI] clusters for the chart X-Git-Tag: 1.5.0~380^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1333%2Fhead;p=thirdparty%2Frspamd.git [WebUI] clusters for the chart --- diff --git a/interface/js/rspamd.js b/interface/js/rspamd.js index be757ce4d6..883722a447 100644 --- a/interface/js/rspamd.js +++ b/interface/js/rspamd.js @@ -492,6 +492,7 @@ $(document).on('click', 'input:radio[name="clusterName"]', function (e) { checked_server = this.value; statWidgets(); + getChart(); }); // @opem modal with target form enabled @@ -516,21 +517,32 @@ $('#modalBody form').hide(); }); +// function getChart() { +// $.ajax({ +// dataType: 'json', +// type: 'GET', +// url: 'pie', +// jsonp: false, +// beforeSend: function (xhr) { +// xhr.setRequestHeader('Password', getPassword()); +// }, +// success: function (data) { +// console.log(data); +// pie = drawPie(pie, "chart", data); +// } +// }); +// } + function getChart() { - $.ajax({ - dataType: 'json', - type: 'GET', - url: 'pie', - jsonp: false, - beforeSend: function (xhr) { - xhr.setRequestHeader('Password', getPassword()); - }, - success: function (data) { - pie = drawPie(pie, "chart", data); - } - }); + var data = JSON.parse(sessionStorage.getItem('Credentials'))[checked_server].data; + var new_data = [{"color":"#66cc00","label":"Clean","data":data.clean,"value":data.clean}, + {"color":"#cc9966","label":"Temporary rejected","data":data.learned,"value":data.learned}, + {"color":"#FFD700","label":"Probable spam","data":data.probable,"value":data.probable}, + {"color":"#436EEE","label":"Greylisted","data":data.greylist,"value":data.greylist}, + {"color":"#FF0000","label":"Rejected","data":data.rejected,"value":data.rejected}]; + pie = drawPie(pie, "chart", new_data); } - + function drawPie(obj, id, data, conf) { if (obj) { obj.updateProp("data.content",