Bugs
pull/19/head
Aidaho12 2018-06-29 12:07:24 +06:00
parent 0e85e79b70
commit 92d9b5639a
7 changed files with 23 additions and 15 deletions

View File

@ -53,13 +53,13 @@ if form.getvalue('mode') is not None:
ip = "" ip = ""
if form.getvalue('listner') is not None: if form.getvalue('listner') is not None:
name = "listen " + form.getvalue('listner') name = "\nlisten " + form.getvalue('listner')
backend = "" backend = ""
elif form.getvalue('frontend') is not None: elif form.getvalue('frontend') is not None:
name = "\nfrontend " + form.getvalue('frontend') name = "\nfrontend " + form.getvalue('frontend')
backend = " default_backend " + form.getvalue('backend') + "\n" backend = " default_backend " + form.getvalue('backend') + "\n"
elif form.getvalue('backend') is not None: elif form.getvalue('new_backend') is not None:
name = "backend " + form.getvalue('backend') name = "\nbackend " + form.getvalue('new_backend')
backend = "" backend = ""
if form.getvalue('ssl') == "https" and form.getvalue('mode') != "tcp": if form.getvalue('ssl') == "https" and form.getvalue('mode') != "tcp":

View File

@ -27,7 +27,7 @@ output_from_parsed_template = template.render(title = "Servers manage",
user = user, user = user,
users = sql.select_users(), users = sql.select_users(),
groups = sql.select_groups(), groups = sql.select_groups(),
servers = sql.get_dick_permit(virt=1), servers = sql.get_dick_permit(virt=1, disable=0),
roles = sql.select_roles(), roles = sql.select_roles(),
masters = sql.select_servers(get_master_servers=1), masters = sql.select_servers(get_master_servers=1),
sshs = sql.select_ssh(), sshs = sql.select_ssh(),

View File

@ -414,6 +414,11 @@ def get_dick_permit(**kwargs):
type_ip = "" type_ip = ""
else: else:
type_ip = "and type_ip = 0" type_ip = "and type_ip = 0"
if kwargs.get('disable') == 0:
disable = kwargs.get('disable')
else:
disable = 1
try: try:
cur.execute(sql) cur.execute(sql)
except sqltool.Error as e: except sqltool.Error as e:
@ -421,9 +426,9 @@ def get_dick_permit(**kwargs):
else: else:
for group in cur: for group in cur:
if group[5] == '1': if group[5] == '1':
sql = """ select * from servers where enable = 1 %s """ % type_ip sql = """ select * from servers where enable = %s %s """ % (disable, type_ip)
else: else:
sql = """ select * from servers where groups like '%{group}%' and enable = 1 {type_ip} """.format(group=group[5], type_ip=type_ip) sql = """ select * from servers where groups like '%{group}%' and enable = {disable} {type_ip} """.format(group=group[5], disable=disable, type_ip=type_ip)
try: try:
cur.execute(sql) cur.execute(sql)
except sqltool.Error as e: except sqltool.Error as e:
@ -494,8 +499,6 @@ def delete_ssh(id):
con.close() con.close()
def update_ssh(id, name, enable, group, username, password): def update_ssh(id, name, enable, group, username, password):
group = str(group)
print(group)
con, cur = create_db.get_cur() con, cur = create_db.get_cur()
sql = """ sql = """
update cred set update cred set

View File

@ -277,7 +277,7 @@
<tr> <tr>
<td class="addName">Name:</td> <td class="addName">Name:</td>
<td class="addOption"> <td class="addOption">
<input type="text" name="backend" id="backend" required title="Name backend" placeholder="web_80" class="form-control"> <input type="text" name="new_backend" id="new_backend" required title="Name backend" placeholder="web_80" class="form-control">
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -199,7 +199,7 @@
</td> </td>
<td> <td>
<select id="slavefor-{{server.0}}"> <select id="slavefor-{{server.0}}">
<option disabled selected>Not slave</option> <option value="0" selected>Not slave</option>
{% for master in masters %} {% for master in masters %}
{% if master.0 == server.6 %} {% if master.0 == server.6 %}
<option value="{{master.0}}" selected>{{master.1}}</option> <option value="{{master.0}}" selected>{{master.1}}</option>
@ -263,7 +263,7 @@
</td> </td>
<td> <td>
<select id="slavefor"> <select id="slavefor">
<option disabled selected>Not slave</option> <option value="0" selected>Not slave</option>
{% for master in masters %} {% for master in masters %}
<option value="{{master.0}}">{{master.1}}</option> <option value="{{master.0}}">{{master.1}}</option>
{% endfor %} {% endfor %}

View File

@ -76,7 +76,7 @@
<li><a href=/app/ha.py title="Create HA cluster" class="keepalived head-submenu">HA</a></li> <li><a href=/app/ha.py title="Create HA cluster" class="keepalived head-submenu">HA</a></li>
<li><a href=/app/keepalivedconfig.py title="Edit keepalived config" class="edit head-submenu">Edit config</a></li> <li><a href=/app/keepalivedconfig.py title="Edit keepalived config" class="edit head-submenu">Edit config</a></li>
</li> </li>
<li><a title="Servers manage" class="ha">Servers</a> <li><a title="Servers manage" class="runtime">Servers</a>
<li><a href=/app/servers.py title="Server manage" class="runtime head-submenu">Servers</a></li> <li><a href=/app/servers.py title="Server manage" class="runtime head-submenu">Servers</a></li>
<li><a href=/app/servers.py#ssh title="Manage SSH credentials" class="admin head-submenu">SSH credentials</a></li> <li><a href=/app/servers.py#ssh title="Manage SSH credentials" class="admin head-submenu">SSH credentials</a></li>
</li> </li>

View File

@ -379,9 +379,14 @@ $( function() {
$('#time_range_out_minut1').val(minutes1); $('#time_range_out_minut1').val(minutes1);
} }
}); });
$('#time_range_out_hour').val(date1/60); var date1_hours = Math.floor(date1/60);
var date2_hours = date1_hours + 1;
if(date1_hours <= 9) date1_hours = '0' + date1_hours;
if(date2_hours <= 9) date2_hours = '0' + date2_hours;
$('#time_range_out_hour').val(date1_hours);
$('#time_range_out_minut').val('00'); $('#time_range_out_minut').val('00');
$('#time_range_out_hour1').val(date2/60); $('#time_range_out_hour1').val(date2_hours);
$('#time_range_out_minut1').val(now.getMinutes()); $('#time_range_out_minut1').val(now.getMinutes());
$('#0').click(function() { $('#0').click(function() {
@ -947,4 +952,4 @@ function replace_text(id_textarea, text_var) {
var end = beg + len_var var end = beg + len_var
var text_val = str.substring(0, beg) + str.substring(end, len); var text_val = str.substring(0, beg) + str.substring(end, len);
$(id_textarea).text(text_val); $(id_textarea).text(text_val);
} }