diff --git a/app/create_db.py b/app/create_db.py
index cbc5ff1b..cc525e3c 100644
--- a/app/create_db.py
+++ b/app/create_db.py
@@ -197,8 +197,8 @@ def update_db_v_2_0_5(**kwargs):
cur.execute(sql)
except sqltool.Error as e:
if kwargs.get('silent') != 1:
- if e.args[0] == 'duplicate column name: master':
- print('Already updated. No run more. Thx =^.^=')
+ if e.args[0] == 'duplicate column name: master' or e == "1060 (42S21): Duplicate column name 'master' ":
+ print('Updating... go to version 2.4
')
else:
print("An error occurred:", e)
return False
diff --git a/app/ovw.py b/app/ovw.py
index cb873e52..a44e7857 100644
--- a/app/ovw.py
+++ b/app/ovw.py
@@ -19,11 +19,11 @@ form = cgi.FieldStorage()
def get_overview():
USERS = sql.select_users()
-
- print('
')
+ listhap = sql.get_dick_permit()
if funct.is_admin():
- print(''
+ print(''
+ ''
'Login | '
'Email | '
'Group | '
@@ -45,10 +45,8 @@ def get_overview():
style = 'style="display: none;" class="show-users"'
print('
' + users[1] +' | ')
print(users[2]+' | ')
- GROUPS = sql.select_user_name_group(users[5])
- for group in GROUPS:
- print(group)
- print(' | ')
+ print(sql.select_user_name_group(users[5]))
+ print(' | ')
print(users[4])
print(' | |
')
print('
')
@@ -68,8 +66,6 @@ def get_overview():
' | '
'
')
- listhap = sql.get_dick_permit()
-
commands = [ "ps -Af |grep [h]aproxy |wc -l" ]
commands1 = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
@@ -90,7 +86,8 @@ def get_overview():
funct.ssh_command(server[2], commands1)
print(' | ')
- print('
'
+ ''
'Server | '
''
'HAproxy info'
@@ -99,7 +96,7 @@ def get_overview():
'Server status'
' | '
'
')
- print('')
+
commands = [ "cat " + haproxy_config_path + " |grep -E '^listen|^backend|^frontend' |grep -v stats |wc -l",
"uname -smor",
"haproxy -v |head -1",
diff --git a/app/sql.py b/app/sql.py
index 1ce4ab58..a2c33efe 100644
--- a/app/sql.py
+++ b/app/sql.py
@@ -216,7 +216,8 @@ def select_user_name_group(id):
except sqltool.Error as e:
print('An error occurred: ' + e.args[0] + ' X')
else:
- return cur.fetchone()
+ for group in cur.fetchone():
+ return group
cur.close()
con.close()
diff --git a/inc/overview.js b/inc/overview.js
new file mode 100644
index 00000000..f3558b4a
--- /dev/null
+++ b/inc/overview.js
@@ -0,0 +1,49 @@
+var cur_url = window.location.href.split('/').pop();
+cur_url = cur_url.split('?');
+function ajaxActionServers(action, id) {
+ var bad_ans = 'Bad config, check please';
+ $.ajax( {
+ url: "options.py",
+ data: {
+ action: action,
+ serv: id
+ },
+ success: function( data ) {
+ data = data.replace(/\s+/g,' ');
+ if( data == 'Bad config, check please ' ) {
+ alert(data);
+ } else {
+ setTimeout(showOverview, 2000)
+ }
+ },
+ error: function(){
+ alert(w.data_error);
+ }
+ } );
+ }
+
+$( function() {
+ $('.start').click(function() {
+ var id = $(this).attr('id');
+ ajaxActionServers("start", id);
+ });
+ $('.stop').click(function() {
+ var id = $(this).attr('id');
+ ajaxActionServers("stop", id);
+ });
+ $('.restart').click(function() {
+ var id = $(this).attr('id');
+ ajaxActionServers("restart", id);
+ });
+ $ ( "#show-all-users" ).click( function() {
+ if($( "#show-all-users" ).text() == "Show all") {
+ $( ".show-users" ).show("fast");
+ $( "#show-all-users" ).text("Hide");
+ $( "#show-all-users" ).attr("title", "Hide all users");
+ } else {
+ $( ".show-users" ).hide("fast");
+ $( "#show-all-users" ).attr("title", "Show all users");
+ $( "#show-all-users" ).text("Show all");
+ }
+ });
+});
\ No newline at end of file
diff --git a/inc/script.js b/inc/script.js
index 7bdf67c0..4def657e 100644
--- a/inc/script.js
+++ b/inc/script.js
@@ -106,6 +106,7 @@ function showOverview() {
type: "GET",
success: function( data ) {
$("#ajax").html(data);
+ $.getScript('/inc/overview.js');
}
} );
}
@@ -236,27 +237,7 @@ function viewLogs() {
}
} );
}
-function ajaxActionServers(action, id) {
- var bad_ans = 'Bad config, check please';
- $.ajax( {
- url: "options.py",
- data: {
- action: action,
- serv: id
- },
- success: function( data ) {
- data = data.replace(/\s+/g,' ');
- if( data == 'Bad config, check please ' ) {
- alert(data);
- } else {
- setTimeout(showOverview, 2000)
- }
- },
- error: function(){
- alert(w.data_error);
- }
- } );
- }
+
$( function() {
$( "#serv" ).on('selectmenuchange',function() {
$("#show").css("pointer-events", "inherit");
@@ -301,20 +282,6 @@ $( function() {
$( "input[type=checkbox]" ).checkboxradio();
$( ".controlgroup" ).controlgroup();
-
- $('.start').click(function() {
- var id = $(this).attr('id');
- ajaxActionServers("start", id);
- });
- $('.stop').click(function() {
- var id = $(this).attr('id');
- ajaxActionServers("stop", id);
- });
- $('.restart').click(function() {
- var id = $(this).attr('id');
- ajaxActionServers("restart", id);
- });
-
var location = window.location.href;
var cur_url = '/app/' + location.split('/').pop();
cur_url = cur_url.split('?');
@@ -350,17 +317,7 @@ $( function() {
$("#label_select_all").text("Select all");
}
});
- $ ( "#show-all-users" ).click( function() {
- if($( "#show-all-users" ).text() == "Show all") {
- $( ".show-users" ).show("fast");
- $( "#show-all-users" ).text("Hide");
- $( "show-all-users" ).attr("title") = "Hide all users";
- } else {
- $( ".show-users" ).hide("fast");
- $( "#show-all-users" ).attr("title", "Show all users");
- $( "#show-all-users" ).text("Show all");
- }
- });
+
$( "#listen-mode-select" ).on('selectmenuchange',function() {
if ($( "#listen-mode-select option:selected" ).val() == "tcp") {
$( "#https-listen-span" ).hide("fast");