New "Add server" form. Bugs fixed
pull/56/head
Aidaho12 2018-10-03 16:14:57 +06:00
parent 2772cd24f4
commit 48e7c556c2
6 changed files with 330 additions and 239 deletions

View File

@ -163,15 +163,15 @@
<table class="overview" id="ajax-servers"> <table class="overview" id="ajax-servers">
<tr class="overviewHead"> <tr class="overviewHead">
<td class="padding10 first-collumn">Hostname</td> <td class="padding10 first-collumn">Hostname</td>
<td>IP</td> <td class="ip-field">IP</td>
<td><span title="SSH port">Port(?)</span></td></td> <td class="checkbox-head"><span title="SSH port">Port(?)</span></td></td>
<td>Group</td> <td class="group-field">Group</td>
<td>Enable</td> <td class="checkbox-head">Enable</td>
<td><span title="Vitrual IP, something like VRRP">Virt(?)</span></td> <td class="checkbox-head"><span title="Vitrual IP, something like VRRP">Virt(?)</span></td>
<td><span title="Alert if backend change status. Before enable add Telgram chanel at Checker tab">Alert(?)</span></td> <td class="checkbox-head"><span title="Alert if backend change status. Before enable add Telgram chanel at Checker tab">Alert(?)</span></td>
<td><span title="Enable save and show metrics">Metrics(?)</span></td> <td class="checkbox-head"><span title="Enable save and show metrics">Metrics(?)</span></td>
<td><span title="Actions with master config will automatically apply on slave">Slave for (?)</span></td> <td class="slave-field"><span title="Actions with master config will automatically apply on slave">Slave for (?)</span></td>
<td>Credentials</td> <td class="cred-field">Credentials</td>
<td>Desciption</td> <td>Desciption</td>
<td></td> <td></td>
</tr> </tr>
@ -184,7 +184,7 @@
<td> <td>
<input type="text" id="ip-{{server.0}}" value="{{server.2}}" size="14" class="form-control"> <input type="text" id="ip-{{server.0}}" value="{{server.2}}" size="14" class="form-control">
</td> </td>
<td> <td class="checkbox">
<input type="text" id="port-{{server.0}}" value="{{server.10}}" size="1" class="form-control"> <input type="text" id="port-{{server.0}}" value="{{server.10}}" size="1" class="form-control">
</td> </td>
<td> <td>
@ -199,28 +199,28 @@
{% endfor %} {% endfor %}
</select> </select>
</td> </td>
<td> <td class="checkbox">
{% if server.5 == 1 %} {% if server.5 == 1 %}
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}" checked> <label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}" checked>
{% else %} {% else %}
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}"> <label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}">
{% endif %} {% endif %}
</td> </td>
<td> <td class="checkbox">
{% if server.4 == 1 %} {% if server.4 == 1 %}
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}" checked> <label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}" checked>
{% else %} {% else %}
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}"> <label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}">
{% endif %} {% endif %}
</td> </td>
<td> <td class="checkbox">
{% if server.8 == 1 %} {% if server.8 == 1 %}
<label for="alert-{{server.0}}"></label><input type="checkbox" id="alert-{{server.0}}" checked> <label for="alert-{{server.0}}"></label><input type="checkbox" id="alert-{{server.0}}" checked>
{% else %} {% else %}
<label for="alert-{{server.0}}"></label><input type="checkbox" id="alert-{{server.0}}"> <label for="alert-{{server.0}}"></label><input type="checkbox" id="alert-{{server.0}}">
{% endif %} {% endif %}
</td> </td>
<td> <td class="checkbox">
{% if server.9 == 1 %} {% if server.9 == 1 %}
<label for="metrics-{{server.0}}"></label><input type="checkbox" id="metrics-{{server.0}}" checked> <label for="metrics-{{server.0}}"></label><input type="checkbox" id="metrics-{{server.0}}" checked>
{% else %} {% else %}
@ -269,76 +269,6 @@
</table> </table>
<br /><span class="add-button" title="Add server" id="add-server-button">+ Add</span> <br /><span class="add-button" title="Add server" id="add-server-button">+ Add</span>
<br /><br /> <br /><br />
<table class="overview" id="server-add-table" style="display: none;">
<tr class="overviewHead">
<td class="padding10 first-collumn">New hostname</td>
<td>IP</td>
<td><span title="SSH port">Port(?)</span></td></td>
<td>Group</td>
<td>Enable</td>
<td><span title="Vitrual IP, something like VRRP">Virt(?)</span></td>
<td><span title="Alert if backend change status">Alert(?)</span></td>
<td><span title="Enable save and show metrics">Metrics(?)</span></td>
<td title="Actions with master config will automatically apply on slave">Slave for</td>
<td>Credentials</td>
<td>Desciption</td>
<td></td>
</tr>
<tr>
<td class="padding10 first-collumn">
<input type="text" name="new-server-add" id="new-server-add" class="form-control">
</td>
<td>
<input type="text" name="new-ip" id="new-ip" size="14" class="form-control">
</td>
<td>
<input type="text" name="new-port" id="new-port" size=1 class="form-control" value="22">
</td>
<td>
<select id="new-server-group-add" name="new-server-group-add">
<option disabled selected value="0">Choose group</option>
{% for group in groups %}
<option value="{{ group.0 }}">{{ group.1 }}</option>
{% endfor %}
</select>
</td>
<td>
<label for="enable"></label><input type="checkbox" id="enable" checked>
</td>
<td>
<label for="typeip"></label><input type="checkbox" id="typeip">
</td>
<td>
<label for="alert"></label><input type="checkbox" id="alert">
</td>
<td>
<label for="metrics"></label><input type="checkbox" id="metrics">
</td>
<td>
<select id="slavefor">
<option value="0" selected>Not slave</option>
{% for master in masters %}
<option value="{{master.0}}">{{master.1}}</option>
{% endfor %}
</select>
</td>
<td>
<select id="credentials" required>
<option disabled selected>Choose credentials</option>
{% for ssh in sshs %}
<option value="{{ssh.0}}">{{ssh.1}}</option>
{% endfor %}
</select>
</td>
<td>
<input type="text" id="desc" size="30" class="form-control">
</td>
<td>
<a class="add-admin" id="add-server" title="Add new server" style="cursor: pointer;"></a>
</td>
</tr>
</table>
</div> </div>
<div id="roles"> <div id="roles">
<table class="overview" id="ajax-group"> <table class="overview" id="ajax-group">
@ -544,9 +474,95 @@
<div id="ajax-telegram"></div> <div id="ajax-telegram"></div>
</div> </div>
</div> </div>
<div id="server-add-table" title="View certificate " style="display: none;">
<table class="overview">
<tr>
<td class="padding20">New hostname</td>
<td>
<input type="text" name="new-server-add" id="new-server-add" class="form-control">
</td>
<tr>
<td class="padding20">IP</td>
<td>
<input type="text" name="new-ip" id="new-ip" size="14" class="form-control">
</td>
<tr>
<td class="padding20"><span title="SSH port">Port(?)</span></td>
<td>
<input type="text" name="new-port" id="new-port" size=1 class="form-control" value="22">
</td>
</tr>
<tr>
<td class="padding20">Group</td>
<td>
<select id="new-server-group-add" name="new-server-group-add">
<option disabled selected value="0">Choose group</option>
{% for group in groups %}
<option value="{{ group.0 }}">{{ group.1 }}</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td class="padding20">Enable</td>
<td>
<label for="enable"></label><input type="checkbox" id="enable" checked>
</td>
</tr>
<tr>
<td class="padding20"><span title="Vitrual IP, something like VRRP">Virt(?)</span></td>
<td>
<label for="typeip"></label><input type="checkbox" id="typeip">
</td>
</tr>
<tr>
<td class="padding20"><span title="Alert if backend change status">Alert(?)</span></td>
<td>
<label for="alert"></label><input type="checkbox" id="alert">
</td>
</tr>
<tr>
<td class="padding20"><span title="Enable save and show metrics">Metrics(?)</span></td>
<td>
<label for="metrics"></label><input type="checkbox" id="metrics">
</td>
</tr>
<tr>
<td class="padding20" title="Actions with master config will automatically apply on slave">Slave for</td>
<td>
<select id="slavefor">
<option value="0" selected>Not slave</option>
{% for master in masters %}
<option value="{{master.0}}">{{master.1}}</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td class="padding20">Credentials</td>
<td>
<select id="credentials" required>
<option disabled selected>Choose credentials</option>
{% for ssh in sshs %}
<option value="{{ssh.0}}">{{ssh.1}}</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td class="padding20">Desciption</td>
<td>
<input type="text" id="desc" size="30" class="form-control">
</td>
</tr>
</table>
</div>
<style> <style>
.ui-selectmenu-button.ui-button { .ui-selectmenu-button.ui-button {
width: 12em; width: 10em;
}
.ui-selectmenu-menu {
z-index: 1010;
} }
.first-collumn { .first-collumn {
width: 10%; width: 10%;

View File

@ -99,7 +99,7 @@
</ul> </ul>
</nav> </nav>
<div class="copyright-menu"> <div class="copyright-menu">
HAproxy-WI v3.2.11 HAproxy-WI v3.2.12
<br> <br>
<a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Patreon</a> <a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Patreon</a>
</div> </div>

View File

@ -4,6 +4,9 @@
<div id="dialog-confirm" title="Are you sure you want to delete?" style="display: none;"> <div id="dialog-confirm" title="Are you sure you want to delete?" style="display: none;">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Deleting irreversibly all data will be lost?</p> <p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Deleting irreversibly all data will be lost?</p>
</div> </div>
<input type="hidden" id="new-group" name="new-group" value="{{ group }}">
<input type="hidden" id="new-server-group-add" name="new-server-group-add" value="{{ group }}" >
<input type="hidden" id="new-ssh-group-add" name="new-ssh-group-add" value="{{ ssh_group }}" >
<div id="tabs"> <div id="tabs">
<ul> <ul>
<li><a href="#users">Users</a></li> <li><a href="#users">Users</a></li>
@ -31,7 +34,6 @@
<tr id="user-{{user.0}}" class="{{ loop.cycle('odd', 'even') }}"> <tr id="user-{{user.0}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn"> <td class="padding10 first-collumn">
<input type="text" id="login-{{user.0}}" value="{{user.1}}" class="form-control"> <input type="text" id="login-{{user.0}}" value="{{user.1}}" class="form-control">
<input type="hidden" id="new-group" name="new-group" value="{{ group }}">
<input type="hidden" id="usergroup-{{user.0}}" name="usergroup-{{user.0}}" value="{{ group }}"> <input type="hidden" id="usergroup-{{user.0}}" name="usergroup-{{user.0}}" value="{{ group }}">
</td> </td>
<td><input type="password" id="password-{{user.0}}" value="{{user.3}}" class="form-control"></td> <td><input type="password" id="password-{{user.0}}" value="{{user.3}}" class="form-control"></td>
@ -98,14 +100,14 @@
<table class="overview" id="ajax-servers"> <table class="overview" id="ajax-servers">
<tr class="overviewHead"> <tr class="overviewHead">
<td class="padding10 first-collumn">Hostname</td> <td class="padding10 first-collumn">Hostname</td>
<td>IP</td> <td class="ip-field">IP</td>
<td><span title="SSH port">Port(?)</span></td></td> <td class="checkbox-head"><span title="SSH port">Port(?)</span></td></td>
<td>Enable</td> <td class="checkbox-head">Enable</td>
<td><span title="Vitrual IP, something like VRRP">Virt(?)</span></td> <td class="checkbox-head"><span title="Vitrual IP, something like VRRP">Virt(?)</span></td>
<td><span title="Alert if backend change status. Before enable add Telgram chanel at Checker tab">Alert(?)</span></td> <td class="checkbox-head"><span title="Alert if backend change status. Before enable add Telgram chanel at Checker tab">Alert(?)</span></td>
<td><span title="Enable save and show metrics">Metrics(?)</span></td> <td class="checkbox-head"><span title="Enable save and show metrics">Metrics(?)</span></td>
<td><span title="Actions with master config will automatically apply on slave">Slave for (?)</span></td> <td class="slave-field"><span title="Actions with master config will automatically apply on slave">Slave for (?)</span></td>
<td>Credentials</td> <td class="cred-field">Credentials</td>
<td>Desciption</td> <td>Desciption</td>
<td></td> <td></td>
</tr> </tr>
@ -118,34 +120,33 @@
</td> </td>
<td> <td>
<input type="text" id="ip-{{server.0}}" value="{{server.2}}" size="14" class="form-control"> <input type="text" id="ip-{{server.0}}" value="{{server.2}}" size="14" class="form-control">
<input type="hidden" id="new-server-group-add" name="servergroup-{{server.0}}" value="{{ group }}" >
<input type="hidden" id="servergroup-{{server.0}}" name="servergroup-{{server.0}}" value="{{ group }}" > <input type="hidden" id="servergroup-{{server.0}}" name="servergroup-{{server.0}}" value="{{ group }}" >
</td> </td>
<td> <td class="checkbox">
<input type="text" id="port-{{server.0}}" value="{{server.10}}" size="1" class="form-control"> <input type="text" id="port-{{server.0}}" value="{{server.10}}" size="1" class="form-control">
</td> </td>
<td> <td class="checkbox">
{% if server.5 == 1 %} {% if server.5 == 1 %}
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}" checked> <label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}" checked>
{% else %} {% else %}
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}"> <label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}">
{% endif %} {% endif %}
</td> </td>
<td> <td class="checkbox">
{% if server.4 == 1 %} {% if server.4 == 1 %}
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}" checked> <label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}" checked>
{% else %} {% else %}
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}"> <label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}">
{% endif %} {% endif %}
</td> </td>
<td> <td class="checkbox">
{% if server.8 == 1 %} {% if server.8 == 1 %}
<label for="alert-{{server.0}}"></label><input type="checkbox" id="alert-{{server.0}}" checked> <label for="alert-{{server.0}}"></label><input type="checkbox" id="alert-{{server.0}}" checked>
{% else %} {% else %}
<label for="alert-{{server.0}}"></label><input type="checkbox" id="alert-{{server.0}}"> <label for="alert-{{server.0}}"></label><input type="checkbox" id="alert-{{server.0}}">
{% endif %} {% endif %}
</td> </td>
<td> <td class="checkbox">
{% if server.9 == 1 %} {% if server.9 == 1 %}
<label for="metrics-{{server.0}}"></label><input type="checkbox" id="metrics-{{server.0}}" checked> <label for="metrics-{{server.0}}"></label><input type="checkbox" id="metrics-{{server.0}}" checked>
{% else %} {% else %}
@ -194,70 +195,6 @@
</table> </table>
<br /><span class="add-button" title="Add server" id="add-server-button">+ Add</span> <br /><span class="add-button" title="Add server" id="add-server-button">+ Add</span>
<br /><br /> <br /><br />
<table class="overview" id="server-add-table" style="display: none;">
<tr class="overviewHead">
<td class="padding10 first-collumn">New hostname</td>
<td>IP</td>
<td><span title="SSH port">Port(?)</span></td></td>
<td>Enable</td>
<td><span title="Vitrual IP, something like VRRP">Virt(?)</span></td>
<td><span title="Alert if backend change status">Alert(?)</span></td>
<td><span title="Enable save and show metrics">Metrics(?)</span></td>
<td title="Actions with master config will automatically apply on slave">Slave for</td>
<td>Credentials</td>
<td>Desciption</td>
<td></td>
</tr>
<tr>
<td class="padding10 first-collumn">
<input type="text" name="new-server-add" id="new-server-add" class="form-control">
</td>
<td>
<input type="text" name="new-ip" id="new-ip" size="14" class="form-control">
<input type="hidden" id="new-sshgroup" name="new-sshgroup" value="{{ group }}" >
</td>
<td>
<input type="text" name="new-port" id="new-port" size=1 class="form-control" value="22">
</td>
<td>
<label for="enable"></label><input type="checkbox" id="enable" checked>
</td>
<td>
<label for="typeip"></label><input type="checkbox" id="typeip">
</td>
<td>
<label for="alert"></label><input type="checkbox" id="alert">
</td>
<td>
<label for="metrics"></label><input type="checkbox" id="metrics">
</td>
<td>
<select id="slavefor">
<option selected value="0">Not slave</option>
{% for master in masters %}
<option value="{{master.0}}">{{master.1}}</option>
{% endfor %}
</select>
</td>
<td>
<select id="credentials" required>
<option disabled selected value="0">Choose credentials</option>
{% for ssh in sshs %}
{% if ssh.5|string() == group %}
<option value="{{ssh.0}}">{{ssh.1}}</option>
{% endif %}
{% endfor %}
</select>
</td>
<td>
<input type="text" id="desc" size="30" class="form-control">
</td>
<td>
<a class="add-admin" id="add-server" title="Add new server" style="cursor: pointer;"></a>
</td>
</tr>
</table>
</div> </div>
<div id="ssh"> <div id="ssh">
@ -279,7 +216,6 @@
<tr style="width: 50%;" id="ssh-table-{{ssh.0}}" class="{{ loop.cycle('odd', 'even') }}"> <tr style="width: 50%;" id="ssh-table-{{ssh.0}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="first-collumn"> <td class="first-collumn">
<input type="text" id="ssh_name-{{ssh.0}}" class="form-control" value="{{ssh.1}}" style="margin-bottom: 23px;"> <input type="text" id="ssh_name-{{ssh.0}}" class="form-control" value="{{ssh.1}}" style="margin-bottom: 23px;">
<input type="hidden" id="new-ssh-group-add" name="new-ssh-group-add" value="{{ ssh_group }}" >
</td> </td>
<td class="first-collumn" valign="top" style="padding-top: 15px;"> <td class="first-collumn" valign="top" style="padding-top: 15px;">
{% if ssh.2 == 1 %} {% if ssh.2 == 1 %}
@ -423,9 +359,87 @@
<b>Do not edit this section if your group is "ALL"!</b> Add first<a href="users.py#groups" title="Admin Area: Groups">group</a> or edit your own group at<a href="users.py#users" title="Admin Area: Users">users</a> page <b>Do not edit this section if your group is "ALL"!</b> Add first<a href="users.py#groups" title="Admin Area: Groups">group</a> or edit your own group at<a href="users.py#users" title="Admin Area: Users">users</a> page
</div> </div>
</div> </div>
<div id="server-add-table" title="View certificate " style="display: none;">
<table class="overview">
<tr>
<td class="padding20">New hostname</td>
<td>
<input type="text" name="new-server-add" id="new-server-add" class="form-control">
</td>
</tr>
<tr>
<td class="padding20">IP</td>
<td>
<input type="text" name="new-ip" id="new-ip" size="14" class="form-control">
<input type="hidden" id="new-sshgroup" name="new-sshgroup" value="{{ group }}" >
</td>
</tr>
<tr>
<td class="padding20"><span title="SSH port">Port(?)</span></td></td>
<td>
<input type="text" name="new-port" id="new-port" size=1 class="form-control" value="22">
</td>
</tr>
<tr>
<td class="padding20">Enable</td>
<td>
<label for="enable"></label><input type="checkbox" id="enable" checked>
</td>
</tr>
<tr>
<td class="padding20"><span title="Vitrual IP, something like VRRP">Virt(?)</span></td>
<td>
<label for="typeip"></label><input type="checkbox" id="typeip">
</td>
</tr>
<tr>
<td class="padding20"><span title="Alert if backend change status">Alert(?)</span></td>
<td>
<label for="alert"></label><input type="checkbox" id="alert">
</td>
</tr>
<tr>
<td class="padding20"><span title="Enable save and show metrics">Metrics(?)</span></td>
<td>
<label for="metrics"></label><input type="checkbox" id="metrics">
</td>
</tr>
<tr>
<td class="padding20" title="Actions with master config will automatically apply on slave">Slave for</td>
<td>
<select id="slavefor">
<option selected value="0">Not slave</option>
{% for master in masters %}
<option value="{{master.0}}">{{master.1}}</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td class="padding20">Credentials</td>
<td>
<select id="credentials" required>
<option disabled selected value="0">Choose credentials</option>
{% for ssh in sshs %}
{% if ssh.5|string() == group %}
<option value="{{ssh.0}}">{{ssh.1}}</option>
{% endif %}
{% endfor %}
</select>
</td>
</tr>
<tr>
<td class="padding20">Desciption</td>
<td>
<input type="text" id="desc" size="30" class="form-control">
</td>
</tr>
</table>
</div>
<script> <script>
if($('#new-server-group-add').val() == 1) { if($('#new-server-group-add').val() == 1) {
$('#group_error').css('display', 'block'); $('#group_error').css('display', 'block');
$('#add-user-button').css('display', 'none');
$('#add-server-button').css('display', 'none'); $('#add-server-button').css('display', 'none');
$('#add-ssh-button').css('display', 'none'); $('#add-ssh-button').css('display', 'none');
$('#ssh_key_upload').css('display', 'none'); $('#ssh_key_upload').css('display', 'none');
@ -443,10 +457,22 @@
</script> </script>
<style> <style>
.ui-selectmenu-button.ui-button { .ui-selectmenu-button.ui-button {
width: 12em; width: 10em;
}
.ui-selectmenu-menu {
z-index: 1010;
} }
.first-collumn { .first-collumn {
width: 10%; width: 10%;
} }
.checkbox {
width: 90px;
}
.group-field, .slave-field {
width: 15%;
}
.cred-field {
width: 20%;
}
</style> </style>
{% endblock %} {% endblock %}

View File

@ -35,7 +35,7 @@
$('td').css('font-size', '11'); $('td').css('font-size', '11');
$('h1').css('display', 'none'); $('h1').css('display', 'none');
$('td').css('border-color', '#ddd'); $('td').css('border-color', '#ddd');
$('td').css('padding', '4px'); $('td').css('padding', '3px');
$('th').css('padding-top', '4px'); $('th').css('padding-top', '4px');
$('th').css('padding-bottom', '4px'); $('th').css('padding-bottom', '4px');
$('th').css('border-color', '#ddd'); $('th').css('border-color', '#ddd');

View File

@ -304,10 +304,25 @@ pre {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
border-radius: 5px; border-radius: 5px;
} }
.checkbox {
/*.overviewTd { width: 60px;
padding-top: 20px; padding-left: 5px;
}*/ }
.checkbox-head {
padding: 0;
}
.ip-field {
width: 100px;
}
.group-field, .slave-field {
width: 10%;
}
.slave-field {
padding-left: 10px;
}
.cred-field {
width: 17%;
}
.overviewTr { .overviewTr {
margin: 0; margin: 0;
background-color: #f6f8fa; background-color: #f6f8fa;
@ -343,6 +358,10 @@ pre {
border: none; border: none;
width: 23%; width: 23%;
} }
.padding20 {
padding: 15px;
width: 30%;
}
.first-collumn { .first-collumn {
padding-left: 15px; padding-left: 15px;
width: 15%; width: 15%;
@ -477,7 +496,7 @@ b,
strong { strong {
font-weight: bold; font-weight: bold;
} }
button, //button,
input, input,
optgroup, optgroup,
select, select,

View File

@ -188,64 +188,6 @@ $( function() {
} }
} ); } );
}); });
$('#add-server').click(function() {
$('#error').remove();
$('.alert-danger').remove();
var typeip = 0;
var enable = 0;
var alert_en = 0;
var metrics = 0;
if ($('#typeip').is(':checked')) {
typeip = '1';
}
if ($('#enable').is(':checked')) {
enable = '1';
}
if ($('#alert').is(':checked')) {
var alert_en = '1';
}
if ($('#metrics').is(':checked')) {
var metrics = '1';
}
$.ajax( {
url: "sql.py",
data: {
newserver: "1",
servername: $('#new-server-add').val(),
newip: $('#new-ip').val(),
newport: $('#new-port').val(),
newservergroup: $('#new-server-group-add').val(),
typeip: typeip,
enable: enable,
slave: $('#slavefor' ).val(),
cred: $('#credentials').val(),
alert_en: alert_en,
metrics: metrics,
page: cur_url[0],
desc: $('#desc').val()
},
type: "GET",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
$("#ajax-servers").append(data);
$('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else {
$('.alert-danger').remove();
$("#ajax-servers").append(data);
$(".newserver").addClass( "update", 1000, callbackServer );
$( "input[type=submit], button" ).button();
$( "input[type=checkbox]" ).checkboxradio();
$( "select" ).selectmenu();
$.getScript(awesome);
}
}
} );
});
$('#add-ssh').click(function() { $('#add-ssh').click(function() {
$('#error').remove(); $('#error').remove();
$('.alert-danger').remove(); $('.alert-danger').remove();
@ -349,9 +291,29 @@ $( function() {
} }
}); });
$('#add-server-button').click(function() { $('#add-server-button').click(function() {
if ($('#server-add-table').css('display', 'none')) { $( "#server-add-table" ).dialog({
$('#server-add-table').show("blind", "fast"); resizable: false,
} height: "auto",
width: 600,
modal: true,
title: "Add new server",
show: {
effect: "fade",
duration: 200
},
hide: {
effect: "fade",
duration: 200
},
buttons: {
"Add": function() {
addServer();
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
}); });
$('#add-ssh-button').click(function() { $('#add-ssh-button').click(function() {
if ($('#ssh-add-table').css('display', 'none')) { if ($('#ssh-add-table').css('display', 'none')) {
@ -422,7 +384,75 @@ $( function() {
}); });
} ); } );
function addServer() {
$('#error').remove();
$('.alert-danger').remove();
var servername = $('#new-server-add').val();
var newip = $('#new-ip').val();
var newservergroup = $('#new-server-group-add').val();
var cred = $('#credentials').val();
var typeip = 0;
var enable = 0;
var alert_en = 0;
var metrics = 0;
if ($('#typeip').is(':checked')) {
typeip = '1';
}
if ($('#enable').is(':checked')) {
enable = '1';
}
if ($('#alert').is(':checked')) {
var alert_en = '1';
}
if ($('#metrics').is(':checked')) {
var metrics = '1';
}
if (servername == '' || newip == '' || newservergroup == '' || cred == '') {
alert('All fields must be completed');
} else {
$.ajax( {
url: "sql.py",
data: {
newserver: "1",
servername: servername,
newip: newip,
newport: $('#new-port').val(),
newservergroup: newservergroup,
typeip: typeip,
enable: enable,
slave: $('#slavefor' ).val(),
cred: cred,
alert_en: alert_en,
metrics: metrics,
page: cur_url[0],
desc: $('#desc').val()
},
type: "GET",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
$("#ajax-servers").append(data);
$('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else {
$('.alert-danger').remove();
$("#ajax-servers").append(data);
$(".newserver").addClass( "update", 1000 );
setTimeout(function() {
$( ".newserver" ).removeClass( "update" );
}, 2500 );
$( "input[type=submit], button" ).button();
$( "input[type=checkbox]" ).checkboxradio();
$( "select" ).selectmenu();
$.getScript(awesome);
}
}
} );
$( "#server-add-table" ).dialog("close" );
}
}
function updateSettings(param, val) { function updateSettings(param, val) {
$('.alert-danger').remove(); $('.alert-danger').remove();
$.ajax( { $.ajax( {