Pavel Loginov 4 years ago
parent 874de47458
commit 2e8267d1c8

@ -113,66 +113,7 @@
</div>
</div>
<div id="servers">
<table class="overview" id="ajax-servers">
<thead>
<tr class="overviewHead">
<th class="padding10 first-collumn">Hostname</th>
<th class="ip-field" style="width: 5%">IP</th>
<th class="checkbox-head" style="width: 5%"><span title="SSH port">Port</span></th>
<th class="group-field" style="width: 10%">Group</th>
<th class="checkbox-head" style="width: 5%">Enabled</th>
<th class="checkbox-head" style="width: 5%">
<span title="Virtual IP, something like VRRP">Virt</span>
</th>
<th class="checkbox-head" style="width: 5%">HAProxy</th>
<th class="checkbox-head" style="width: 5%">Nginx</th>
<th class="slave-field" style="width: 10%">
<span title="Actions with the master config will automatically apply on the slave">Slave for</span>
</th>
<th class="cred-field" style="width: 15%">Credentials</th>
<th style="width: 100%">Description</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for server in servers %}
<tr id="server-{{server.0}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn">
{% set id = 'hostname-' + server.0|string() %}
{{ input(id, value=server.1, size='10') }}
</td>
<td>
<span id="ip-{{server.0}}" style="margin-right: 6px;">{{server.2}}</span>
</td>
<td>
{% set id = 'port-' + server.0|string() %}
{{ input(id, value=server.10, size='2') }}
</td>
<td>
<select id="servergroup-{{server.0}}" name="servergroup-{{server.0}}">
<option disabled selected>Choose group</option>
{% for group in groups %}
{% if server.3 == group.0|string() %}
<option value="{{ group.0 }}" selected>{{ group.1 }}</option>
{% else %}
<option value="{{ group.0 }}">{{ group.1 }}</option>
{% endif %}
{% endfor %}
</select>
</td>
{% include 'include/admin_servers.html' %}
</tr>
{% endfor %}
</tbody>
</table>
<br /><span class="add-button" title="Add server" id="add-server-button">+ Add</span>
<br /><br />
<div id="checkSshConnect"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=servers" title="Servers description" target="_blank">here</a>
or watch video <a href="https://haproxy-wi.org/description.py?description=setup" title="How to setup servers, group and SSH credentials" target="_blank">here</a>
</div>
{% include 'include/admin_servers.html' %}
</div>
<div id="ssh">

