mirror of https://github.com/Aidaho12/haproxy-wi
parent
24a326727a
commit
8c8ddc1820
|
@ -197,8 +197,8 @@ def update_db_v_2_0_5(**kwargs):
|
||||||
cur.execute(sql)
|
cur.execute(sql)
|
||||||
except sqltool.Error as e:
|
except sqltool.Error as e:
|
||||||
if kwargs.get('silent') != 1:
|
if kwargs.get('silent') != 1:
|
||||||
if e.args[0] == 'duplicate column name: master':
|
if e.args[0] == 'duplicate column name: master' or e == "1060 (42S21): Duplicate column name 'master' ":
|
||||||
print('Already updated. No run more. Thx =^.^=')
|
print('Updating... go to version 2.4<br />')
|
||||||
else:
|
else:
|
||||||
print("An error occurred:", e)
|
print("An error occurred:", e)
|
||||||
return False
|
return False
|
||||||
|
|
19
app/ovw.py
19
app/ovw.py
|
@ -19,11 +19,11 @@ form = cgi.FieldStorage()
|
||||||
|
|
||||||
def get_overview():
|
def get_overview():
|
||||||
USERS = sql.select_users()
|
USERS = sql.select_users()
|
||||||
|
listhap = sql.get_dick_permit()
|
||||||
print('<table class="overview">')
|
|
||||||
|
|
||||||
if funct.is_admin():
|
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 first-collumn">Login</td>'
|
||||||
'<td class="padding10">Email</td>'
|
'<td class="padding10">Email</td>'
|
||||||
'<td class="padding10">Group</td>'
|
'<td class="padding10">Group</td>'
|
||||||
|
@ -45,10 +45,8 @@ def get_overview():
|
||||||
style = 'style="display: none;" class="show-users"'
|
style = 'style="display: none;" class="show-users"'
|
||||||
print('<tr ' + style + '><td class="padding10 first-collumn">' + users[1] +'</td><td class="second-collumn">')
|
print('<tr ' + style + '><td class="padding10 first-collumn">' + users[1] +'</td><td class="second-collumn">')
|
||||||
print(users[2]+'</td><td>')
|
print(users[2]+'</td><td>')
|
||||||
GROUPS = sql.select_user_name_group(users[5])
|
print(sql.select_user_name_group(users[5]))
|
||||||
for group in GROUPS:
|
print('</td><td>')
|
||||||
print(group)
|
|
||||||
print('</td><td>')
|
|
||||||
print(users[4])
|
print(users[4])
|
||||||
print('</td><td></td></tr>')
|
print('</td><td></td></tr>')
|
||||||
print('</table>')
|
print('</table>')
|
||||||
|
@ -68,8 +66,6 @@ def get_overview():
|
||||||
'<td></td>'
|
'<td></td>'
|
||||||
'</tr>')
|
'</tr>')
|
||||||
|
|
||||||
listhap = sql.get_dick_permit()
|
|
||||||
|
|
||||||
commands = [ "ps -Af |grep [h]aproxy |wc -l" ]
|
commands = [ "ps -Af |grep [h]aproxy |wc -l" ]
|
||||||
commands1 = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
|
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)
|
funct.ssh_command(server[2], commands1)
|
||||||
print('</td><td></td></tr>')
|
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 class="padding10 first-collumn" style="width: 15%;">Server</td>'
|
||||||
'<td>'
|
'<td>'
|
||||||
'HAproxy info'
|
'HAproxy info'
|
||||||
|
@ -99,7 +96,7 @@ def get_overview():
|
||||||
'Server status'
|
'Server status'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>')
|
'</tr>')
|
||||||
print('</td></tr>')
|
|
||||||
commands = [ "cat " + haproxy_config_path + " |grep -E '^listen|^backend|^frontend' |grep -v stats |wc -l",
|
commands = [ "cat " + haproxy_config_path + " |grep -E '^listen|^backend|^frontend' |grep -v stats |wc -l",
|
||||||
"uname -smor",
|
"uname -smor",
|
||||||
"haproxy -v |head -1",
|
"haproxy -v |head -1",
|
||||||
|
|
|
@ -216,7 +216,8 @@ def select_user_name_group(id):
|
||||||
except sqltool.Error as e:
|
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>')
|
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:
|
else:
|
||||||
return cur.fetchone()
|
for group in cur.fetchone():
|
||||||
|
return group
|
||||||
cur.close()
|
cur.close()
|
||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
|
|
|
@ -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");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -106,6 +106,7 @@ function showOverview() {
|
||||||
type: "GET",
|
type: "GET",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(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() {
|
$( function() {
|
||||||
$( "#serv" ).on('selectmenuchange',function() {
|
$( "#serv" ).on('selectmenuchange',function() {
|
||||||
$("#show").css("pointer-events", "inherit");
|
$("#show").css("pointer-events", "inherit");
|
||||||
|
@ -301,20 +282,6 @@ $( function() {
|
||||||
$( "input[type=checkbox]" ).checkboxradio();
|
$( "input[type=checkbox]" ).checkboxradio();
|
||||||
$( ".controlgroup" ).controlgroup();
|
$( ".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 location = window.location.href;
|
||||||
var cur_url = '/app/' + location.split('/').pop();
|
var cur_url = '/app/' + location.split('/').pop();
|
||||||
cur_url = cur_url.split('?');
|
cur_url = cur_url.split('?');
|
||||||
|
@ -350,17 +317,7 @@ $( function() {
|
||||||
$("#label_select_all").text("Select all");
|
$("#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() {
|
$( "#listen-mode-select" ).on('selectmenuchange',function() {
|
||||||
if ($( "#listen-mode-select option:selected" ).val() == "tcp") {
|
if ($( "#listen-mode-select option:selected" ).val() == "tcp") {
|
||||||
$( "#https-listen-span" ).hide("fast");
|
$( "#https-listen-span" ).hide("fast");
|
||||||
|
|
Loading…
Reference in New Issue