mirror of https://github.com/Aidaho12/haproxy-wi
parent
9b76d5e21e
commit
89b0ec5fbe
|
@ -62,7 +62,7 @@ if form.getvalue('serv') is not None and form.getvalue('config') is not None:
|
|||
if master[0] != None:
|
||||
funct.upload_and_restart(master[0], configver, just_save=save)
|
||||
|
||||
stderr, error = funct.upload_and_restart(serv, configver, just_save=save)
|
||||
stderr = funct.upload_and_restart(serv, configver, just_save=save)
|
||||
aftersave = 1
|
||||
|
||||
|
||||
|
|
19
app/funct.py
19
app/funct.py
|
@ -144,34 +144,40 @@ def ssh_connect(serv, **kwargs):
|
|||
return False
|
||||
else:
|
||||
return 'Authentication failed, please verify your credentials'
|
||||
pass
|
||||
except paramiko.SSHException as sshException:
|
||||
if kwargs.get('check'):
|
||||
print('<div class="alert alert-danger">Unable to establish SSH connection: %s </div>' % sshException)
|
||||
return False
|
||||
else:
|
||||
return 'Unable to establish SSH connection: %s ' % sshException
|
||||
pass
|
||||
except paramiko.BadHostKeyException as badHostKeyException:
|
||||
if kwargs.get('check'):
|
||||
print('<div class="alert alert-danger">Unable to verify server\'s host key: %s </div>' % badHostKeyException)
|
||||
return False
|
||||
else:
|
||||
return 'Unable to verify server\'s host key: %s ' % badHostKeyException
|
||||
pass
|
||||
except Exception as e:
|
||||
if e.args[1] == "No such file or directory":
|
||||
if kwargs.get('check'):
|
||||
print('<div class="alert alert-danger">{}. Check ssh key</div>'.format(e.args[1]))
|
||||
else:
|
||||
return '{}. Check ssh key'.format(e.args[1])
|
||||
pass
|
||||
elif e.args[1] == "Invalid argument":
|
||||
if kwargs.get('check'):
|
||||
print('<div class="alert alert-danger">Check the IP of the new server</div>')
|
||||
else:
|
||||
error = 'Check the IP of the new server'
|
||||
pass
|
||||
else:
|
||||
if kwargs.get('check'):
|
||||
print('<div class="alert alert-danger">{}</div>'.format(e.args[1]))
|
||||
else:
|
||||
error = e.args[1]
|
||||
pass
|
||||
if kwargs.get('check'):
|
||||
return False
|
||||
else:
|
||||
|
@ -372,9 +378,9 @@ def show_log(stdout):
|
|||
for line in stdout:
|
||||
i = i + 1
|
||||
if i % 2 == 0:
|
||||
print('<div class="line3">' + line + '</div>')
|
||||
print('<div class="line3">' + escape_html(line) + '</div>')
|
||||
else:
|
||||
print('<div class="line">' + line + '</div>')
|
||||
print('<div class="line">' + escape_html(line) + '</div>')
|
||||
|
||||
def show_ip(stdout):
|
||||
for line in stdout:
|
||||
|
@ -418,6 +424,11 @@ def ssh_command(serv, commands, **kwargs):
|
|||
print('<div style="margin: -10px;">'+stdout.read().decode(encoding='UTF-8')+'</div>')
|
||||
|
||||
print(stderr.read().decode(encoding='UTF-8'))
|
||||
|
||||
ssh.close()
|
||||
try:
|
||||
ssh.close()
|
||||
except:
|
||||
print(ssh)
|
||||
pass
|
||||
|
||||
def escape_html(text):
|
||||
return cgi.escape(text, quote=True)
|
151
app/sql.py
151
app/sql.py
|
@ -120,12 +120,12 @@ def add_server(hostname, ip, group, typeip, enable, master):
|
|||
try:
|
||||
cur.execute(sql)
|
||||
con.commit()
|
||||
return True
|
||||
except sqltool.Error as e:
|
||||
print('<span class="alert alert-danger" id="error">An error occurred: ' + e.args[0] + ' <a title="Close" id="errorMess"><b>X</b></a></span>')
|
||||
con.rollback()
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
cur.close()
|
||||
con.close()
|
||||
|
||||
|
@ -220,29 +220,12 @@ def select_user_name_group(id):
|
|||
return group
|
||||
cur.close()
|
||||
con.close()
|
||||
|
||||
def get_groups_select(id, **kwargs):
|
||||
print('<select class="multiselect" id="%s" name="%s">' % (id, id))
|
||||
print('<option disabled selected>Choose group</option>')
|
||||
GROUPS = select_groups()
|
||||
selected = ""
|
||||
print(kwargs.get('selected'))
|
||||
for group in GROUPS:
|
||||
if kwargs.get('selected'):
|
||||
selected1 = kwargs.get('selected')
|
||||
selected1 = int(selected1)
|
||||
if selected1 == group[0]:
|
||||
selected = 'selected'
|
||||
else:
|
||||
selected = ""
|
||||
print('<option value="%s" %s>%s</option>' % (group[0], selected, group[1]))
|
||||
print('</select>')
|
||||
|
||||
def select_servers(**kwargs):
|
||||
con, cur = create_db.get_cur()
|
||||
sql = """select * from servers where enable = '1' ORDER BY groups """
|
||||
if kwargs.get("server") is not None:
|
||||
sql = """select * from servers where hostname='%s' """ % kwargs.get("server")
|
||||
sql = """select * from servers where ip='%s' """ % kwargs.get("server")
|
||||
if kwargs.get("full") is not None:
|
||||
sql = """select * from servers ORDER BY groups """
|
||||
if kwargs.get("get_master_servers") is not None:
|
||||
|
@ -445,85 +428,40 @@ def update_ssh(enable, username, password):
|
|||
cur.close()
|
||||
con.close()
|
||||
|
||||
def show_update_servers():
|
||||
SERVERS = select_servers()
|
||||
print('<tr class="overviewHead">'
|
||||
'<td class="padding10">Hostname</td>'
|
||||
'<td>IP</td>'
|
||||
'<td>Group</td>'
|
||||
'<td></td>'
|
||||
'</tr>')
|
||||
for server in SERVERS:
|
||||
print('<tr id="server-%s">' % server[0])
|
||||
print('<td class="padding10 first-collumn"><input type="text" id="server-%s" value="%s" class="form-control"></td>' % (server[0], server[1]))
|
||||
print('<td><input type="text" id="descript-%s" value="%s" class="form-control"></td>' % (server[0], server[2]))
|
||||
print('<td>')
|
||||
get_groups_select("123", selected=server[3])
|
||||
print('</td>')
|
||||
print('<td>')
|
||||
get_enable_checkbox(server[0])
|
||||
print('</td>')
|
||||
print('<td>')
|
||||
get_type_ip_checkbox(server[0])
|
||||
print('</td>')
|
||||
print('<td><a class="delete" onclick="removeServer(%s)" style="cursor: pointer;"></a></td>' % server[0])
|
||||
print('</tr>')
|
||||
|
||||
def show_update_user(user):
|
||||
USERS = select_users(user=user)
|
||||
for users in USERS:
|
||||
print('<tr id="user-%s">' % users[0])
|
||||
print('<td class="padding10 first-collumn"><input type="text" id="login-%s" value="%s" class="form-control"></td>' % (users[0], users[1]))
|
||||
print('<td><input type="password" id="password-%s" value="%s" class="form-control"></td>' % (users[0], users[3]))
|
||||
print('<td><input type="text" id="email-%s" value="%s" class="form-control"></td>' % (users[0], users[2]))
|
||||
print('<td>')
|
||||
need_id_role = "role-%s" % users[0]
|
||||
get_roles_select(need_id_role, selected=users[4])
|
||||
print('</td>')
|
||||
print('<td>')
|
||||
need_id_group = "usergroup-%s" % users[0]
|
||||
get_groups_select(need_id_group, selected=users[5])
|
||||
print('</td>')
|
||||
print('<td><a class="delete" onclick="removeUser(%s)" style="cursor: pointer;"></a></td>' % users[0])
|
||||
print('</tr>')
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'))
|
||||
template = env.get_template('/new_user.html')
|
||||
|
||||
print('Content-type: text/html\n')
|
||||
|
||||
output_from_parsed_template = template.render(users = select_users(user=user),
|
||||
groups = select_groups(),
|
||||
roles = select_roles())
|
||||
print(output_from_parsed_template)
|
||||
|
||||
def show_update_server(server):
|
||||
SERVERS = select_servers(server=server)
|
||||
for server in SERVERS:
|
||||
print('<tr id="server-%s">' % server[0])
|
||||
print('<td class="padding10 first-collumn"><input type="text" id="hostname-%s" value="%s" class="form-control"></td>' % (server[0], server[1]))
|
||||
print('<td><input type="text" id="ip-%s" value="%s" class="form-control"></td>' % (server[0], server[2]))
|
||||
print('<td>')
|
||||
need_id_group = "servergroup-%s" % server[0]
|
||||
get_groups_select(need_id_group, selected=server[3])
|
||||
print('</td>')
|
||||
print('<td>')
|
||||
get_enable_checkbox(server[0])
|
||||
print('</td>')
|
||||
print('<td>')
|
||||
get_type_ip_checkbox(server[0])
|
||||
print('</td>')
|
||||
print('<td><select id="slavefor-%s"><option value="0" selected>Not slave</option>' % server[0])
|
||||
MASTERS = select_servers(get_master_servers=1)
|
||||
for master in MASTERS:
|
||||
if master[0] == server[6]:
|
||||
selected = "selected"
|
||||
else:
|
||||
selected = ""
|
||||
print('<option value="%s" %s>%s</option>' % (master[0], selected, master[1]))
|
||||
print('</select></td>')
|
||||
print('<td><a class="delete" onclick="removeServer(%s)" style="cursor: pointer;"></a></td>' % server[0])
|
||||
print('</tr>')
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax/'))
|
||||
template = env.get_template('/new_server.html')
|
||||
|
||||
print('Content-type: text/html\n')
|
||||
|
||||
output_from_parsed_template = template.render(groups = select_groups(),
|
||||
servers = select_servers(server=server),
|
||||
roles = select_roles(),
|
||||
masters = select_servers(get_master_servers=1))
|
||||
print(output_from_parsed_template)
|
||||
|
||||
def show_update_group(group):
|
||||
GROUPS = select_groups(group=group)
|
||||
for group in GROUPS:
|
||||
print('<tr id="group-%s">' % group[0])
|
||||
print('<td class="padding10 first-collumn"><input type="text" name="name-%s" value="%s" class="form-control"></td>' % (group[0], group[1]))
|
||||
print('<td><input type="text" name="descript-%s" value="%s" class="form-control" size="100"></td>' % (group[0], group[2]))
|
||||
print('<td><a class="delete" onclick="removeGroup(%s)" style="cursor: pointer;"></a></td>' % group[0])
|
||||
print('<td></td>')
|
||||
print('</tr>')
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax/'))
|
||||
template = env.get_template('/new_group.html')
|
||||
|
||||
print('Content-type: text/html\n')
|
||||
|
||||
output_from_parsed_template = template.render(groups = select_groups(group=group))
|
||||
print(output_from_parsed_template)
|
||||
|
||||
def select_roles(**kwargs):
|
||||
con, cur = create_db.get_cur()
|
||||
|
@ -552,21 +490,7 @@ def select_roles(**kwargs):
|
|||
return cur.fetchall()
|
||||
cur.close()
|
||||
con.close()
|
||||
|
||||
def get_roles_select(id, **kwargs):
|
||||
print('<select id="%s" name="%s">' % (id, id))
|
||||
print('<optin disabled selected>Choose role</option>')
|
||||
ROLES = select_roles()
|
||||
selected = ""
|
||||
for role in ROLES:
|
||||
if kwargs.get('selected'):
|
||||
if kwargs.get('selected') == role[1]:
|
||||
selected = "selected"
|
||||
else:
|
||||
selected = ""
|
||||
print('<option value="%s" %s>%s</option>' % (role[1], selected, role[1]))
|
||||
print('</select>')
|
||||
|
||||
|
||||
form = cgi.FieldStorage()
|
||||
error_mess = '<span class="alert alert-danger" id="error">All fields must be completed <a title="Close" id="errorMess"><b>X</b></a></span>'
|
||||
|
||||
|
@ -614,13 +538,10 @@ if form.getvalue('newserver') is not None:
|
|||
if ip is None or group is None:
|
||||
print('Content-type: text/html\n')
|
||||
print(error_mess)
|
||||
else:
|
||||
else:
|
||||
print('Content-type: text/html\n')
|
||||
if funct.ssh_connect(ip, check=1):
|
||||
if add_server(hostname, ip, group, typeip, enable, master):
|
||||
show_update_server(hostname)
|
||||
else:
|
||||
print('<span class="alert alert-danger" id="error"><a title="Close" id="errorMess"><b>X</b></a></span>')
|
||||
if add_server(hostname, ip, group, typeip, enable, master):
|
||||
show_update_server(ip)
|
||||
|
||||
if form.getvalue('serverdel') is not None:
|
||||
print('Content-type: text/html\n')
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{% for group in groups %}
|
||||
<tr id="group-{{ group.0 }}">
|
||||
<td class="padding10 first-collumn">
|
||||
<input type="text" id="name-{{ group.0 }}" value="{{ group.1 }}" class="form-control">
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="descript-{{ group.0 }}" value="{{ group.2 }}" class="form-control" size="100">
|
||||
</td>
|
||||
<td>
|
||||
<a class="delete" onclick="removeGroup({{ group.0 }})" style="cursor: pointer;"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
|
@ -0,0 +1,13 @@
|
|||
{% for group in groups %}
|
||||
<tr id="group-{{ group.0 }}" class="newgroup">
|
||||
<td class="padding10 first-collumn">
|
||||
<input type="text" id="name-{{ group.0 }}" value="{{ group.1 }}" class="form-control">
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="descript-{{ group.0 }}" value="{{ group.2 }}" class="form-control" size="100">
|
||||
</td>
|
||||
<td>
|
||||
<a class="delete" onclick="removeGroup({{ group.0 }})" style="cursor: pointer;"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
|
@ -0,0 +1,51 @@
|
|||
{% for server in servers %}
|
||||
<tr id="server-{{server.0}}" class="newserver">
|
||||
<td class="padding10 first-collumn">
|
||||
<input type="text" id="hostname-{{server.0}}" value="{{server.1}}" class="form-control">
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="ip-{{server.0}}" value="{{server.2}}" class="form-control">
|
||||
</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>
|
||||
<td>
|
||||
{% if server.5 == 1 %}
|
||||
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}" checked>
|
||||
{% else %}
|
||||
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}">
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if server.4 == 1 %}
|
||||
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}" checked>
|
||||
{% else %}
|
||||
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}">
|
||||
{% 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>
|
||||
<a class="delete" onclick="removeServer({{server.0}})" style="cursor: pointer;"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
|
@ -0,0 +1,32 @@
|
|||
{% for user in users %}
|
||||
<tr id="user-{{user.0}}" class="newuser">
|
||||
<td class="padding10 first-collumn"><input type="text" id="login-{{user.0}}" value="{{user.1}}" class="form-control"></td>
|
||||
<td><input type="password" id="password-{{user.0}}" value="{{user.3}}" class="form-control"></td>
|
||||
<td><input type="text" id="email-{{user.0}}" value="{{user.2}}" class="form-control"></td>
|
||||
<td>
|
||||
<select id="role-{{user.0}}" name="role-{{user.0}}">
|
||||
<option disabled selected>Choose role</option>
|
||||
{% for role in roles %}
|
||||
{% if user.4 == role.1 %}
|
||||
<option value="{{ role.1 }}" selected>{{ role.1 }}</option>
|
||||
{% else %}
|
||||
<option value="{{ role.1 }}">{{ role.1 }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select id="usergroup-{{user.0}}" name="usergroup-{{user.0}}">
|
||||
<option disabled selected>Choose group</option>
|
||||
{% for group in groups %}
|
||||
{% if user.5 == group.0|string() %}
|
||||
<option value="{{ group.0 }}" selected>{{ group.1 }}</option>
|
||||
{% else %}
|
||||
<option value="{{ group.0 }}">{{ group.1 }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td><a class="delete" onclick="removeUser({{user.0}})" style="cursor: pointer;"></a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
|
@ -0,0 +1,53 @@
|
|||
{% for server in servers %}
|
||||
<tr id="server-{{server.0}}">
|
||||
<td class="padding10 first-collumn">
|
||||
<input type="text" id="hostname-{{server.0}}" value="{{server.1}}" class="form-control">
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="ip-{{server.0}}" value="{{server.2}}" class="form-control">
|
||||
</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>
|
||||
<td>
|
||||
{% if server.5 == 1 %}
|
||||
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}" checked>
|
||||
{% else %}
|
||||
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}">
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if server.4 == 1 %}
|
||||
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}" checked>
|
||||
{% else %}
|
||||
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}">
|
||||
{% 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>
|
||||
<a class="delete" onclick="removeServer({{server.0}})" style="cursor: pointer;"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<script defer src="/inc/fontawesome.min.js"></script>
|
||||
<script src="/inc/script.js"></script>
|
|
@ -0,0 +1,51 @@
|
|||
{% for server in servers %}
|
||||
<tr id="server-{{server.0}}">
|
||||
<td class="padding10 first-collumn">
|
||||
<input type="text" id="hostname-{{server.0}}" value="{{server.1}}" class="form-control">
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="ip-{{server.0}}" value="{{server.2}}" class="form-control">
|
||||
</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>
|
||||
<td>
|
||||
{% if server.5 == 1 %}
|
||||
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}" checked>
|
||||
{% else %}
|
||||
<label for="enable-{{server.0}}"></label><input type="checkbox" id="enable-{{server.0}}">
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if server.4 == 1 %}
|
||||
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}" checked>
|
||||
{% else %}
|
||||
<label for="typeip-{{server.0}}"></label><input type="checkbox" id="typeip-{{server.0}}">
|
||||
{% 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>
|
||||
<a class="delete" onclick="removeServer({{server.0}})" style="cursor: pointer;"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
|
@ -19,9 +19,9 @@
|
|||
<tr>
|
||||
<td class="padding10 first-collumn">
|
||||
<form action="logs.py" method="get">
|
||||
<select autofocus required name="serv" id="serv">
|
||||
<option disabled selected>Choose server</option>
|
||||
<select autofocus required name="serv" id="serv">
|
||||
{% if onclick == 'showApacheLog()' %}
|
||||
<option disabled selected>Choose log</option>
|
||||
{% for select in selects %}
|
||||
{% if select.2 == serv %}
|
||||
<option value="{{ select.0 }}" selected>{{ select.1 }}</option>
|
||||
|
@ -31,6 +31,7 @@
|
|||
{% endfor %}
|
||||
{% else %}
|
||||
{% for select in selects %}
|
||||
<option disabled selected>Choose server</option>
|
||||
{% if select.2 == serv %}
|
||||
<option value="{{ select.2 }}" selected>{{ select.1 }}</option>
|
||||
{% else %}
|
||||
|
|
|
@ -291,6 +291,7 @@ pre {
|
|||
padding-left: 10px;
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.serverDown {
|
||||
background-color: red;
|
||||
|
|
24
inc/users.js
24
inc/users.js
|
@ -129,7 +129,7 @@ $( function() {
|
|||
} else {
|
||||
$('.alert-danger').remove();
|
||||
$("#ajax-users").append(data);
|
||||
$( "#ajax-users tr td" ).addClass( "update", 1000, callbackUser );
|
||||
$( ".newuser" ).addClass( "update", 1000, callbackUser );
|
||||
$.getScript(url);
|
||||
$.getScript(awesome);
|
||||
$.getScript(users);
|
||||
|
@ -138,6 +138,8 @@ $( function() {
|
|||
} );
|
||||
});
|
||||
$('#add-group').click(function() {
|
||||
$('#error').remove();
|
||||
$('.alert-danger').remove();
|
||||
$.ajax( {
|
||||
url: "sql.py",
|
||||
data: {
|
||||
|
@ -153,7 +155,7 @@ $( function() {
|
|||
var getId = new RegExp('[0-9]+');
|
||||
var id = data.match(getId);
|
||||
$("#ajax-group").append(data);
|
||||
$( "#ajax-group tr td" ).addClass( "update", 1000, callbackGroup );
|
||||
$( ".newgroup" ).addClass( "update", 1000, callbackGroup );
|
||||
$('select:regex(id, group)').append('<option value='+id+'>'+$('#new-group-add').val()+'</option>').selectmenu("refresh");
|
||||
$.getScript(awesome);
|
||||
}
|
||||
|
@ -190,10 +192,9 @@ $( function() {
|
|||
} else {
|
||||
$('.alert-danger').remove();
|
||||
$("#ajax-servers").append(data);
|
||||
$( "#ajax-servers tr td" ).addClass( "update", 1000, callback );
|
||||
$.getScript(url);
|
||||
$.getScript(awesome);
|
||||
$.getScript(users);
|
||||
$(".newserver").addClass( "update", 1000, callbackServer );
|
||||
$.getScript(url);
|
||||
$.getScript(awesome);
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
@ -201,18 +202,17 @@ $( function() {
|
|||
|
||||
function callbackUser() {
|
||||
setTimeout(function() {
|
||||
$( "#ajax-users tr td" ).removeClass( "update" );
|
||||
$( ".newuser" ).removeClass( "update" );
|
||||
}, 2500 );
|
||||
}
|
||||
function callback() {
|
||||
function callbackServer() {
|
||||
setTimeout(function() {
|
||||
$( "#ajax-servers tr td" ).removeClass( "update" );
|
||||
$( ".newserver" ).removeClass( "update" );
|
||||
}, 2500 );
|
||||
}
|
||||
|
||||
}
|
||||
function callbackGroup() {
|
||||
setTimeout(function() {
|
||||
$( "#ajax-group tr td" ).removeClass( "update" );
|
||||
$( ".newgroup" ).removeClass( "update" );
|
||||
}, 2500 );
|
||||
}
|
||||
|
||||
|
|
|
@ -292,6 +292,7 @@ echo "Edit firewalld"
|
|||
firewall-cmd --zone=public --add-port=$PORT/tcp --permanent
|
||||
firewall-cmd --reload
|
||||
|
||||
mkdir /var/www/$HOME_HAPROXY_WI/app/certs
|
||||
chmod +x /var/www/$HOME_HAPROXY_WI/app/*.py
|
||||
chown -R apache:apache /var/www/$HOME_HAPROXY_WI/
|
||||
rm -f /var/www/$HOME_HAPROXY_WI/log/config_edit.log
|
||||
|
|
Loading…
Reference in New Issue