@ -1,31 +1,5 @@
{% for server in servers %}
<tr id="server-{{server.0}}" class="newserver">
<td class="padding10 first-collumn" style="padding-top: 20px;">
<input type="text" id="hostname-{{server.0}}" value="{{server.1}}" class="form-control">
</td>
<td>
<span id="ip-{{server.0}}" style="margin-right: 6px;">{{server.2}}</span>
{% if page == "servers.py" %}
<input type="hidden" id="servergroup-{{server.0}}" name="servergroup-{{server.0}}" value="" >
{% endif %}
</td>
<td>
<input type="text" id="port-{{server.0}}" value="{{server.10}}" size="1" class="form-control">
</td>
{% if page != "servers.py" %}
<td>
<select id="servergroup-{{server.0}}" name="servergroup-{{server.0}}">
<option disabled selected>Choose group</option>
{% for group in groups %}
{% if server.3 == group.0|string() %}
<option value="{{ group.0 }}" selected>{{ group.1 }}</option>
{% else %}
<option value="{{ group.0 }}">{{ group.1 }}</option>
{% endif %}
{% endfor %}
</select>
{% endif %}
{% include 'include/admin_servers.html' %}
{% include 'include/admin_servers.html' %}
<script>
$( function() {
{% if page != "servers.py" %}

@ -73,7 +73,7 @@
</li>
<li class="p_menu">
<a title="Actions with Nginx" class="nginx">Nginx</a>
<a title="Actions with Nginx" class="nginx-menu">Nginx</a>
<ul class="v_menu">
<li><a href="/app/hapservers.py?service=nginx" title="Overview Nginx servers" class="overview-link head-submenu">Overview</a> </li>
<li><a href="/app/config.py?service=nginx" title="Working with Nginx configs" class="edit head-submenu">Configs</a></li>
@ -111,7 +111,7 @@
<li><a href="/app/servers.py#servers" title="Servers: Manage servers - HAProxy-WI" class="runtime head-submenu">Servers</a></li>
<li><a href="/app/servers.py#ssh" title="Servers: Manage SSH credentials - HAProxy-WI" class="admin head-submenu">SSH credentials</a></li>
<li><a href="/app/servers.py#settings" title="Servers: Manage HAProxy-WI settings - HAProxy-WI" class="settings head-submenu">Settings</a></li>
<li><a href="/app/servers.py#installproxy" title="Servers: Proxy service installation - HAProxy-WI" class="hap head-submenu">Proxy installation</a> </li>
<li><a href="/app/servers.py#installproxy" title="Servers: Proxy service installation - HAProxy-WI" class="hap-menu head-submenu">Proxy installation</a> </li>
<li><a href="/app/servers.py#installmon" title="Servers: Monitoring service installation - HAProxy-WI" class="hap1 head-submenu">Monitoring installation</a> </li>
<li><a href="/app/viewlogs.py?type=2" title="Servers: View internal logs - HAProxy-WI" class="logs head-submenu">Internal logs</a></li>
<li><a href="/app/servers.py#backup" title="Servers: Backup configs - HAProxy-WI" class="backup head-submenu">Backups</a> </li>

@ -1,74 +1,143 @@
{% from 'include/input_macros.html' import input, checkbox %}
<td class="checkbox">
{% set id = 'enable-' + server.0|string() %}
{% if server.5 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
</td>
<td class="checkbox" style="padding-left: 0px;">
{% set id = 'typeip-' + server.0|string() %}
{% if server.4 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
</td>
<td class="checkbox">
{% set id = 'haproxy-' + server.0|string() %}
{% if server.15 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
</td>
<td class="checkbox">
{% set id = 'nginx-' + server.0|string() %}
{% if server.14 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
</td>
<td>
<select id="slavefor-{{server.0}}">
<option value="0" selected>Not slave</option>
{% for master in masters %}
{% if master.0 == server.6 %}
<option value="{{master.0}}" selected>{{master.1}}</option>
{% if not adding %}
<table class="overview" id="ajax-servers">
<thead>
<tr class="overviewHead">
<th class="padding10 first-collumn">Hostname</th>
<th class="ip-field" style="width: 5%">IP</th>
<th class="checkbox-head" style="width: 5%"><span title="SSH port">Port</span></th>
{% if page != "servers.py" %}
<th class="group-field" style="width: 10%">Group</th>
{% endif %}
<th class="checkbox-head" style="width: 5%">Enabled</th>
<th class="checkbox-head" style="width: 5%">
<span title="Virtual IP, something like VRRP">Virt</span>
</th>
<th class="checkbox-head" style="width: 5%">HAProxy</th>
<th class="checkbox-head" style="width: 5%">Nginx</th>
<th class="slave-field" style="width: 10%">
<span title="Actions with the master config will automatically apply on the slave">Slave for</span>
</th>
<th class="cred-field" style="width: 15%">Credentials</th>
<th style="width: 100%">Description</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% endif %}
{% for server in servers %}
<tr id="server-{{server.0}}" class="{{ loop.cycle('odd', 'even') }} {% if adding %}newserver{% endif %}">
<td class="padding10 first-collumn">
{% set id = 'hostname-' + server.0|string() %}
{{ input(id, value=server.1, size='10') }}
</td>
<td>
<span id="ip-{{server.0}}" style="margin-right: 6px;">{{server.2}}</span>
</td>
<td>
{% set id = 'port-' + server.0|string() %}
{{ input(id, value=server.10, size='2') }}
</td>
{% if page != "servers.py" %}
<td>
<select id="servergroup-{{server.0}}" name="servergroup-{{server.0}}">
<option disabled selected>Choose group</option>
{% for group in groups %}
{% if server.3 == group.0|string() %}
<option value="{{ group.0 }}" selected>{{ group.1 }}</option>
{% else %}
<option value="{{ group.0 }}">{{ group.1 }}</option>
{% endif %}
{% endfor %}
</select>
</td>
{% else %}
<option value="{{master.0}}">{{master.1}}</option>
<input type="hidden" id="servergroup-{{server.0}}" name="servergroup-{{server.0}}" value="{{ group }}" />
{% endif %}
{% endfor %}
</select>
</td>
<td>
<div class="controlgroup">
<select id="credentials-{{server.0}}">
<option disabled selected>Choose credentials</option>
{% for ssh in sshs %}
{% if ssh.0 == server.7 %}
<option value="{{ssh.0}}" selected>{{ssh.1}}</option>
<td class="checkbox">
{% set id = 'enable-' + server.0|string() %}
{% if server.5 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
</td>
<td class="checkbox" style="padding-left: 0px;">
{% set id = 'typeip-' + server.0|string() %}
{% if server.4 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
</td>
<td class="checkbox">
{% set id = 'haproxy-' + server.0|string() %}
{% if server.15 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
<option value="{{ssh.0}}">{{ssh.1}}</option>
{{ checkbox(id) }}
{% endif %}
{% endfor %}
</select>
<button onclick="checkSshConnect('{{server.2}}')" title="Check SSH connect to the server {{server.1}}">check</button>
</div>
</td>
<td>
{% set id = 'desc-' + server.0|string() %}
{% if server.11 != "None" %}
{{ input(id, value=server.11, size='20') }}
{% else %}
{{ input(id, size='20') }}
{% endif %}
</td>
<td>
<a class="add" onclick="cloneServer({{server.0}})" id="clone-{{server.0}}" title="Clone {{server.1}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteServer({{server.0}})" title="Delete server {{server.1}}" style="cursor: pointer;"></a>
</td>
</td>
<td class="checkbox">
{% set id = 'nginx-' + server.0|string() %}
{% if server.14 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
</td>
<td>
<select id="slavefor-{{server.0}}">
<option value="0" selected>Not slave</option>
{% for master in masters %}
{% if master.0 == server.6 %}
<option value="{{master.0}}" selected>{{master.1}}</option>
{% else %}
<option value="{{master.0}}">{{master.1}}</option>
{% endif %}
{% endfor %}
</select>
</td>
<td>
<div class="controlgroup">
<select id="credentials-{{server.0}}">
<option disabled selected>Choose credentials</option>
{% for ssh in sshs %}
{% if ssh.0 == server.7 %}
<option value="{{ssh.0}}" selected>{{ssh.1}}</option>
{% else %}
<option value="{{ssh.0}}">{{ssh.1}}</option>
{% endif %}
{% endfor %}
</select>
<button onclick="checkSshConnect('{{server.2}}')" title="Check SSH connect to the server {{server.1}}">check</button>
</div>
</td>
<td>
{% set id = 'desc-' + server.0|string() %}
{% if server.11 != "None" %}
{{ input(id, value=server.11, size='20') }}
{% else %}
{{ input(id, size='20') }}
{% endif %}
</td>
<td>
<a class="add" onclick="cloneServer({{server.0}})" id="clone-{{server.0}}" title="Clone {{server.1}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteServer({{server.0}})" title="Delete server {{server.1}}" style="cursor: pointer;"></a>
</td>
</tr>
{% endfor %}
{% if not adding %}
</tbody>
</table>
<br /><span class="add-button" title="Add server" id="add-server-button">+ Add</span>
<br /><br />
<div id="checkSshConnect"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=servers" title="Servers description" target="_blank">here</a>
or watch video <a href="https://haproxy-wi.org/description.py?description=setup" title="How to setup servers, group and SSH credentials" target="_blank">here</a>
</div>
{% endif %}

@ -68,54 +68,7 @@
</div>
<div id="servers">
<table class="overview" id="ajax-servers">
<tr class="overviewHead">
<th class="padding10 first-collumn" style="width: 15%">Hostname</th>
<th class="ip-field" style="width: 10%">IP</th>
<th class="checkbox-head" style="width: 5%">
<span title="SSH port">Port</span>
</th>
<th class="checkbox-head" style="width: 5%">Enable</th>
<th class="checkbox-head" style="width: 5%">
<span title="Virtual IP, something like VRRP">Virt</span>
</th>
<th class="checkbox-head" style="width: 5%">HAProxy</th>
<th class="checkbox-head" style="width: 5%">Nginx</th>
<th class="slave-field" style="width: 10%">
<span title="Actions with master config will automatically apply on slave">Slave for</span>
</th>
<th class="cred-field" style="width: 15%">Credentials</th>
<th style="width: 100%">Description</th>
<th></th>
<th></th>
</tr>
{% set ssh_group = [] %}
{% for server in servers %}
{% do ssh_group.append(server.3) %}
<tr id="server-{{server.0}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn" style="width: 15%">
{% set id = 'hostname-' + server.0|string() %}
{{ input(id, value=server.1, size='10') }}
</td>
<td>
<span id="ip-{{server.0}}" style="margin-right: 6px;">{{server.2}}</span>
<input type="hidden" id="servergroup-{{server.0}}" name="servergroup-{{server.0}}" value="{{ group }}" >
</td>
<td>
{% set id = 'port-' + server.0|string() %}
{{ input(id, value=server.10, size='2') }}
</td>
{% include 'include/admin_servers.html' %}
</tr>
{% endfor %}
</table>
<br /><span class="add-button" title="Add server" id="add-server-button">+ Add</span>
<br /><br />
<div id="checkSshConnect"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=servers" title="Servers description" target="_blank">here</a>
or watch video <a href="https://haproxy-wi.org/description.py?description=setup" title="How to setup servers, group and SSH credentials" target="_blank">here</a>
</div>
{% include 'include/admin_servers.html' %}
</div>
<div id="ssh">

@ -87,7 +87,7 @@
font-family: "Font Awesome 5 Solid";
content: "\f06d";
}
.hap::before {
.hap-menu::before {
display: none;
font-family: "Font Awesome 5 Solid";
content: "\f074";
@ -112,7 +112,7 @@
font-family: "Font Awesome 5 Solid";
content: "\f126";
}
.nginx::before {
.nginx-menu::before {
display: none;
font-family: "Font Awesome 5 Solid";
content: "\f0e8";

Loading…
Cancel
Save