mirror of https://github.com/Aidaho12/haproxy-wi
parent
045f263767
commit
a58f938503
|
@ -28,9 +28,9 @@ def get_overview():
|
|||
funct.ssh_command(server[2], commands, server_status="1")
|
||||
print('</td><td>')
|
||||
if funct.is_admin():
|
||||
print('<a id="%s" class="start" title="Start HAproxy service" onclick = "if (! confirm(\'Start service?\')) return false;"><img src=/image/pic/start.png alt="start" class="icon"></a>' % server[2])
|
||||
print('<a id="%s" class="stop" title="Stop HAproxy service" onclick = "return confirm(\'Stop service?\')"><img src=/image/pic/stop.png alt="start" class="icon"></a>' % server[2])
|
||||
print('<a id="%s" class="restart" title="Restart HAproxy service" onclick = "if (! confirm(\'Restart service?\')) return false;"><img src=/image/pic/update.png alt="restart" class="icon"></a>' % server[2])
|
||||
print('<a id="%s" class="start" title="Start HAproxy service"><img src=/image/pic/start.png alt="start" class="icon"></a>' % server[2])
|
||||
print('<a id="%s" class="stop" title="Stop HAproxy service"><img src=/image/pic/stop.png alt="start" class="icon"></a>' % server[2])
|
||||
print('<a id="%s" class="restart" title="Restart HAproxy service"><img src=/image/pic/update.png alt="restart" class="icon"></a>' % server[2])
|
||||
if funct.is_admin(level = 2):
|
||||
print('<a href="/app/configshow.py?serv=%s&open=open#conf" title="Show config"><img src=/image/pic/show.png alt="show" class="icon"></a>' % server[2])
|
||||
print('<a href="/app/config.py?serv=%s&open=open#conf" title="Edit config"><img src=/image/pic/edit.png alt="edit" class="icon"></a>' % server[2])
|
||||
|
@ -51,7 +51,7 @@ def get_overviewServers():
|
|||
print('<tr><td class="overviewTr first-collumn"><a name="'+server[1]+'"></a><h3 title="IP ' + server[2] + '">' + server[1] + ':</h3></td>')
|
||||
print('<td class="overviewTd"><span>Total listen/frontend/backend:</span><pre>')
|
||||
funct.ssh_command(server[2], commands)
|
||||
print('</pre></td><td class="overviewTd"><pre>')
|
||||
print('</pre></td><td><pre>')
|
||||
funct.ssh_command(server[2], commands1)
|
||||
print('</pre></td></tr>')
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<script src="/inc/users.js"></script>
|
||||
<div id="dialog-confirm" title="Are you sure you want to delete?" style="display: none;">
|
||||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Deleting irreversibly all data will be lost?</p>
|
||||
</div>
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#users">Users</a></li>
|
||||
|
@ -50,7 +53,7 @@
|
|||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td><a class="delete" onclick="removeUser({{user.0}})" style="cursor: pointer;"></a></td>
|
||||
<td><a class="delete" onclick="confirmDeleteUser({{user.0}})" style="cursor: pointer;"></a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
@ -120,7 +123,7 @@
|
|||
<input type="text" id="descript-{{ group.0 }}" value="{{ group.2 }}" class="form-control" size="100">
|
||||
</td>
|
||||
<td>
|
||||
<a class="delete" onclick="removeGroup({{ group.0 }})" style="cursor: pointer;"></a>
|
||||
<a class="delete" onclick="confirmDeleteGroup({{ group.0 }})" style="cursor: pointer;"></a>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
|
@ -207,7 +210,7 @@
|
|||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<a class="delete" onclick="removeServer({{server.0}})" style="cursor: pointer;"></a>
|
||||
<a class="delete" onclick="confirmDeleteServer({{server.0}})" style="cursor: pointer;"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<script>
|
||||
if (cur_url[0] == overview.py) {
|
||||
$(#secIntervals).css(display, none);
|
||||
if (cur_url[0] == "overview.py") {
|
||||
$("#secIntervals").css("display", "none");
|
||||
}
|
||||
</script>
|
||||
{% if role <= 1 %}
|
||||
|
@ -84,6 +84,9 @@
|
|||
</tr>
|
||||
<tbody id="ajaxservers"></tbody>
|
||||
</table>
|
||||
<div id="dialog-confirm" style="display: none;">
|
||||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p>
|
||||
</div>
|
||||
<script>
|
||||
window.onload = showOverview()
|
||||
</script>
|
||||
|
|
|
@ -25,17 +25,17 @@ function ajaxActionServers(action, id) {
|
|||
$( function() {
|
||||
$('.start').click(function() {
|
||||
var id = $(this).attr('id');
|
||||
ajaxActionServers("start", id);
|
||||
confirmAjaxAction("start", id);
|
||||
});
|
||||
$('.stop').click(function() {
|
||||
var id = $(this).attr('id');
|
||||
ajaxActionServers("stop", id);
|
||||
confirmAjaxAction("stop", id);
|
||||
});
|
||||
$('.restart').click(function() {
|
||||
var id = $(this).attr('id');
|
||||
ajaxActionServers("restart", id);
|
||||
confirmAjaxAction("restart", id);
|
||||
});
|
||||
$ ( "#show-all-users" ).click( function() {
|
||||
$( "#show-all-users" ).click( function() {
|
||||
if($( "#show-all-users" ).text() == "Show all") {
|
||||
$( ".show-users" ).show("fast");
|
||||
$( "#show-all-users" ).text("Hide");
|
||||
|
@ -47,4 +47,22 @@ $( function() {
|
|||
}
|
||||
});
|
||||
$('#secIntervals').css('display', 'none');
|
||||
});
|
||||
});
|
||||
function confirmAjaxAction(action, id) {
|
||||
$( "#dialog-confirm" ).dialog({
|
||||
resizable: false,
|
||||
height: "auto",
|
||||
width: 400,
|
||||
modal: true,
|
||||
title: "Are you sure you want "+ action + " " + id + "?",
|
||||
buttons: {
|
||||
"Sure": function() {
|
||||
$( this ).dialog( "close" );
|
||||
ajaxActionServers(action, id);
|
||||
},
|
||||
Cancel: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
|
@ -166,7 +166,6 @@ function showMap() {
|
|||
type: "GET",
|
||||
success: function( data ) {
|
||||
$("#ajax").html(data);
|
||||
//window.history.pushState("Map", "Map", cur_url[0]+"?serv="+$("#serv").val());
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
@ -202,7 +201,6 @@ function showCompare() {
|
|||
type: "GET",
|
||||
success: function( data ) {
|
||||
$("#ajax").html(data);
|
||||
//window.history.pushState("Compare", "Compare", cur_url[0]+"?serv="+$("#serv").val()+"&open=open&left="+$("#left").val()+"&right="+$("#right").val());
|
||||
$.getScript(url);
|
||||
}
|
||||
} );
|
||||
|
@ -218,7 +216,6 @@ function showCompareConfigs() {
|
|||
type: "GET",
|
||||
success: function( data ) {
|
||||
$("#ajax-compare").html(data);
|
||||
//window.history.pushState("Compare", "Compare", cur_url[0]+"?serv="+$("#serv").val()+"&open=open");
|
||||
$.getScript(url);
|
||||
}
|
||||
} );
|
||||
|
@ -233,7 +230,6 @@ function showConfig() {
|
|||
type: "GET",
|
||||
success: function( data ) {
|
||||
$("#ajax").html(data);
|
||||
//window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+$("#serv").val()+"&open=open");
|
||||
var urlConfigShowJs = '/inc/configshow.js';
|
||||
$.getScript(urlConfigShowJs);
|
||||
}
|
||||
|
@ -726,8 +722,6 @@ $( function() {
|
|||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
//data = data.replace(/\s+/g,' ');
|
||||
//data = data.split(" ");
|
||||
if (data.indexOf('danger') != '-1') {
|
||||
$("#ajax-show-ssl").html(data);
|
||||
} else {
|
||||
|
|
137
inc/users.js
137
inc/users.js
|
@ -267,57 +267,112 @@ $( function() {
|
|||
} else {
|
||||
$('#ssh_pass').css('display', 'block');
|
||||
}
|
||||
|
||||
} );
|
||||
function confirmDeleteUser(id) {
|
||||
$( "#dialog-confirm" ).dialog({
|
||||
resizable: false,
|
||||
height: "auto",
|
||||
width: 400,
|
||||
modal: true,
|
||||
title: "Are you sure you want to delete " +$('#login-'+id).val() + "?",
|
||||
buttons: {
|
||||
"Delete": function() {
|
||||
$( this ).dialog( "close" );
|
||||
removeUser(id);
|
||||
},
|
||||
Cancel: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function confirmDeleteGroup(id) {
|
||||
$( "#dialog-confirm" ).dialog({
|
||||
resizable: false,
|
||||
height: "auto",
|
||||
width: 400,
|
||||
modal: true,
|
||||
title: "Are you sure you want to delete " +$('#name-'+id).val() + "?",
|
||||
buttons: {
|
||||
"Delete": function() {
|
||||
$( this ).dialog( "close" );
|
||||
removeGroup(id);
|
||||
},
|
||||
Cancel: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function confirmDeleteServer(id) {
|
||||
$( "#dialog-confirm" ).dialog({
|
||||
resizable: false,
|
||||
height: "auto",
|
||||
width: 400,
|
||||
modal: true,
|
||||
title: "Are you sure you want to delete " +$('#hostname-'+id).val() + "?",
|
||||
buttons: {
|
||||
"Delete": function() {
|
||||
$( this ).dialog( "close" );
|
||||
removeServer(id);
|
||||
},
|
||||
Cancel: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function removeUser(id) {
|
||||
$("#user-"+id).css("background-color", "#f2dede");
|
||||
$.ajax( {
|
||||
url: "sql.py",
|
||||
data: {
|
||||
userdel: id,
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if(data == "Ok ") {
|
||||
$("#user-"+id).remove();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
url: "sql.py",
|
||||
data: {
|
||||
userdel: id,
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if(data == "Ok ") {
|
||||
$("#user-"+id).remove();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
function removeServer(id) {
|
||||
$("#server-"+id).css("background-color", "#f2dede");
|
||||
$.ajax( {
|
||||
url: "sql.py",
|
||||
data: {
|
||||
serverdel: id,
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if(data == "Ok ") {
|
||||
$("#server-"+id).remove();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
url: "sql.py",
|
||||
data: {
|
||||
serverdel: id,
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if(data == "Ok ") {
|
||||
$("#server-"+id).remove();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
function removeGroup(id) {
|
||||
$("#group-"+id).css("background-color", "#f2dede");
|
||||
$.ajax( {
|
||||
url: "sql.py",
|
||||
data: {
|
||||
groupdel: id,
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if(data == "Ok ") {
|
||||
$("#group-"+id).remove();
|
||||
$('select:regex(id, group) option[value='+id+']').remove();
|
||||
$('select:regex(id, group)').selectmenu("refresh");
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
url: "sql.py",
|
||||
data: {
|
||||
groupdel: id,
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if(data == "Ok ") {
|
||||
$("#group-"+id).remove();
|
||||
$('select:regex(id, group) option[value='+id+']').remove();
|
||||
$('select:regex(id, group)').selectmenu("refresh");
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
function updateUser(id) {
|
||||
$('.alert-danger').remove();
|
||||
$.ajax( {
|
||||
|
|
Loading…
Reference in New Issue