From: Alexander Moisseev Date: Sun, 5 Feb 2017 18:30:52 +0000 (+0300) Subject: [WebUI] Simplify neighbours table populating X-Git-Tag: 1.5.0~172^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4cc0b0de9af58d085f9d2f21b9a1446cee47e354;p=rspamd.git [WebUI] Simplify neighbours table populating --- diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index 632b6a8ab..4010191cf 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -101,47 +101,35 @@ function($, d3pie, Humanize) { $("#selSrv").empty(); $.each(servers, function (key, val) { var glyph_status; + var short_id; + if (!('config_id' in val.data)) { + val.data.config_id = ""; + } if (val.status) { glyph_status = "glyphicon glyphicon-ok-circle"; + short_id = val.data.config_id.substring(0, 8); } else { glyph_status = "glyphicon glyphicon-remove-circle"; + short_id = "???"; } - if (!('config_id' in val.data)) { - val.data.config_id = ""; - } - if (checked_server == key) { + $('#clusterTable tbody').append('' + - '' + + '' + '' + key + '' + '' + val.host + '' + '' + - '' + val.data.config_id.substring(0, 8) + ''); - } else { - if (val.status) { - $('#clusterTable tbody').append('' + - '' + - '' + key + '' + - '' + val.host + '' + - '' + - '' + val.data.config_id.substring(0, 8) + ''); - } - else { - $('#clusterTable tbody').append('' + - '' + - '' + key + '' + - '' + val.host + '' + - '' + - '???'); - } - - } + '' + short_id + ''); $("#selSrv").append( $('')); + if (checked_server == key) { - $('#selSrv [value="' + key + '"]').attr("selected", "selected"); - } else if (!val.status) { - $('#selSrv [value="' + key + '"]').attr("disabled", "disabled"); + $('#clusterTable tbody [value="' + key + '"]').prop("checked", true); + $('#selSrv [value="' + key + '"]').prop("selected", true); + } + else if (!val.status) { + $('#clusterTable tbody [value="' + key + '"]').prop("disabled", true); + $('#selSrv [value="' + key + '"]').prop("disabled", true); } }); $(widgets).show();