diff --git a/README.md b/README.md index 227ca143..c0f490a1 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ Support the project 25. LDAP support 26. Keep active HAProxy service 27. Ability to hide parts of the config with tags for users with "guest" role: "HideBlockStart" and "HideBlockEnd" +28. Mobile-ready desing ![alt text](image/haproxy-wi-metrics.png "Merics") diff --git a/app/funct.py b/app/funct.py index 744be27a..5e2076de 100644 --- a/app/funct.py +++ b/app/funct.py @@ -217,6 +217,7 @@ def get_config(serv, cfg, **kwargs): ssh.close() except Exception as e: ssh = str(e) + logging('localhost', ssh, haproxywi=1) return ssh def diff_config(oldcfg, cfg): @@ -404,6 +405,7 @@ def upload(serv, path, file, **kwargs): ssh = ssh_connect(serv) except Exception as e: error = e + logging('localhost', e, haproxywi=1) pass try: sftp = ssh.open_sftp() @@ -412,6 +414,7 @@ def upload(serv, path, file, **kwargs): ssh.close() except Exception as e: error = e + logging('localhost', e, haproxywi=1) pass return error @@ -451,6 +454,7 @@ def upload_and_restart(serv, cfg, **kwargs): except Exception as e: error += e if error: + logging('localhost', error, haproxywi=1) return error def open_port_firewalld(cfg): diff --git a/app/templates/admin.html b/app/templates/admin.html index b21459cf..2031c689 100644 --- a/app/templates/admin.html +++ b/app/templates/admin.html @@ -146,9 +146,9 @@ {% if group.2 != "None" %} - + {% else %} - + {% endif %} diff --git a/app/templates/ajax/config_show.html b/app/templates/ajax/config_show.html index 21ca8c06..cb37f861 100644 --- a/app/templates/ajax/config_show.html +++ b/app/templates/ajax/config_show.html @@ -52,7 +52,7 @@ {% endif %} {% set backend = line.split(' ') %} - Stats + Stats
{% continue %} @@ -66,7 +66,7 @@ {% endif %} {% set backend = line.split(' ') %} - Stats + Stats
{% continue %} @@ -74,19 +74,35 @@ {% if line.startswith('backend') %}
{{ line }} {% if role %} - - Edit + + Edit {% endif %} {% set backend = line.split(' ') %} - Stats + Stats
{% continue %} {% endif %} {% if line.startswith('cache') %} -
{{ line }}
+
{{ line }} + {% if role %} + + Edit + + {% endif %} +
+ {% continue %} + {% endif %} + {% if line.startswith('peers') %} +
{{ line }} + {% if role %} + + Edit + + {% endif %} +
{% continue %} {% endif %} {% if "acl" in line or "option" in line or "server" in line %} diff --git a/app/templates/ajax/overivewWaf.html b/app/templates/ajax/overivewWaf.html index 629d341d..603295ad 100644 --- a/app/templates/ajax/overivewWaf.html +++ b/app/templates/ajax/overivewWaf.html @@ -13,10 +13,6 @@ {{ service.0 }} - {% if url == "waf.py" %} - - - {% endif %} {% if role <= 1 %} diff --git a/app/templates/ajax/table_metrics.html b/app/templates/ajax/table_metrics.html index 0250e283..6c1b4dd0 100644 --- a/app/templates/ajax/table_metrics.html +++ b/app/templates/ajax/table_metrics.html @@ -10,16 +10,16 @@ Peak connections - 60 minutes + 1 hour 24 hours 3 days - 60 minutes + 1 hour 24 hours 3 days - 60 minutes + 1 hour 24 hours 3 days - 60 minutes + 1 hour 24 hours 3 days diff --git a/app/templates/config.html b/app/templates/config.html index 334282e1..d1a53e5d 100644 --- a/app/templates/config.html +++ b/app/templates/config.html @@ -36,6 +36,10 @@ {% if role <= 2 %} Versions {% endif %} + {% else %} + {% if role <= 2 %} + + {% endif %} {% endif %}

