diff --git a/app/config.py b/app/config.py
index 976c5c37..5a52e1c6 100644
--- a/app/config.py
+++ b/app/config.py
@@ -11,7 +11,6 @@ template = env.get_template('config.html')
print('Content-type: text/html\n')
funct.check_login()
-funct.page_for_admin(level = 2)
form = cgi.FieldStorage()
serv = form.getvalue('serv')
@@ -80,7 +79,7 @@ if form.getvalue('serv') is not None and form.getvalue('config') is not None:
os.system("/bin/rm -f " + hap_configs_dir + "*.old")
-output_from_parsed_template = template.render(h2 = 1, title = "Edit Runnig HAProxy config",
+output_from_parsed_template = template.render(h2 = 1, title = "Working with HAProxy configs",
role = sql.get_user_role_by_uuid(user_id.value),
action = "config.py",
user = user,
diff --git a/app/configshow.py b/app/configshow.py
deleted file mode 100644
index c81c65e4..00000000
--- a/app/configshow.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python3
-import os
-import sql
-import http.cookies, cgi
-import funct
-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()
-form = cgi.FieldStorage()
-serv = form.getvalue('serv')
-
-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.get_dick_permit()
- token = sql.get_token(user_id.value)
-except:
- pass
-
-output_from_parsed_template = template.render(h2 = 1, title = "Show Runnig config",
- role = sql.get_user_role_by_uuid(user_id.value),
- user = user,
- onclick = "showConfig()",
- select_id = "serv",
- serv = serv,
- selects = servers,
- note = 0,
- token = token)
-print(output_from_parsed_template)
\ No newline at end of file
diff --git a/app/diff.py b/app/diff.py
deleted file mode 100644
index c49a09c1..00000000
--- a/app/diff.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python3
-import os
-import sql
-import http
-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()
-
-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.get_dick_permit()
- token = sql.get_token(user_id.value)
-except:
- pass
-
-output_from_parsed_template = template.render(h2 = 1, title = "Compare configs",
- role = sql.get_user_role_by_uuid(user_id.value),
- user = user,
- onclick = "showCompareConfigs()",
- select_id = "serv",
- selects = servers,
- token = token)
-print(output_from_parsed_template)
\ No newline at end of file
diff --git a/app/templates/ajax/config_show.html b/app/templates/ajax/config_show.html
index 0e82ca1d..f0c0c169 100644
--- a/app/templates/ajax/config_show.html
+++ b/app/templates/ajax/config_show.html
@@ -5,6 +5,8 @@
{% if not view %}
Edit
{% endif %}
+
+
diff --git a/app/templates/ajax/show_compare_configs.html b/app/templates/ajax/show_compare_configs.html
index 14b7da1d..f893ac08 100644
--- a/app/templates/ajax/show_compare_configs.html
+++ b/app/templates/ajax/show_compare_configs.html
@@ -9,18 +9,17 @@
{% for file in return_files %}
{% if file == left %}
-
+
{% else %}
-
+
{% endif %}
{% endfor %}
diff --git a/app/templates/base.html b/app/templates/base.html
index 9a5839f3..badfd130 100644
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -54,15 +54,13 @@
Haproxy
-
-
- {% if user %}
+ {% if user %}
+
{% if role <= 2 %}
-
-
+
@@ -101,7 +99,7 @@
diff --git a/app/templates/config.html b/app/templates/config.html
index 1b6806b1..52bd84db 100644
--- a/app/templates/config.html
+++ b/app/templates/config.html
@@ -27,10 +27,12 @@
{% endif %}
{% endfor %}
- {% if onclick %}
-
Show
- {% else %}
-
+ {% if role <= 2 %}
+
+ {% endif %}
+ {% if not keepalived %}
+
Show
+
Compare
{% endif %}
@@ -45,20 +47,24 @@
{% endif %}
{% endif %}
- {% if note %}
- Note: If you reconfigure Master server, Slave will reconfigured automatically
- {% endif %}
{% if config %}
- Config from {{ serv }}
-
+ {% if role <= 2 %}
+
+ {% if note %}
+
Note: If you reconfigure Master server, Slave will reconfigured automatically
+ {% endif %}
+
Config from {{ serv }}
+
+
+ {% endif %}
{% endif %}
{% if aftersave %}
New config was saved as: {{ cfg }}
diff --git a/app/templates/configver.html b/app/templates/configver.html
index 0853cf69..66a81629 100644
--- a/app/templates/configver.html
+++ b/app/templates/configver.html
@@ -40,9 +40,9 @@
{% for file in return_files %}
{% if file == configver %}
-
+
{% else %}
-
+
{% endif %}
{% endfor %}
diff --git a/app/templates/delver.html b/app/templates/delver.html
index cb787c2a..ea9a6b78 100644
--- a/app/templates/delver.html
+++ b/app/templates/delver.html
@@ -27,7 +27,7 @@
{% for file in return_files %}
-
+
View
{% endfor %}
diff --git a/inc/script.js b/inc/script.js
index a7d805e5..1ffe991e 100644
--- a/inc/script.js
+++ b/inc/script.js
@@ -85,6 +85,7 @@ function autoRefreshStyle(autoRefresh) {
$('.auto-refresh-resume').css('margin-left', "-25px");
$('.auto-refresh img').remove();
}
+
function setRefreshInterval(interval) {
if (interval == "0") {
Cookies.remove('auto-refresh');
@@ -317,6 +318,9 @@ function showCompare() {
} );
}
function showCompareConfigs() {
+ $("#ajax").empty();
+ $("#config").empty();
+ $(".alert-info").empty();
$.ajax( {
url: "options.py",
data: {
@@ -330,10 +334,15 @@ function showCompareConfigs() {
$("#ajax-compare").html(data);
$( "input[type=submit], button" ).button();
$( "select" ).selectmenu();
+ window.history.pushState("Compare configs", "Compare configs", cur_url[0]);
}
} );
}
function showConfig() {
+ $("#ajax").empty();
+ $("#ajax-compare").empty();
+ $("#config").empty();
+ $(".alert-info").empty();
$.ajax( {
url: "options.py",
data: {
@@ -345,6 +354,7 @@ function showConfig() {
success: function( data ) {
$("#ajax").html(data);
$.getScript('/inc/configshow.js');
+ window.history.pushState("Show config", "Show config", cur_url[0]);
}
} );
}