diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2017-02-05 21:30:52 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2017-02-05 21:30:52 +0300 |
commit | 4cc0b0de9af58d085f9d2f21b9a1446cee47e354 (patch) | |
tree | 16dd5c8eb819cb81999d081f3c33319f87a8c5fe /interface/js | |
parent | b285d8ff2e352e108807e4d7e0673082d6650883 (diff) | |
download | rspamd-4cc0b0de9af58d085f9d2f21b9a1446cee47e354.tar.gz rspamd-4cc0b0de9af58d085f9d2f21b9a1446cee47e354.zip |
[WebUI] Simplify neighbours table populating
Diffstat (limited to 'interface/js')
-rw-r--r-- | interface/js/app/stats.js | 44 |
1 files changed, 16 insertions, 28 deletions
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('<tr>' + - '<td class="col1" title="Radio"><input type="radio" class="form-control radio" name="clusterName" value="' + key + '" checked></td>' + + '<td class="col1" title="Radio"><input type="radio" class="form-control radio" name="clusterName" value="' + key + '"></td>' + '<td class="col2" title="SNAme">' + key + '</td>' + '<td class="col3" title="SHost">' + val.host + '</td>' + '<td class="col4" title="SStatus"><span class="icon"><i class="' + glyph_status + '"></i></span></td>' + - '<td class="col5" title="SId">' + val.data.config_id.substring(0, 8) + '</td></tr>'); - } else { - if (val.status) { - $('#clusterTable tbody').append('<tr>' + - '<td class="col1" title="Radio"><input type="radio" class="form-control radio" name="clusterName" value="' + key + '"></td>' + - '<td class="col2" title="SNAme">' + key + '</td>' + - '<td class="col3" title="SHost">' + val.host + '</td>' + - '<td class="col4" title="SStatus"><span class="icon"><i class="' + glyph_status + '"></i></span></td>' + - '<td class="col5" title="SId">' + val.data.config_id.substring(0, 8) + '</td></tr>'); - } - else { - $('#clusterTable tbody').append('<tr>' + - '<td class="col1" title="Radio"><input type="radio" class="form-control radio disabled" disabled="disabled" name="clusterName" value="' + key + '"></td>' + - '<td class="col2" title="SNAme">' + key + '</td>' + - '<td class="col3" title="SHost">' + val.host + '</td>' + - '<td class="col4" title="SStatus"><span class="icon"><i class="' + glyph_status + '"></i></span></td>' + - '<td class="col5" title="SId">???</td></tr>'); - } - - } + '<td class="col5" title="short_id">' + short_id + '</td></tr>'); $("#selSrv").append( $('<option value="' + key + '">' + key + '</option>')); + 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(); |