diff options
author | Anna Stakhova <anna@rspamd.com> | 2017-01-10 16:35:11 +0000 |
---|---|---|
committer | Anna Stakhova <anna@rspamd.com> | 2017-01-10 16:35:11 +0000 |
commit | 4879197f2459334fa6e39136776d8ab2a51f98c2 (patch) | |
tree | e44f90365d1ee8d608369696a7ab9250cd7554df /interface | |
parent | 3708605e53640eb4fa2a0267a4755a42b4adc4fa (diff) | |
download | rspamd-4879197f2459334fa6e39136776d8ab2a51f98c2.tar.gz rspamd-4879197f2459334fa6e39136776d8ab2a51f98c2.zip |
[WebUI] clusters for the chart
Diffstat (limited to 'interface')
-rw-r--r-- | interface/js/rspamd.js | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/interface/js/rspamd.js b/interface/js/rspamd.js index be757ce4d..883722a44 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", |