Bugs
pull/19/head
Aidaho12 2018-05-03 23:22:54 +06:00
parent 24a326727a
commit 8c8ddc1820
5 changed files with 64 additions and 60 deletions

View File

@ -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<br />')
else:
print("An error occurred:", e)
return False

View File

@ -19,11 +19,11 @@ form = cgi.FieldStorage()
def get_overview():
USERS = sql.select_users()
print('<table class="overview">')
listhap = sql.get_dick_permit()
if funct.is_admin():
print('<tr class="overviewHead">'
print('<table class="overview">'
'<tr class="overviewHead">'
'<td class="padding10 first-collumn">Login</td>'
'<td class="padding10">Email</td>'
'<td class="padding10">Group</td>'
@ -45,10 +45,8 @@ def get_overview():
style = 'style="display: none;" class="show-users"'
print('<tr ' + style + '><td class="padding10 first-collumn">' + users[1] +'</td><td class="second-collumn">')
print(users[2]+'</td><td>')
GROUPS = sql.select_user_name_group(users[5])
for group in GROUPS:
print(group)
print('</td><td>')
print(sql.select_user_name_group(users[5]))
print('</td><td>')
print(users[4])
print('</td><td></td></tr>')
print('</table>')
@ -68,8 +66,6 @@ def get_overview():
'<td></td>'
'</tr>')
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('</td><td></td></tr>')
print('</table><table class="overview"><tr class="overviewHead">'
print('</table><table class="overview">'
'<tr class="overviewHead">'
'<td class="padding10 first-collumn" style="width: 15%;">Server</td>'
'<td>'
'HAproxy info'
@ -99,7 +96,7 @@ def get_overview():
'Server status'
'</td>'
'</tr>')
print('</td></tr>')
commands = [ "cat " + haproxy_config_path + " |grep -E '^listen|^backend|^frontend' |grep -v stats |wc -l",
"uname -smor",
"haproxy -v |head -1",

View File

@ -216,7 +216,8 @@ def select_user_name_group(id):
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>')
else:
return cur.fetchone()
for group in cur.fetchone():
return group
cur.close()
con.close()

49
inc/overview.js Normal file
View File

@ -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");
}
});
});

View File

@ -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");