]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[WebUI] Fix disabled state
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 10 Jan 2017 17:40:49 +0000 (17:40 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 10 Jan 2017 17:40:49 +0000 (17:40 +0000)
interface/js/rspamd.js

index 2421e7cbe395f9c76f8fc5e904a7243d44056400..c414ccbf1971eb3f6b10a69549ceaf88393b1876 100644 (file)
           $("#clusterTable tbody").empty();
           $.each(servers, function (key, val) {
               var glyph_status;
-              if (val.status) {glyph_status = "glyphicon glyphicon-ok-circle"} else {glyph_status = "glyphicon glyphicon-remove-circle"}
+              if (val.status) {
+                  glyph_status = "glyphicon glyphicon-ok-circle";
+              }
+              else {
+                  glyph_status = "glyphicon glyphicon-remove-circle";
+              }
               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="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" 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>');
+                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>');
+                }
 
               }
           });
         }
 
         $(document).on('click', 'input:radio[name="clusterName"]', function (e) {
-            checked_server = this.value;
-            statWidgets();
-            getChart();
+            if (!this.disabled) {
+                checked_server = this.value;
+                statWidgets();
+                getChart();
+            }
         });
 
         // @opem modal with target form enabled