From b6624d91f87dafca27d4dcc0bb59cc8914865b92 Mon Sep 17 00:00:00 2001
From: Aidaho12
Date: Tue, 10 Apr 2018 09:58:56 +0600
Subject: [PATCH] v1.10.2.2
More AJAX!!!!
---
cgi-bin/diff.py | 5 +-
cgi-bin/edit.py | 99 ++-------
cgi-bin/funct.py | 16 +-
cgi-bin/logs.py | 21 +-
cgi-bin/options.py | 29 +++
cgi-bin/ovw.py | 10 -
cgi-bin/viewsttats.py | 5 +-
inc/nprogress.css | 62 ++++++
inc/nprogress.js | 480 ++++++++++++++++++++++++++++++++++++++++++
inc/script.js | 65 +++++-
inc/style.css | 11 +-
11 files changed, 677 insertions(+), 126 deletions(-)
create mode 100644 inc/nprogress.css
create mode 100644 inc/nprogress.js
diff --git a/cgi-bin/diff.py b/cgi-bin/diff.py
index e5ede821..bff1a694 100644
--- a/cgi-bin/diff.py
+++ b/cgi-bin/diff.py
@@ -64,11 +64,8 @@ if form.getvalue('serv') is not None and form.getvalue('open') is not None :
print('')
print('' % serv)
print('')
- print('
')
+ print('Show')
-if form.getvalue('serv') is not None and form.getvalue('right') is not None:
- commands = [ 'diff -ub %s%s %s%s' % (hap_configs_dir, left, hap_configs_dir, right) ]
- funct.ssh_command(haproxy_configs_server, commands, compare="1")
funct.footer()
\ No newline at end of file
diff --git a/cgi-bin/edit.py b/cgi-bin/edit.py
index d8a992f5..b2c9d71a 100644
--- a/cgi-bin/edit.py
+++ b/cgi-bin/edit.py
@@ -1,63 +1,15 @@
#!/usr/bin/env python3
import html
import cgi
-import listserv as listhap
-import subprocess
-import os
-import http.cookies
import funct
-import configparser
-from funct import head as head
form = cgi.FieldStorage()
serv = form.getvalue('serv')
-action = form.getvalue('servaction')
-backend = form.getvalue('servbackend')
-
-head("Runtime API")
+funct.head("Runtime API")
funct.check_login()
funct.check_config()
-path_config = "haproxy-webintarface.config"
-config = configparser.ConfigParser()
-config.read(path_config)
-
-server_state_file = config.get('haproxy', 'server_state_file')
-haproxy_sock = config.get('haproxy', 'haproxy_sock')
-
-if backend is None:
- backend = ""
- autofocus = ""
-else:
- autofocus = "autofocus"
-
-if action == 'disable':
- selected1 = 'selected'
- selected2 = ''
- selected3 = ''
- selected4 = ''
-elif action == 'enable':
- selected1 = ''
- selected2 = 'selected'
- selected3 = ''
- selected4 = ''
-elif action == 'set':
- selected1 = ''
- selected2 = ''
- selected3 = 'selected'
- selected4 = ''
-elif action == 'show':
- selected1 = ''
- selected2 = ''
- selected3 = ''
- selected4 = 'selected'
-else:
- selected1 = ''
- selected2 = ''
- selected3 = ''
- selected4 = ''
-
print('Runtime API
'
'')
-
-if form.getvalue('servaction') is not None:
- enable = form.getvalue('servaction')
- cmd='echo "%s %s" |socat stdio %s | cut -d "," -f 1-2,5-10,34-36 | column -s, -t' % (enable, backend, haproxy_sock)
-
- if form.getvalue('save') == "on":
- save_command = 'echo "show servers state" | socat stdio %s > %s' % (haproxy_sock, server_state_file)
- command = [ cmd, save_command ]
- else:
- command = [ cmd ]
-
- if enable != "show":
- print('
' % (enable, backend, serv, serv))
-
- funct.ssh_command(serv, command, show_log="1")
- action = 'edit.py ' + enable + ' ' + backend
- funct.logging(serv, action)
+ print('')
+ print('')
+ print('')
+print(''
+ ''
+ ''
+ ''
+ ' | '
+ ''
+ ' | '
+ 'Show'
+ ' | '
+ ''
+ ''
+ '
')
funct.footer()
\ No newline at end of file
diff --git a/cgi-bin/funct.py b/cgi-bin/funct.py
index 593156f5..928501ee 100644
--- a/cgi-bin/funct.py
+++ b/cgi-bin/funct.py
@@ -22,6 +22,8 @@ path_config = "haproxy-webintarface.config"
config = configparser.ConfigParser()
config.read(path_config)
+form = cgi.FieldStorage()
+serv = form.getvalue('serv')
fullpath = config.get('main', 'fullpath')
ssh_keys = config.get('ssh', 'ssh_keys')
ssh_user_name = config.get('ssh', 'ssh_user_name')
@@ -121,11 +123,13 @@ def head(title):
''
''
''
+ ''
''
''
''
''
''
+ ''
''
''
''
@@ -140,7 +144,7 @@ def head(title):
'