diff --git a/app/templates/metrics.html b/app/templates/metrics.html index d22270bf..4c46b8f9 100644 --- a/app/templates/metrics.html +++ b/app/templates/metrics.html @@ -25,7 +25,6 @@ th, tr, td {
{% endfor %} -
diff --git a/inc/add.js b/inc/add.js index f0ea6f12..01cf3a5a 100644 --- a/inc/add.js +++ b/inc/add.js @@ -354,12 +354,13 @@ $( function() { }); $( "#saved-options" ).autocomplete({ dataType: "json", - source: "sql.py?getoption="+$('#newoptiongroup').val(), + source: "sql.py?getoption="+$('#newoptiongroup').val()+'&token='+$('#token').val(), autoFocus: true, - minLength: -1, + minLength: 1, select: function( event, ui ) { - $("#optionsInput").append(ui.item.value + " \n"); - $( "#saved-options" ).reset(); + $("#optionsInput").append(ui.item.value + " \n"); + $(this).val(''); + $(this).autocomplete( "close" ); } }); $( "#options1" ).autocomplete({ @@ -372,12 +373,13 @@ $( function() { }); $( "#saved-options1" ).autocomplete({ dataType: "json", - source: "sql.py?getoption="+$('#newoptiongroup').val(), + source: "sql.py?getoption="+$('#newoptiongroup').val()+'&token='+$('#token').val(), autoFocus: true, - minLength: -1, + minLength: 1, select: function( event, ui ) { $("#optionsInput1").append(ui.item.value + " \n"); - $( "#options1" ).reset(); + $(this).val(''); + $(this).autocomplete( "close" ); } }); $( "#options2" ).autocomplete({ @@ -390,12 +392,13 @@ $( function() { }); $( "#saved-options2" ).autocomplete({ dataType: "json", - source: "sql.py?getoption="+$('#newoptiongroup').val(), + source: "sql.py?getoption="+$('#newoptiongroup').val()+'&token='+$('#token').val(), autoFocus: true, - minLength: -1, + minLength: 1, select: function( event, ui ) { $("#optionsInput2").append(ui.item.value + " \n"); - $( "#saved-options2" ).reset(); + $(this).val(''); + $(this).autocomplete( "close" ); } }); $('#add-option-button').click(function() { diff --git a/inc/script.js b/inc/script.js index 43cc24a1..4cfce169 100644 --- a/inc/script.js +++ b/inc/script.js @@ -265,6 +265,8 @@ function showOverviewWaf() { $.getScript('/inc/waf.js'); $( "input[type=submit], button" ).button(); $( "input[type=checkbox]" ).checkboxradio(); + } else { + $('.first-collumn-wi').css('padding', '15px'); } } } ); diff --git a/inc/style.css b/inc/style.css index a6d8a351..f9daf602 100644 --- a/inc/style.css +++ b/inc/style.css @@ -21,7 +21,7 @@ h2 { color: #fff; margin-top: 0px; margin-bottom: 0px; - width: 99% + width: 98.9%; } h3 { margin-top: -0; @@ -30,6 +30,7 @@ h3 { padding: 0.3em; font-size: 1.6em; border-bottom: 1px solid #ddd; + width: 100.43%; } form { margin: 0; @@ -78,7 +79,7 @@ pre { .container { min-height: calc(99vh - 50px); height: auto; - max-width: 91%; + max-width: 100%; min-width: 40%; background-color: #fff; margin-left: 207px; @@ -328,24 +329,14 @@ pre { padding-left: 10px; font-style: italic; } -/* .tooltip { */ - /* font-size: 12px; */ - /* padding-bottom: 10px; */ -/* } */ -/* .tooltipTop { */ - /* margin-bottom: -20px; */ - /* padding-top: 10px; */ -/* } */ .overview { width: 100%; - /* margin-top: 1.5em; */ } .overview-wi { width: 46%; - min-width: 600px; + min-width: 566px ; max-width: 50%; - /* border: 1px solid #A4C7F5; */ - height: 160px; + min-height: 160px; float: left; margin: 20px; } @@ -629,8 +620,8 @@ a:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } -.logs_link { - color: #23527c; +.logs_link, .accordion-link { + color: #23527c !important; } table { border-spacing: 0; @@ -809,7 +800,7 @@ label { } .chart-container { position: relative; - height: 310px; + height: 400px; width: 49%; float: left; margin-top: 20px; @@ -818,11 +809,34 @@ label { @media (max-width: 1920px) { #logo_span { margin-left: 17%; + } +} +@media (max-width: 1080px) { + #logo_span { + margin-left: -5%; + } + .chart-container { + position: relative; + height: 410px; + width: 95%; + } + .overview-wi { + width: 95%; + max-width: 95%; } } @media (max-width: 1024px) { - #logo_span { - margin-left: -5%; + #logo_span { + margin-left: -5%; + } + .chart-container { + position: relative; + height: 410px; + width: 95%; + } + .overview-wi { + width: 95%; + max-width: 95%; } } @media (max-width: 667px) { @@ -830,10 +844,28 @@ label { margin-left: -12%; border: none; } + .chart-container { + position: relative; + height: 410px; + width: 95%; + } + .overview-wi { + width: 95%; + max-width: 95%; + } } @media (max-width: 768px) { #logo_span { margin-left: -12%; border: none; } + .chart-container { + position: relative; + height: 410px; + width: 95%; + } + .overview-wi { + width: 95%; + max-width: 95%; + } }