mirror of https://github.com/Aidaho12/haproxy-wi
parent
cf9a855992
commit
b6391fb8c5
22
README.md
22
README.md
|
@ -1,5 +1,5 @@
|
||||||
# Haproxy web interface
|
# Haproxy web interface
|
||||||
Web interface(user-friendly web GUI, alerting, monitoring and secure) for managing Haproxy servers. Leave your [feedback](https://github.com/Aidaho12/haproxy-wi/issues)
|
Web interface(user-friendly web GUI, alerting, monitoring and secure) for managing HAProxy servers. Leave your [feedback](https://github.com/Aidaho12/haproxy-wi/issues)
|
||||||
|
|
||||||
# Youtube
|
# Youtube
|
||||||
[Demo video](https://www.youtube.com/channel/UCo0lCg24j-H4f0S9kMjp-_w)
|
[Demo video](https://www.youtube.com/channel/UCo0lCg24j-H4f0S9kMjp-_w)
|
||||||
|
@ -8,27 +8,27 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi
|
||||||
[Twitter](https://twitter.com/haproxy_wi), subscribe! I will write there about all the changes and news
|
[Twitter](https://twitter.com/haproxy_wi), subscribe! I will write there about all the changes and news
|
||||||
|
|
||||||
# Telegram
|
# Telegram
|
||||||
[Channel](https://t.me/haproxy_wi) about Haproxy-wi, talks and questions are welcome
|
[Channel](https://t.me/haproxy_wi) about HAProxy-WI, talks and questions are welcome
|
||||||
# Demo site
|
# Demo site
|
||||||
[Demo site](https://demo.haproxy-wi.org) Login/password: admin/admin. Server resets every hour.
|
[Demo site](https://demo.haproxy-wi.org) Login/password: admin/admin. Server resets every hour.
|
||||||
|
|
||||||
![alt text](image/haproxy-wi-config-show.png "Show config page")
|
![alt text](image/haproxy-wi-config-show.png "Show config page")
|
||||||
|
|
||||||
# Features:
|
# Features:
|
||||||
1. Configure HAProxy In a jiffy with HAProxy-WI
|
1. Configure HAProxy and Keepalived In a jiffy with HAProxy-WI
|
||||||
2. View and analyse Status of all Frontend/backend server via HAProxy-WI from a single control panel.
|
2. View and analyse Status of all Frontend/backend server via HAProxy-WI from a single control panel.
|
||||||
3. Enable/disable servers through stats page without rebooting HAProxy
|
3. Enable/disable servers through stats page without rebooting HAProxy
|
||||||
4. View/Analyse HAproxy logs straight from the HAProxy-WI web interface
|
4. View/Analyse HAproxy logs straight from the HAProxy-WI web interface
|
||||||
5. Create and visualise the HAproxy workflow from Web Ui.
|
5. Create and visualise the HAProxy workflow from Web Ui.
|
||||||
6. Push Your changes to your HAproxy servers with a single click through web interface
|
6. Push Your changes to your HAProxy and Keepalived servers with a single click through web interface
|
||||||
7. Get info on past changes, Evaluate your config files and restore a previous stable config anytime with a single click straight from Web interface
|
7. Get info on past changes, evaluate your config files and restore a previous stable config anytime with a single click straight from Web interface
|
||||||
8. Add/Edit Frontend or backend servers via web interface with a click of a button.
|
8. Add/Edit Frontend or backend servers via web interface with a click of a button.
|
||||||
9. Edit config of HAProxy and push changes to All Master/Slave server with a single click
|
9. Edit config of HAProxy, Keepalived and push changes to All Master/Slave server with a single click
|
||||||
10. Add Multiple server to ensure Config Sync between servers.
|
10. Add Multiple server to ensure Config Sync between servers.
|
||||||
11. Auto management of ports assigned to Fronted.
|
11. Auto management of ports assigned to Fronted.
|
||||||
12. Evaluate the changes of recent configs pushed to HAproxy instances straight from web ui
|
12. Evaluate the changes of recent configs pushed to HAProxy and Keepalived instances straight from web ui
|
||||||
13. Multiple User Roles support for privileged based Viewing and editing of Config
|
13. Multiple User Roles support for privileged based Viewing and editing of Config
|
||||||
14. Create Groups and add /remove servers to ensure proper identification for your HAproxy Clusters
|
14. Create Groups and add /remove servers to ensure proper identification for your HAProxy Clusters
|
||||||
15. Send notifications to telegram directly from HAProxy-WI
|
15. Send notifications to telegram directly from HAProxy-WI
|
||||||
16. HAProxy-WI supports high Availability to ensure uptime to all Master slave servers configured
|
16. HAProxy-WI supports high Availability to ensure uptime to all Master slave servers configured
|
||||||
17. SSL certificate support.
|
17. SSL certificate support.
|
||||||
|
@ -45,7 +45,7 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi
|
||||||
28. Mobile-ready desing
|
28. Mobile-ready desing
|
||||||
29. REST API
|
29. REST API
|
||||||
30. Installation and Upgrading HAProxy service via HAProxy-WI
|
30. Installation and Upgrading HAProxy service via HAProxy-WI
|
||||||
31. Backup HAProxy's config files through HAProxy-WI
|
31. Backup HAProxy's and Keepalived's config files through HAProxy-WI
|
||||||
|
|
||||||
![alt text](image/haproxy-wi-metrics.png "Merics")
|
![alt text](image/haproxy-wi-metrics.png "Merics")
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ HAProxy-WI was tested on EL7, EL8 and all scripts too. Debian/Ubuntu OS support
|
||||||
|
|
||||||
# Database support
|
# Database support
|
||||||
|
|
||||||
Default Haproxy-WI use Sqlite, if you want use MySQL enable in config, and create database:
|
Default HAProxy-WI use Sqlite, if you want use MySQL enable in config, and create database:
|
||||||
|
|
||||||
### For MySQL support:
|
### For MySQL support:
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,6 +13,7 @@ funct.check_login()
|
||||||
|
|
||||||
form = funct.form
|
form = funct.form
|
||||||
serv = form.getvalue('serv')
|
serv = form.getvalue('serv')
|
||||||
|
service = form.getvalue('service')
|
||||||
config_read = ""
|
config_read = ""
|
||||||
cfg = ""
|
cfg = ""
|
||||||
stderr = ""
|
stderr = ""
|
||||||
|
@ -23,25 +24,44 @@ try:
|
||||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||||
user_id = cookie.get('uuid')
|
user_id = cookie.get('uuid')
|
||||||
user = sql.get_user_name_by_uuid(user_id.value)
|
user = sql.get_user_name_by_uuid(user_id.value)
|
||||||
servers = sql.get_dick_permit()
|
|
||||||
token = sql.get_token(user_id.value)
|
token = sql.get_token(user_id.value)
|
||||||
role = sql.get_user_role_by_uuid(user_id.value)
|
role = sql.get_user_role_by_uuid(user_id.value)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
|
||||||
|
if service == 'keepalived':
|
||||||
|
title = "Working with Keepalived configs"
|
||||||
|
action = "config.py?service=keepalived"
|
||||||
|
configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir')
|
||||||
|
format = 'conf'
|
||||||
|
servers = sql.is_master("123", master_slave=1)
|
||||||
|
keepalived = 1
|
||||||
|
else:
|
||||||
|
title = "Working with HAProxy configs"
|
||||||
|
action = "config.py"
|
||||||
|
configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
||||||
|
format = 'cfg'
|
||||||
|
servers = sql.get_dick_permit()
|
||||||
|
keepalived = 0
|
||||||
|
|
||||||
if serv is not None:
|
if serv is not None:
|
||||||
cfg = hap_configs_dir + serv + "-" + funct.get_data('config') + ".cfg"
|
cfg = configs_dir + serv + "-" + funct.get_data('config') + "."+format
|
||||||
|
|
||||||
if serv is not None and form.getvalue('open') is not None :
|
if serv is not None and form.getvalue('open') is not None :
|
||||||
|
|
||||||
try:
|
if service == 'keepalived':
|
||||||
funct.logging(serv, "config.py open config")
|
error = funct.get_config(serv, cfg, keepalived=1)
|
||||||
except:
|
try:
|
||||||
pass
|
funct.logging(serv, "keepalivedconfig.py open config")
|
||||||
|
except:
|
||||||
error = funct.get_config(serv, cfg)
|
pass
|
||||||
|
else:
|
||||||
|
error = funct.get_config(serv, cfg)
|
||||||
|
try:
|
||||||
|
funct.logging(serv, "config.py open config")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conf = open(cfg, "r")
|
conf = open(cfg, "r")
|
||||||
|
@ -67,17 +87,20 @@ if serv is not None and form.getvalue('config') is not None:
|
||||||
conf.write(config)
|
conf.write(config)
|
||||||
except IOError:
|
except IOError:
|
||||||
error = "Can't read import config file"
|
error = "Can't read import config file"
|
||||||
|
|
||||||
stderr = funct.master_slave_upload_and_restart(serv, cfg, just_save=save)
|
if service == 'keepalived':
|
||||||
|
stderr = funct.upload_and_restart(serv, cfg, just_save=save, keepalived=1)
|
||||||
|
else:
|
||||||
|
stderr = funct.master_slave_upload_and_restart(serv, cfg, just_save=save)
|
||||||
|
|
||||||
funct.diff_config(oldcfg, cfg)
|
funct.diff_config(oldcfg, cfg)
|
||||||
|
|
||||||
os.system("/bin/rm -f " + hap_configs_dir + "*.old")
|
os.system("/bin/rm -f " + configs_dir + "*.old")
|
||||||
|
|
||||||
|
|
||||||
template = template.render(h2 = 1, title = "Working with HAProxy configs",
|
template = template.render(h2 = 1, title = title,
|
||||||
role = role,
|
role = role,
|
||||||
action = "config.py",
|
action = action,
|
||||||
user = user,
|
user = user,
|
||||||
select_id = "serv",
|
select_id = "serv",
|
||||||
serv = serv,
|
serv = serv,
|
||||||
|
@ -89,5 +112,6 @@ template = template.render(h2 = 1, title = "Working with HAProxy configs",
|
||||||
error = error,
|
error = error,
|
||||||
note = 1,
|
note = 1,
|
||||||
versions = funct.versions(),
|
versions = funct.versions(),
|
||||||
|
keepalived = keepalived,
|
||||||
token = token)
|
token = token)
|
||||||
print(template)
|
print(template)
|
||||||
|
|
19
app/funct.py
19
app/funct.py
|
@ -170,7 +170,7 @@ def return_ssh_keys_path(serv, **kwargs):
|
||||||
ssh_user_name = ''
|
ssh_user_name = ''
|
||||||
ssh_user_password = ''
|
ssh_user_password = ''
|
||||||
|
|
||||||
if kwargs.get('id') != '':
|
if kwargs.get('id'):
|
||||||
for sshs in sql.select_ssh(id=kwargs.get('id')):
|
for sshs in sql.select_ssh(id=kwargs.get('id')):
|
||||||
ssh_enable = sshs[2]
|
ssh_enable = sshs[2]
|
||||||
ssh_user_name = sshs[3]
|
ssh_user_name = sshs[3]
|
||||||
|
@ -203,9 +203,9 @@ def ssh_connect(serv, **kwargs):
|
||||||
try:
|
try:
|
||||||
if ssh_enable == 1:
|
if ssh_enable == 1:
|
||||||
k = paramiko.RSAKey.from_private_key_file(ssh_key_name)
|
k = paramiko.RSAKey.from_private_key_file(ssh_key_name)
|
||||||
ssh.connect(hostname = serv, port = ssh_port, username = ssh_user_name, pkey = k)
|
ssh.connect(hostname = serv, port = ssh_port, username = ssh_user_name, pkey = k, timeout=11)
|
||||||
else:
|
else:
|
||||||
ssh.connect(hostname = serv, port = ssh_port, username = ssh_user_name, password = ssh_user_password)
|
ssh.connect(hostname = serv, port = ssh_port, username = ssh_user_name, password = ssh_user_password, timeout=11)
|
||||||
return ssh
|
return ssh
|
||||||
except paramiko.AuthenticationException:
|
except paramiko.AuthenticationException:
|
||||||
return 'Authentication failed, please verify your credentials'
|
return 'Authentication failed, please verify your credentials'
|
||||||
|
@ -235,7 +235,13 @@ def get_config(serv, cfg, **kwargs):
|
||||||
ssh = ssh_connect(serv)
|
ssh = ssh_connect(serv)
|
||||||
try:
|
try:
|
||||||
sftp = ssh.open_sftp()
|
sftp = ssh.open_sftp()
|
||||||
|
except Exception as e:
|
||||||
|
logging('localhost', ssh, haproxywi=1)
|
||||||
|
try:
|
||||||
sftp.get(config_path, cfg)
|
sftp.get(config_path, cfg)
|
||||||
|
except Exception as e:
|
||||||
|
logging('localhost', ssh, haproxywi=1)
|
||||||
|
try:
|
||||||
sftp.close()
|
sftp.close()
|
||||||
ssh.close()
|
ssh.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -526,15 +532,16 @@ def upload_and_restart(serv, cfg, **kwargs):
|
||||||
return error
|
return error
|
||||||
|
|
||||||
|
|
||||||
def master_slave_upload_and_restart(serv, cfg, just_save):
|
def master_slave_upload_and_restart(serv, cfg, just_save, **kwargs):
|
||||||
import sql
|
import sql
|
||||||
MASTERS = sql.is_master(serv)
|
MASTERS = sql.is_master(serv)
|
||||||
error = ""
|
error = ""
|
||||||
for master in MASTERS:
|
for master in MASTERS:
|
||||||
if master[0] != None:
|
if master[0] != None:
|
||||||
error += upload_and_restart(master[0], cfg, just_save=just_save)
|
error += upload_and_restart(master[0], cfg, just_save=just_save)
|
||||||
|
|
||||||
error += upload_and_restart(serv, cfg, just_save=just_save)
|
error += upload_and_restart(serv, cfg, just_save=just_save)
|
||||||
|
|
||||||
return error
|
return error
|
||||||
|
|
||||||
|
|
||||||
|
@ -730,7 +737,7 @@ def get_files(dir = get_config_var('configs', 'haproxy_save_configs_dir'), forma
|
||||||
file.add(files.split('/')[-1])
|
file.add(files.split('/')[-1])
|
||||||
files = sorted(file, reverse=True)
|
files = sorted(file, reverse=True)
|
||||||
|
|
||||||
if format == 'cfg':
|
if format == 'cfg' or format == 'conf':
|
||||||
for file in files:
|
for file in files:
|
||||||
ip = file.split("-")
|
ip = file.split("-")
|
||||||
if serv == ip[0]:
|
if serv == ip[0]:
|
||||||
|
|
|
@ -50,6 +50,7 @@ for s in servers:
|
||||||
servers_with_status.append(out1)
|
servers_with_status.append(out1)
|
||||||
servers_with_status.append(s[12])
|
servers_with_status.append(s[12])
|
||||||
servers_with_status.append(sql.is_master(s[2]))
|
servers_with_status.append(sql.is_master(s[2]))
|
||||||
|
servers_with_status.append(sql.select_servers(server=s[2]))
|
||||||
|
|
||||||
servers_with_status1.append(servers_with_status)
|
servers_with_status1.append(servers_with_status)
|
||||||
|
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
import html
|
|
||||||
import cgi
|
|
||||||
import os
|
|
||||||
import http.cookies
|
|
||||||
import funct
|
|
||||||
import sql
|
|
||||||
from jinja2 import Environment, FileSystemLoader
|
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
|
||||||
template = env.get_template('config.html')
|
|
||||||
|
|
||||||
print('Content-type: text/html\n')
|
|
||||||
funct.check_login()
|
|
||||||
funct.page_for_admin(level = 2)
|
|
||||||
|
|
||||||
form = funct.form
|
|
||||||
serv = form.getvalue('serv')
|
|
||||||
log_path = funct.get_config_var('main', 'log_path')
|
|
||||||
kp_save_configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir')
|
|
||||||
config_read = ""
|
|
||||||
cfg = ""
|
|
||||||
stderr = ""
|
|
||||||
aftersave = ""
|
|
||||||
error = ""
|
|
||||||
|
|
||||||
try:
|
|
||||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
|
||||||
user_id = cookie.get('uuid')
|
|
||||||
user = sql.get_user_name_by_uuid(user_id.value)
|
|
||||||
servers = sql.is_master("123", master_slave=1)
|
|
||||||
token = sql.get_token(user_id.value)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
if serv is not None:
|
|
||||||
cfg = kp_save_configs_dir+ serv + '-' + funct.get_data('config') + '.conf'
|
|
||||||
|
|
||||||
if form.getvalue('serv') is not None and form.getvalue('open') is not None :
|
|
||||||
|
|
||||||
try:
|
|
||||||
funct.logging(serv, "keepalivedconfig.py open config")
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
error = funct.get_config(serv, cfg, keepalived=1)
|
|
||||||
|
|
||||||
try:
|
|
||||||
conf = open(cfg, "r",encoding='utf-8', errors='ignore')
|
|
||||||
config_read = conf.read()
|
|
||||||
conf.close
|
|
||||||
except IOError:
|
|
||||||
error += "<br>Can't read import config file"
|
|
||||||
|
|
||||||
os.system("/bin/mv %s %s.old" % (cfg, cfg))
|
|
||||||
|
|
||||||
if form.getvalue('serv') is not None and form.getvalue('config') is not None:
|
|
||||||
try:
|
|
||||||
funct.logging(serv, "keepalivedconfig.py edited config")
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
config = form.getvalue('config')
|
|
||||||
oldcfg = form.getvalue('oldconfig')
|
|
||||||
save = form.getvalue('save')
|
|
||||||
aftersave = 1
|
|
||||||
try:
|
|
||||||
with open(cfg, "a") as conf:
|
|
||||||
conf.write(config)
|
|
||||||
except IOError:
|
|
||||||
error += "Can't read import config file"
|
|
||||||
|
|
||||||
stderr = funct.upload_and_restart(serv, cfg, just_save=save, keepalived=1)
|
|
||||||
|
|
||||||
funct.diff_config(oldcfg, cfg)
|
|
||||||
|
|
||||||
os.system("/bin/rm -f " + kp_save_configs_dir + "*.old")
|
|
||||||
|
|
||||||
output_from_parsed_template = template.render(h2 = 1, title = "Edit Runnig Keepalived config",
|
|
||||||
role = sql.get_user_role_by_uuid(user_id.value),
|
|
||||||
action = "keepalivedconfig.py",
|
|
||||||
user = user,
|
|
||||||
select_id = "serv",
|
|
||||||
serv = serv,
|
|
||||||
aftersave = aftersave,
|
|
||||||
config = config_read,
|
|
||||||
cfg = cfg,
|
|
||||||
selects = servers,
|
|
||||||
stderr = stderr,
|
|
||||||
error = error,
|
|
||||||
keepalived = 1,
|
|
||||||
versions = funct.versions(),
|
|
||||||
token = token)
|
|
||||||
print(output_from_parsed_template)
|
|
|
@ -162,12 +162,20 @@ if act == "overview":
|
||||||
server_status = ()
|
server_status = ()
|
||||||
commands2 = [ "ps ax |grep waf/bin/modsecurity |grep -v grep |wc -l" ]
|
commands2 = [ "ps ax |grep waf/bin/modsecurity |grep -v grep |wc -l" ]
|
||||||
cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Process_num"' % (serv2, sql.get_setting('haproxy_sock_port'))
|
cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Process_num"' % (serv2, sql.get_setting('haproxy_sock_port'))
|
||||||
|
keepalived = sql.select_keealived(serv2)
|
||||||
|
if keepalived == 1:
|
||||||
|
command = [ "ps ax |grep keepalived|grep -v grep|wc -l" ]
|
||||||
|
keepalived_process = funct.ssh_command(serv2, command)
|
||||||
|
else:
|
||||||
|
keepalived_process = ''
|
||||||
server_status = (serv1,
|
server_status = (serv1,
|
||||||
serv2,
|
serv2,
|
||||||
funct.server_status(funct.subprocess_execute(cmd)),
|
funct.server_status(funct.subprocess_execute(cmd)),
|
||||||
sql.select_servers(server=serv2, keep_alive=1),
|
sql.select_servers(server=serv2, keep_alive=1),
|
||||||
funct.ssh_command(serv2, commands2),
|
funct.ssh_command(serv2, commands2),
|
||||||
sql.select_waf_servers(serv2))
|
sql.select_waf_servers(serv2),
|
||||||
|
sql.select_keealived(serv2),
|
||||||
|
keepalived_process)
|
||||||
return server_status
|
return server_status
|
||||||
|
|
||||||
|
|
||||||
|
@ -563,13 +571,16 @@ if serv is not None and form.getvalue('right') is not None:
|
||||||
|
|
||||||
|
|
||||||
if serv is not None and act == "configShow":
|
if serv is not None and act == "configShow":
|
||||||
hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
if form.getvalue('service') == 'keepalived':
|
||||||
|
configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir')
|
||||||
|
else:
|
||||||
|
configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
||||||
|
|
||||||
if form.getvalue('configver') is None:
|
if form.getvalue('configver') is None:
|
||||||
cfg = hap_configs_dir + serv + "-" + funct.get_data('config') + ".cfg"
|
cfg = configs_dir + serv + "-" + funct.get_data('config') + ".cfg"
|
||||||
funct.get_config(serv, cfg)
|
funct.get_config(serv, cfg)
|
||||||
else:
|
else:
|
||||||
cfg = hap_configs_dir + form.getvalue('configver')
|
cfg = configs_dir + form.getvalue('configver')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conf = open(cfg, "r")
|
conf = open(cfg, "r")
|
||||||
|
@ -580,7 +591,11 @@ if serv is not None and act == "configShow":
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True, trim_blocks=True, lstrip_blocks=True, extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True, trim_blocks=True, lstrip_blocks=True, extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
|
||||||
template = env.get_template('config_show.html')
|
template = env.get_template('config_show.html')
|
||||||
|
|
||||||
template = template.render(conf=conf, view=form.getvalue('view'), serv=serv, configver=form.getvalue('configver'), role=funct.is_admin(level=2))
|
template = template.render(conf=conf,
|
||||||
|
serv=serv,
|
||||||
|
configver=form.getvalue('configver'),
|
||||||
|
role=funct.is_admin(level=2),
|
||||||
|
service=form.getvalue('service'))
|
||||||
print(template)
|
print(template)
|
||||||
|
|
||||||
if form.getvalue('configver') is None:
|
if form.getvalue('configver') is None:
|
||||||
|
@ -665,6 +680,8 @@ if form.getvalue('master'):
|
||||||
|
|
||||||
os.system("rm -f %s" % script)
|
os.system("rm -f %s" % script)
|
||||||
sql.update_server_master(master, slave)
|
sql.update_server_master(master, slave)
|
||||||
|
sql.update_keepalived(master)
|
||||||
|
sql.update_keepalived(slave)
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('masteradd'):
|
if form.getvalue('masteradd'):
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
<h4>Config from {{serv}}</h4>
|
<h4>Config from {{serv}}</h4>
|
||||||
<p class="accordion-expand-holder">
|
<p class="accordion-expand-holder">
|
||||||
{% if role %}
|
{% if role %}
|
||||||
|
{% if service != 'keepalived' %}
|
||||||
<a class="ui-button ui-widget ui-corner-all" title="Edit this run config" href="config.py?serv={{serv}}&open=open">Edit</a>
|
<a class="ui-button ui-widget ui-corner-all" title="Edit this run config" href="config.py?serv={{serv}}&open=open">Edit</a>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="accordion-expand-all ui-button ui-widget ui-corner-all" href="#">Expand all</a>
|
<a class="accordion-expand-all ui-button ui-widget ui-corner-all" href="#">Expand all</a>
|
||||||
<button id="raw">Raw</button>
|
<button id="raw">Raw</button>
|
||||||
|
@ -27,9 +29,11 @@
|
||||||
{% if line.startswith('global') %}
|
{% if line.startswith('global') %}
|
||||||
<span class="param">{{ line }}
|
<span class="param">{{ line }}
|
||||||
{% if role %}
|
{% if role %}
|
||||||
<span class="accordion-link">
|
{% if service != 'keepalived' %}
|
||||||
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit</a>
|
<span class="accordion-link">
|
||||||
</span>
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit</a>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span><div>
|
</span><div>
|
||||||
{% continue %}
|
{% continue %}
|
||||||
|
@ -171,13 +175,15 @@
|
||||||
{% if configver %}
|
{% if configver %}
|
||||||
<br>
|
<br>
|
||||||
<center>
|
<center>
|
||||||
<form action="versions.py#conf" method="post">
|
<form action="versions.py?service={{service}}" method="post">
|
||||||
<input type="hidden" value="{{serv}}" name="serv">
|
<input type="hidden" value="{{serv}}" name="serv">
|
||||||
<input type="hidden" value="{{configver}}" name="configver">
|
<input type="hidden" value="{{configver}}" name="configver">
|
||||||
<input type="hidden" value="1" name="config">
|
<input type="hidden" value="1" name="config">
|
||||||
<button type='submit' value='save' name='save' class='btn btn-default'>Just save</button>
|
<button type='submit' value='save' name='save' class='btn btn-default'>Just save</button>
|
||||||
<button type='submit' value='' name='' class='btn btn-default'>Upload and restart</button>
|
<button type='submit' value='' name='' class='btn btn-default'>Upload and restart</button>
|
||||||
|
{% if service != 'keepalived' %}
|
||||||
<button type='submit' value='reload' name='save' class='btn btn-default'>Upload and reload</button>
|
<button type='submit' value='reload' name='save' class='btn btn-default'>Upload and reload</button>
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
<div class="alert alert-info"><b>Note:</b> If you reconfigure Master server, Slave will reconfigured automatically</div>
|
<div class="alert alert-info"><b>Note:</b> If you reconfigure Master server, Slave will reconfigured automatically</div>
|
||||||
</center>
|
</center>
|
||||||
|
|
|
@ -11,11 +11,22 @@
|
||||||
<span class="serverDown server-status" style="margin-left: 25px !important;"></span>
|
<span class="serverDown server-status" style="margin-left: 25px !important;"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
{% if service.6|int() == 0 %}
|
||||||
|
<span class="serverNone server-status" title="Keepalived is not installed" style="margin-left: 4px !important;"></span>
|
||||||
|
{% else %}
|
||||||
|
{% if service.7|int() >= 1 %}
|
||||||
|
<span class="serverUp server-status" title="running {{service.7 }} processes" style="margin-left: 4px !important;"></span>
|
||||||
|
{% else %}
|
||||||
|
<span class="serverDown server-status" title="Keepalived is down" style="margin-left: 4px !important;"></span>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
<td class="third-collumn-wi">
|
<td class="third-collumn-wi">
|
||||||
{% if service.5.0|length() == 0 %}
|
{% if service.5.0|length() == 0 %}
|
||||||
<span class="serverNone server-status" title="WAF is not installed" style="margin-left: 4px !important;"></span>
|
<span class="serverNone server-status" title="WAF is not installed" style="margin-left: 4px !important;"></span>
|
||||||
{% elif service.5.0 != '' and service.4|int() == 0 %}
|
{% elif service.5.0 != '' and service.4|int() == 0 %}
|
||||||
<span class="serverDown server-status" title="WAF down" style="margin-left: 4px !important;"></span>
|
<span class="serverDown server-status" title="WAF is down" style="margin-left: 4px !important;"></span>
|
||||||
{% elif service.5.0 != '' and service.4|int() >= 1 %}
|
{% elif service.5.0 != '' and service.4|int() >= 1 %}
|
||||||
<span class="serverUp server-status" title="running {{service.4 }} processes" style="margin-left: 4px !important;"></span>
|
<span class="serverUp server-status" title="running {{service.4 }} processes" style="margin-left: 4px !important;"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -83,7 +83,8 @@
|
||||||
<a title="Keepalived" class="ha">Keepalived</a>
|
<a title="Keepalived" class="ha">Keepalived</a>
|
||||||
<ul class="v_menu">
|
<ul class="v_menu">
|
||||||
<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/config.py?service=keepalived" title="Edit keepalived config" class="edit head-submenu">Edit config</a></li>
|
||||||
|
<li><a href="/app/versions.py?service=keepalived" title="Actions with Keepalived configs versions" class="version head-submenu keepalived_versions">Versions</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="p_menu">
|
<li class="p_menu">
|
||||||
|
|
|
@ -39,7 +39,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if role <= 2 %}
|
{% if role <= 2 %}
|
||||||
<button type="submit" value="open" name="open" class="btn btn-default" title="Edit running config">Edit</button>
|
<button type="submit" value="open" name="open" class="btn btn-default" title="Edit running config">Edit</button>
|
||||||
|
<a class="ui-button ui-widget ui-corner-all" title="Show versions" onclick="openVersions()">Versions</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
|
@ -82,7 +83,6 @@
|
||||||
<div class="alert alert-success">Config is ok</div>
|
<div class="alert alert-success">Config is ok</div>
|
||||||
<a href="viewsttats.py?serv={{ serv }}" target="_blank" title="View stats">Go to view stats</a>
|
<a href="viewsttats.py?serv={{ serv }}" target="_blank" title="View stats">Go to view stats</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script>window.history.pushState("Config", "Config", cur_url[0])</script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</center>
|
</center>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
</select>
|
</select>
|
||||||
<input type="hidden" value="{{serv}}" name="serv">
|
<input type="hidden" value="{{serv}}" name="serv">
|
||||||
<input type="hidden" value="open" name="open">
|
<input type="hidden" value="open" name="open">
|
||||||
|
<input type="hidden" value="{{service}}" name="service" id="service">
|
||||||
<a class="ui-button ui-widget ui-corner-all" id="show" title="Enter" onclick="showUploadConfig()">Select</a>
|
<a class="ui-button ui-widget ui-corner-all" id="show" title="Enter" onclick="showUploadConfig()">Select</a>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -42,7 +43,7 @@
|
||||||
<div class="alert alert-success">Config is ok</div>
|
<div class="alert alert-success">Config is ok</div>
|
||||||
<a href="viewsttats.py?serv={{ serv }}" target="_blank" title="View stats">Go to view stats</a>
|
<a href="viewsttats.py?serv={{ serv }}" target="_blank" title="View stats">Go to view stats</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script>window.history.pushState("Config", "Config", cur_url[0])</script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</center>
|
</center>
|
||||||
{% if aftersave != 1 %}
|
{% if aftersave != 1 %}
|
||||||
|
|
|
@ -10,19 +10,19 @@
|
||||||
</form>
|
</form>
|
||||||
{% if not aftersave and not open %}
|
{% if not aftersave and not open %}
|
||||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||||
Here you can work with previous versions of HAProxy configs. Roll back to them, view or delete
|
Here you can work with previous versions of {%if service == 'keepalived' %}Keepalived{%else%}HAProxy{%endif%} configs. Roll back to them, view or delete
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% if open %}
|
{% if open %}
|
||||||
<center>
|
<center>
|
||||||
<h4>Choose old version</h4>
|
<h4>Choose old version</h4>
|
||||||
<form action="versions.py#conf" method="post">
|
<form action="{{action}}" method="post">
|
||||||
<label for="select_all" id="label_select_all"><b>Select all</b></label>
|
<label for="select_all" id="label_select_all"><b>Select all</b></label>
|
||||||
<input type="checkbox" id="select_all"><br />
|
<input type="checkbox" id="select_all"><br />
|
||||||
{% for file in return_files %}
|
{% for file in return_files %}
|
||||||
<label for="{{file}}"> {{file.split('-', maxsplit=1)[1]}} </label><input type="checkbox" value="{{file}}" name="{{file}}" id="{{file}}">
|
<label for="{{file}}"> {{file.split('-', maxsplit=1)[1]}} </label><input type="checkbox" value="{{file}}" name="{{file}}" id="{{file}}">
|
||||||
<a href="/app/versions.py?serv={{serv}}&open=open&configver={{file}}" class="ui-button ui-widget ui-corner-all" title="View and upload this version of the config" style="margin-top: -6px;">
|
<a href="/app/versions.py?serv={{serv}}&open=open&configver={{file}}&service={{service}}" class="ui-button ui-widget ui-corner-all" title="View and upload this version of the config" style="margin-top: -6px;">
|
||||||
Upload
|
Upload
|
||||||
</a><br />
|
</a><br />
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% from 'include/input_macros.html' import input, checkbox, select %}
|
||||||
<script src="/inc/overview.js"></script>
|
<script src="/inc/overview.js"></script>
|
||||||
{% if serv %}
|
{% if serv %}
|
||||||
<style>
|
<style>
|
||||||
|
@ -30,21 +31,21 @@
|
||||||
</script>
|
</script>
|
||||||
<div id="up-pannel">
|
<div id="up-pannel">
|
||||||
{% for s in servers %}
|
{% for s in servers %}
|
||||||
{% if serv %}
|
{% if serv %}
|
||||||
<link href="/inc/chart.min.css" rel="stylesheet">
|
<link href="/inc/chart.min.css" rel="stylesheet">
|
||||||
<script src="/inc/metrics.js"></script>
|
<script src="/inc/metrics.js"></script>
|
||||||
<script src="/inc/chart.min.js"></script>
|
<script src="/inc/chart.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function showMetrics() {
|
function showMetrics() {
|
||||||
{% for s in servers %}
|
{% for s in servers %}
|
||||||
getChartData('{{s.2}}')
|
getChartData('{{s.2}}')
|
||||||
getWafChartData('{{s.2}}')
|
getWafChartData('{{s.2}}')
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
showOverviewServer('{{s.1}}', '{{s.2}}', '{{s.0}}');
|
showOverviewServer('{{s.1}}', '{{s.2}}', '{{s.0}}');
|
||||||
}
|
}
|
||||||
showMetrics();
|
showMetrics();
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="div-pannel" id="div-pannel-{{s.0}}">
|
<div class="div-pannel" id="div-pannel-{{s.0}}">
|
||||||
<div id="div-server-{{s.0}}" class="div-server-hapwi">
|
<div id="div-server-{{s.0}}" class="div-server-hapwi">
|
||||||
<div class="server-name">
|
<div class="server-name">
|
||||||
|
|
|
@ -15,11 +15,14 @@
|
||||||
<td class="padding10 first-collumn-wi">
|
<td class="padding10 first-collumn-wi">
|
||||||
Server
|
Server
|
||||||
</td>
|
</td>
|
||||||
<td class="padding10 third-collumn-wi" style="width: 35%;">
|
<td class="padding10 third-collumn-wi" style="width: 27%;">
|
||||||
<a href="/app/hapservers.py" title="HAProxy servers overview" class="logs_link">
|
<a href="/app/hapservers.py" title="HAProxy servers overview" class="logs_link">
|
||||||
HAProxy
|
HAProxy
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="padding10">
|
||||||
|
Keealived
|
||||||
|
</td>
|
||||||
<td class="padding10">
|
<td class="padding10">
|
||||||
<a href="/app/waf.py" title="WAf servers overview" class="logs_link">
|
<a href="/app/waf.py" title="WAf servers overview" class="logs_link">
|
||||||
WAF
|
WAF
|
||||||
|
@ -98,10 +101,10 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if role <= 1 %}
|
{% if role <= 1 %}
|
||||||
<a href="/app/viewlogs.py?viewlogs=keep_alive.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View keep alive logs" class="logs_link">
|
<a href="/app/viewlogs.py?viewlogs=keep_alive.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View keep alive logs" class="logs_link">
|
||||||
<span>Keep alive</span>
|
<span>Auto start</span>
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span>Keep alive</span>
|
<span>Auto star</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -16,10 +16,10 @@ form = funct.form
|
||||||
serv = form.getvalue('serv')
|
serv = form.getvalue('serv')
|
||||||
Select = form.getvalue('del')
|
Select = form.getvalue('del')
|
||||||
configver = form.getvalue('configver')
|
configver = form.getvalue('configver')
|
||||||
|
service = form.getvalue('service')
|
||||||
stderr = ""
|
stderr = ""
|
||||||
aftersave = ""
|
aftersave = ""
|
||||||
file = set()
|
file = set()
|
||||||
hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
|
||||||
|
|
||||||
if form.getvalue('configver'):
|
if form.getvalue('configver'):
|
||||||
template = env.get_template('configver.html')
|
template = env.get_template('configver.html')
|
||||||
|
@ -28,52 +28,69 @@ try:
|
||||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||||
user_id = cookie.get('uuid')
|
user_id = cookie.get('uuid')
|
||||||
user = sql.get_user_name_by_uuid(user_id.value)
|
user = sql.get_user_name_by_uuid(user_id.value)
|
||||||
servers = sql.get_dick_permit(disable=0)
|
|
||||||
token = sql.get_token(user_id.value)
|
token = sql.get_token(user_id.value)
|
||||||
|
servers = sql.get_dick_permit(disable=0)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if service == 'keepalived':
|
||||||
|
title = "Working with versions Keepalived configs"
|
||||||
|
files = funct.get_files(dir=funct.get_config_var('configs', 'kp_save_configs_dir'), format='conf')
|
||||||
|
action = 'versions.py?service=keepalived'
|
||||||
|
configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir')
|
||||||
|
format = 'conf'
|
||||||
|
else:
|
||||||
|
title = "Working with versions HAProxy configs"
|
||||||
|
files = funct.get_files()
|
||||||
|
action = "versions.py"
|
||||||
|
configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
||||||
|
format = 'cfg'
|
||||||
|
|
||||||
|
|
||||||
if serv is not None and form.getvalue('del') is not None:
|
if serv is not None and form.getvalue('del') is not None:
|
||||||
if Select is not None:
|
if Select is not None:
|
||||||
aftersave = 1
|
aftersave = 1
|
||||||
for get in form:
|
for get in form:
|
||||||
if "cfg" in get:
|
if format in get:
|
||||||
try:
|
try:
|
||||||
os.remove(os.path.join(hap_configs_dir, form.getvalue(get)))
|
os.remove(os.path.join(configs_dir, form.getvalue(get)))
|
||||||
file.add(form.getvalue(get) + "<br />")
|
file.add(form.getvalue(get) + "<br />")
|
||||||
funct.logging(serv, "versions.py were deleted configs: %s" % form.getvalue(get))
|
funct.logging(serv, "versions.py were deleted configs: %s" % form.getvalue(get))
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
stderr = "Error: %s - %s." % (e.filename,e.strerror)
|
stderr = "Error: %s - %s." % (e.filename,e.strerror)
|
||||||
print('<meta http-equiv="refresh" content="10; url=versions.py?serv=%s&open=open">' % form.getvalue('serv'))
|
print('<meta http-equiv="refresh" content="10; url=versions.py?serv=%s&open=open&service=%s">' % (form.getvalue('serv'), service))
|
||||||
|
|
||||||
|
|
||||||
if serv is not None and form.getvalue('config') is not None:
|
if serv is not None and form.getvalue('config') is not None:
|
||||||
configver = hap_configs_dir + configver
|
configver = configs_dir + configver
|
||||||
save = form.getvalue('save')
|
save = form.getvalue('save')
|
||||||
aftersave = 1
|
aftersave = 1
|
||||||
try:
|
try:
|
||||||
funct.logging(serv, "configver.py upload old config %s" % configver)
|
funct.logging(serv, "configver.py upload old config %s" % configver)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
if service == 'keepalived':
|
||||||
stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save)
|
stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save, keepalived=1)
|
||||||
|
else:
|
||||||
|
stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save)
|
||||||
|
|
||||||
|
|
||||||
output_from_parsed_template = template.render(h2 = 1, title = "Working with versions HAProxy configs",
|
template = template.render(h2 = 1, title = title,
|
||||||
role = sql.get_user_role_by_uuid(user_id.value),
|
role = sql.get_user_role_by_uuid(user_id.value),
|
||||||
action = "versions.py",
|
action = action,
|
||||||
user = user,
|
user = user,
|
||||||
select_id = "serv",
|
select_id = "serv",
|
||||||
serv = serv,
|
serv = serv,
|
||||||
aftersave = aftersave,
|
aftersave = aftersave,
|
||||||
return_files = funct.get_files(),
|
return_files = files,
|
||||||
selects = servers,
|
selects = servers,
|
||||||
stderr = stderr,
|
stderr = stderr,
|
||||||
open = form.getvalue('open'),
|
open = form.getvalue('open'),
|
||||||
Select = form.getvalue('del'),
|
Select = form.getvalue('del'),
|
||||||
file = file,
|
file = file,
|
||||||
versions = funct.versions(),
|
versions = funct.versions(),
|
||||||
configver = configver,
|
configver = configver,
|
||||||
token = token)
|
service = service,
|
||||||
print(output_from_parsed_template)
|
token = token)
|
||||||
|
print(template)
|
||||||
|
|
|
@ -7,16 +7,34 @@ $( function() {
|
||||||
$('.menu li ul li').each(function () {
|
$('.menu li ul li').each(function () {
|
||||||
var link = $(this).find('a').attr('href');
|
var link = $(this).find('a').attr('href');
|
||||||
var link2 = link.split('/')[2]
|
var link2 = link.split('/')[2]
|
||||||
if (cur_url[0] == link2) {
|
if (cur_url[0] == link2 && cur_url[1] != 'service=keepalived') {
|
||||||
$(this).parent().css('display', 'contents');
|
$(this).parent().css('display', 'contents');
|
||||||
$(this).parent().css('font-size', '13px');
|
$(this).parent().css('font-size', '13px');
|
||||||
$(this).parent().css('top', '0');
|
$(this).parent().css('top', '0');
|
||||||
$(this).parent().css('left', '0');
|
$(this).parent().css('left', '0');
|
||||||
$(this).parent().children().css('margin-left', '-20px');
|
$(this).parent().children().css('margin-left', '-20px');
|
||||||
$(this).parent().find('a').css('padding-left', '20px');
|
$(this).parent().find('a').css('padding-left', '20px');
|
||||||
$(this).find('a').css('padding-left', '30px');
|
$(this).find('a').css('padding-left', '30px');
|
||||||
$(this).find('a').css('border-left', '4px solid #5D9CEB');
|
$(this).find('a').css('border-left', '4px solid #5D9CEB');
|
||||||
}
|
} else if(cur_url[0] == 'versions.py' && cur_url[1] == 'service=keepalived' && link2 == 'versions.py?service=keepalived'){
|
||||||
|
$(this).parent().css('display', 'contents');
|
||||||
|
$(this).parent().css('font-size', '13px');
|
||||||
|
$(this).parent().css('top', '0');
|
||||||
|
$(this).parent().css('left', '0');
|
||||||
|
$(this).parent().children().css('margin-left', '-20px');
|
||||||
|
$(this).parent().find('a').css('padding-left', '20px');
|
||||||
|
$(this).find('a').css('padding-left', '30px');
|
||||||
|
$(this).find('a').css('border-left', '4px solid #5D9CEB');
|
||||||
|
} else if(cur_url[0] == 'config.py' && cur_url[1] == 'service=keepalived' && link2 == 'config.py?service=keepalived'){
|
||||||
|
$(this).parent().css('display', 'contents');
|
||||||
|
$(this).parent().css('font-size', '13px');
|
||||||
|
$(this).parent().css('top', '0');
|
||||||
|
$(this).parent().css('left', '0');
|
||||||
|
$(this).parent().children().css('margin-left', '-20px');
|
||||||
|
$(this).parent().find('a').css('padding-left', '20px');
|
||||||
|
$(this).find('a').css('padding-left', '30px');
|
||||||
|
$(this).find('a').css('border-left', '4px solid #5D9CEB');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -216,7 +234,11 @@ function openStats() {
|
||||||
}
|
}
|
||||||
function openVersions() {
|
function openVersions() {
|
||||||
var serv = $("#serv").val();
|
var serv = $("#serv").val();
|
||||||
var url = "versions.py?serv="+serv+"&open=open"
|
if (cur_url[1] == "service=keepalived") {
|
||||||
|
var url = "versions.py?service=keepalived&serv="+serv+"&open=open"
|
||||||
|
} else {
|
||||||
|
var url = "versions.py?serv="+serv+"&open=open"
|
||||||
|
}
|
||||||
var win = window.open(url,"_self");
|
var win = window.open(url,"_self");
|
||||||
win.focus();
|
win.focus();
|
||||||
}
|
}
|
||||||
|
@ -356,27 +378,22 @@ function showConfig() {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function showUploadConfig() {
|
function showUploadConfig() {
|
||||||
var view = $('#view').val();
|
var service = $('#service').val();
|
||||||
if(view != "1") {
|
var configver = $('#configver').val();
|
||||||
view = ""
|
var serv = $("#serv").val()
|
||||||
}
|
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
serv: $("#serv").val(),
|
serv: serv,
|
||||||
act: "configShow",
|
act: "configShow",
|
||||||
configver: $('#configver').val(),
|
configver: configver,
|
||||||
|
service: service,
|
||||||
token: $('#token').val(),
|
token: $('#token').val(),
|
||||||
view: view
|
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(data);
|
$("#ajax").html(data);
|
||||||
if(view == "1") {
|
window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+serv+"&open=open&configver="+configver+"&service="+service);
|
||||||
window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+$("#serv").val()+"&open=open&configver="+$('#configver').val()+"&view="+$('#view').val());
|
|
||||||
} else {
|
|
||||||
window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+$("#serv").val()+"&open=open&configver="+$('#configver').val());
|
|
||||||
}
|
|
||||||
$.getScript('/inc/configshow.js');
|
$.getScript('/inc/configshow.js');
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in New Issue