You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haproxy-wi/app/templates/ajax/overivewWaf.html

94 lines
3.4 KiB

{% for service in service_status %}
{% if service.3 == "On" or service.3 == "Off" or service.3 == "DetectionOnly" %}
<td class="padding10 first-collumn-wi">
{% if service.2|int() >= 1 %}
<span class="serverUp server-status" title="running {{service.2 }} processes"></span>
{% else %}
<span class="serverDown server-status"></span>
{% endif %}
<a href="/app/logs.py?serv={{ service.1 }}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00&waf=1" title="View {{service.0 }}'s WAF logs" class="logs_link">
{{ service.0 }}
</a>
</td>
<td>
{% if role <= 2 %}
<a id="{{ service.1 }}" class="start-waf" title="Start WAF service">
<span class="service-start" onclick="confirmAjaxAction('start', 'waf', '{{service.1}}')"></span>
</a>
<a id="{{ service.1 }}" class="stop-waf" title="Stop WAF service">
<span class="service-stop" onclick="confirmAjaxAction('stop', 'waf', '{{service.1}}')"></span>
</a>
<a id="{{ service.1 }}" class="restart-waf" title="Restart WAF service">
<span class="service-reload" onclick="confirmAjaxAction('restart', 'restart', '{{service.1}}')"></span>
</a>
{% endif %}
</td>
<td>
{% if role <= 2 %}
{% if service.3 == "On" or service.3 == "Off" or service.3 == "DetectionOnly" %}
<select class="waf_mode" id="{{ service.0 }}_select">
{% set waf_modes = [] %}
{% do waf_modes.append("On") %}
{% do waf_modes.append("Off") %}
{% do waf_modes.append("DetectionOnly") %}
{% for waf_mode in waf_modes %}
{% if service.3 == waf_mode %}
<option value={{waf_mode}} selected="selected">{{waf_mode}}</option>
{% else %}
<option value={{waf_mode}}>{{waf_mode}}</option>
{% endif %}
{% endfor %}
</select>
{%else %}
<a title="Install WAF"><button onclick="installWaf('{{ service.1 }}')">Install</button></a>
{% endif %}
{% else %}
{{ service.3 }}
{% endif %}
</td>
<td style="padding-top: 2px;" class="ajaxwafstatus">
{% if service.3 == "On" or service.3 == "Off" or service.3 == "DetectionOnly" %}
{% if service.4|int() == 1 %}
<label for="metrics{{ service.0 }}"></label><input type="checkbox" id="metrics{{ service.0 }}" checked />
{% else %}
<label for="metrics{{ service.0 }}"></label><input type="checkbox" id="metrics{{ service.0 }}" />
{% endif %}
{% endif %}
</td>
<td>
{% if role <= 2 %}
{% if service.3 == "On" or service.3 == "Off" or service.3 == "DetectionOnly" %}
<a href="/app/waf.py?manage_rules=1&serv={{service.1}}" class="ui-button ui-widget ui-corner-all">Open</a>
{% endif %}
{% endif %}
</td>
<td></td>
{% else %}
<td class="padding10 first-collumn-wi">
<span class="serverDown server-status"></span> {{ service.0 }}
</td>
{% if role <= 2 %}
<td>
<a title="Install WAF"><button onclick="installWaf('{{ service.1 }}')">Install</button></a>
</td>
{% endif %}
{% endif %}
{% endfor %}
<script>
{% if role <= 2 %}
$( "select" ).selectmenu();
$( "input[type=checkbox]" ).checkboxradio();
$( ".waf_mode" ).on('selectmenuchange',function() {
var id = $(this).attr('id');
changeWafMode(id)
});
$( ".ajaxwafstatus input" ).change(function() {
var id = $(this).attr('id');
metrics_waf(id);
});
{% endif %}
</script>
<style>
.ui-selectmenu-button.ui-button {width: 10em;}
.fa-play, .fa-stop, .fa-sync-alt { margin-bottom: -1px; }
</style>