]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Avoid extra graph redraw and alerts glitching
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 14 Jan 2017 12:26:40 +0000 (12:26 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 14 Jan 2017 12:26:40 +0000 (12:26 +0000)
interface/js/rspamd.js

index cef69604f14160fe39fc7bef4696b5eb797bc86e..647f088d12d9fe534925adee89baaec3e8cc17d8 100644 (file)
                     timer_id.status = Visibility.every(10000, function () {
                         statWidgets();
                     });
-                    getChart();
                     break;
                 case "#throughput_nav":
                     getGraphData(selData);
                             host: neighbours[ind].host,
                             checked: false,
                             data: {},
-                            status: false
+                            status: false,
                         });
                     });
                     $.each(neighbours_status, function (ind) {
                             url: neighbours_status[ind].url + req_url,
                             success: function (data) {
                                 neighbours_status[ind].checked = true;
+
                                 if (jQuery.isEmptyObject(data)) {
                                     neighbours_status[ind].status = false; //serv does not work
                                 } else {
                                     on_error(neighbours_status[ind],
                                             jqXHR, textStatus, errorThrown);
                                 }
-                                if (neighbours_status.every(function (elt) {return elt.checked;})) {
+                                if (neighbours_status.every(
+                                        function (elt) {return elt.checked;})) {
                                     on_success(neighbours_status);
                                 }
                             }
                 var status_count = 0;
                 for(var e in neighbours_status) {
                     if(neighbours_status[e].status == true) {
+                        // Remove alert status
+                        localStorage.removeItem(e + '_alerted');
                         neighbours_sum.clean += neighbours_status[e].data.clean;
                         neighbours_sum.probable += neighbours_status[e].data.probable;
                         neighbours_sum.greylist += neighbours_status[e].data.greylist;
                 getChart();
             },
             function (serv, jqXHR, textStatus, errorThrown) {
-                alertMessage('alert-error', 'Cannot receive stats data from: ' +
+                var alert_status = serv.name + '_alerted';
+
+                if (!(alert_status in sessionStorage)) {
+                    sessionStorage.setItem(alert_status, true);
+                    alertMessage('alert-error', 'Cannot receive stats data from: ' +
                         serv.name + ', error: ' + errorThrown);
+                }
             });
         }
 
             if (!this.disabled) {
                 checked_server = this.value;
                 statWidgets();
-                getChart();
             }
         });