diff --git a/inc/awesome.css b/inc/awesome.css
index 78cf1625..5681bbee 100644
--- a/inc/awesome.css
+++ b/inc/awesome.css
@@ -92,6 +92,11 @@
font-family: "Font Awesome 5 Solid";
content: "\f074";
}
+.hap1::before {
+ display: none;
+ font-family: "Font Awesome 5 Solid";
+ content: "\f074";
+}
.backup::before {
display: none;
font-family: "Font Awesome 5 Solid";
diff --git a/inc/overview.js b/inc/overview.js
index 6e930bbd..e43b9803 100644
--- a/inc/overview.js
+++ b/inc/overview.js
@@ -134,53 +134,53 @@ function ajaxActionServers(action, id) {
} );
}
function ajaxActionNginxServers(action, id) {
- var bad_ans = 'Bad config, check please';
- $.ajax( {
- url: "options.py",
- data: {
- action_nginx: action,
- serv: id,
- token: $('#token').val()
- },
- success: function( data ) {
- data = data.replace(/\s+/g,' ');
- if( data == 'Bad config, check please ' ) {
- alert(data);
- } else {
- if (cur_url[0] == "hapservers.py") {
- location.reload()
- } else {
- setTimeout(showOverview(ip, hostnamea), 2000)
- }
- }
- },
- error: function(){
- alert(w.data_error);
- }
- } );
- }
+ var bad_ans = 'Bad config, check please';
+ $.ajax( {
+ url: "options.py",
+ data: {
+ action_nginx: action,
+ serv: id,
+ token: $('#token').val()
+ },
+ success: function( data ) {
+ data = data.replace(/\s+/g,' ');
+ if( data == 'Bad config, check please ' ) {
+ alert(data);
+ } else {
+ if (cur_url[0] == "hapservers.py") {
+ location.reload()
+ } else {
+ setTimeout(showOverview(ip, hostnamea), 2000)
+ }
+ }
+ },
+ error: function(){
+ alert(w.data_error);
+ }
+ } );
+}
function ajaxActionWafServers(action, id) {
- var bad_ans = 'Bad config, check please';
- $.ajax( {
- url: "options.py",
- data: {
- action_waf: action,
- serv: id,
- token: $('#token').val()
- },
- success: function( data ) {
- data = data.replace(/\s+/g,' ');
- if( data == 'Bad config, check please ' ) {
- alert(data);
- } else {
- setTimeout(showOverviewWaf(ip, hostnamea), 2000)
- }
- },
- error: function(){
- alert(w.data_error);
- }
- } );
- }
+ var bad_ans = 'Bad config, check please';
+ $.ajax( {
+ url: "options.py",
+ data: {
+ action_waf: action,
+ serv: id,
+ token: $('#token').val()
+ },
+ success: function( data ) {
+ data = data.replace(/\s+/g,' ');
+ if( data == 'Bad config, check please ' ) {
+ alert(data);
+ } else {
+ setTimeout(showOverviewWaf(ip, hostnamea), 2000)
+ }
+ },
+ error: function(){
+ alert(w.data_error);
+ }
+ } );
+}
$( function() {
$( "#show-all-users" ).click( function() {
$( ".show-users" ).show("fast");
@@ -304,4 +304,17 @@ function updateHapWIServer(id) {
}
}
} );
+}
+function change_pos(pos, id) {
+ $.ajax( {
+ url: "options.py",
+ data: {
+ change_pos: pos,
+ serv: id,
+ token: $('#token').val()
+ },
+ error: function(){
+ console.log(w.data_error);
+ }
+ } );
}
\ No newline at end of file
diff --git a/inc/runtimeapi.js b/inc/runtimeapi.js
new file mode 100644
index 00000000..61becb7a
--- /dev/null
+++ b/inc/runtimeapi.js
@@ -0,0 +1,189 @@
+function showRuntime() {
+ if($('#save').prop('checked')) {
+ saveCheck = "on";
+ } else {
+ saveCheck = "";
+ }
+ $.ajax( {
+ url: "options.py",
+ data: {
+ servaction: $('#servaction').val(),
+ serv: $("#serv").val(),
+ servbackend: $("#servbackend").val(),
+ save: saveCheck,
+ token: $('#token').val()
+ },
+ type: "POST",
+ success: function( data ) {
+ $("#ajaxruntime").html(data);
+ }
+ } );
+}
+$( function() {
+ $('#runtimeapiform').submit(function() {
+ showRuntime();
+ return false;
+ });
+ $( "#maxconn_select" ).on('selectmenuchange',function() {
+ $.ajax( {
+ url: "options.py",
+ data: {
+ maxconn_select: $('#maxconn_select').val(),
+ token: $('#token').val()
+ },
+ type: "POST",
+ success: function( data ) {
+ data = data.replace(/\s+/g,' ');
+ if (data.indexOf('error') != '-1') {
+ alert(data)
+ } else {
+ var value = data.split('
')
+ $('#maxconnfront').find('option').remove();
+ $('#maxconnfront').append($("
").attr("value","disabled").text("Choose Frontend"));
+ $('#maxconnfront').append($("
").attr("value","global").text("global"));
+
+ for(let i = 0; i < data.split('
').length; i++){
+ if(value[i] != '') {
+ $('#maxconnfront').append($("
")
+ .attr("value",value[i])
+ .text(value[i]));
+ }
+ }
+ $('#maxconnfront').selectmenu("refresh");
+ }
+ }
+ } );
+ });
+ $('#maxconnform').submit(function() {
+ $.ajax( {
+ url: "options.py",
+ data: {
+ serv: $('#maxconn_select').val(),
+ maxconn_frontend: $('#maxconnfront').val(),
+ maxconn_int: $('#maxconnint').val(),
+ token: $('#token').val()
+ },
+ type: "POST",
+ success: function( data ) {
+ data = data.replace(/\s+/g,' ');
+ if (data.indexOf('error') != '-1') {
+ $("#ajaxmaxconn").html('
'+data+'
');
+ } else {
+ $("#ajaxmaxconn").html('
'+data+'
');
+ }
+ }
+ } );
+ return false;
+ });
+ $( "#ip_select" ).on('selectmenuchange',function() {
+ $.ajax( {
+ url: "options.py",
+ data: {
+ ip_select: $('#ip_select').val(),
+ serv: $('#ip_select').val(),
+ token: $('#token').val()
+ },
+ type: "POST",
+ success: function( data ) {
+ data = data.replace(/\s+/g,' ');
+ if (data.indexOf('error') != '-1') {
+ alert(data)
+ } else {
+ var value = data.split('
')
+ $('#ipbackend').find('option').remove();
+ $('#ipbackend').append($("
").attr("value","disabled").text("Choose Backend"));
+
+ for(let i = 0; i < data.split('
').length; i++){
+ if(value[i] != '') {
+ $('#ipbackend').append($("
")
+ .attr("value",value[i])
+ .text(value[i]));
+ }
+ }
+ $('#ipbackend').selectmenu("refresh");
+ }
+ }
+ } );
+ });
+ $( "#ipbackend" ).on('selectmenuchange',function() {
+ $.ajax( {
+ url: "options.py",
+ data: {
+ serv: $('#ip_select').val(),
+ ipbackend: $('#ipbackend').val(),
+ token: $('#token').val()
+ },
+ type: "POST",
+ success: function( data ) {
+ data = data.replace(/\s+/g,' ');
+ if (data.indexOf('error') != '-1') {
+ alert(data)
+ } else {
+ var value = data.split('
')
+ $('#backend_server').find('option').remove();
+ $('#backend_server').append($("
").attr("value","disabled").text("Choose Server"));
+
+ for(let i = 0; i < data.split('
').length; i++){
+ if(value[i] != ' ') {
+ value[i] = value[i].replace(/\s+/g,'');
+ $('#backend_server').append($("
")
+ .attr("value",value[i])
+ .text(value[i]));
+ }
+ }
+ $('#backend_server').selectmenu("refresh");
+ }
+ }
+ } );
+ });
+ $( "#backend_server" ).on('selectmenuchange',function() {
+ $('#backend_ip').val();
+ $('#backend_port').val();
+ $.ajax( {
+ url: "options.py",
+ data: {
+ serv: $('#ip_select').val(),
+ ipbackend: $('#ipbackend').val(),
+ backend_server: $('#backend_server').val(),
+ token: $('#token').val()
+ },
+ type: "POST",
+ success: function( data ) {
+ data = data.replace(/\s+/g,' ');
+ if (data.indexOf('error') != '-1') {
+ alert(data)
+ } else {
+ var server = data.split(':')[0]
+ var port = data.split(':')[1]
+ port = port.replace(/\s+/g,'');
+ server = server.replace(/\s+/g,'');
+ $('#backend_port').val(port);
+ $('#backend_ip').val(server);
+ }
+ }
+ } );
+ });
+ $('#runtimeapiip').submit(function() {
+ $.ajax( {
+ url: "options.py",
+ data: {
+ serv: $('#ip_select').val(),
+ backend_backend: $('#ipbackend').val(),
+ backend_server: $('#backend_server').val(),
+ backend_ip: $('#backend_ip').val(),
+ backend_port: $('#backend_port').val(),
+ token: $('#token').val()
+ },
+ type: "POST",
+ success: function( data ) {
+ data = data.replace(/\s+/g,' ');
+ if (data.indexOf('error') != '-1') {
+ $("#ajaxip").html('
'+data+'
');
+ } else {
+ $("#ajaxip").html('
'+data+'
');
+ }
+ }
+ } );
+ return false;
+ });
+});
diff --git a/inc/script.js b/inc/script.js
index 1265f91a..87ca7206 100644
--- a/inc/script.js
+++ b/inc/script.js
@@ -854,6 +854,15 @@ $( function() {
});
$( "#tabs" ).tabs( "option", "active", 4 );
} );
+ $( ".hap1" ).on( "click", function() {
+ $('.menu li ul li').each(function () {
+ $(this).find('a').css('padding-left', '20px')
+ $(this).find('a').css('border-left', '0px solid #5D9CEB');
+ $(this).children(".hap1").css('padding-left', '30px');
+ $(this).children(".hap1").css('border-left', '4px solid #5D9CEB');
+ });
+ $( "#tabs" ).tabs( "option", "active", 5 );
+ } );
$( ".backup" ).on( "click", function() {
$('.menu li ul li').each(function () {
$(this).find('a').css('padding-left', '20px')
@@ -861,7 +870,7 @@ $( function() {
$(this).children(".backup").css('padding-left', '30px');
$(this).children(".backup").css('border-left', '4px solid #5D9CEB');
});
- $( "#tabs" ).tabs( "option", "active", 5 );
+ $( "#tabs" ).tabs( "option", "active", 6 );
} );
}
}
@@ -950,4 +959,4 @@ function changeCurrentGroupF(){
Cookies.remove('group');
Cookies.set('group', $('#newCurrentGroup').val(), { path: '/app', sameSite: 'Strict', Secure: 'True' });
location.reload();
-}
+}
\ No newline at end of file
diff --git a/inc/users.js b/inc/users.js
index bf5aaddb..0f0c4d86 100644
--- a/inc/users.js
+++ b/inc/users.js
@@ -220,8 +220,8 @@ $( function() {
} );
});
$('#grafna_install').click(function() {
- $("#ajax").html('')
- $("#ajax").html(wait_mess);
+ $("#ajaxmon").html('')
+ $("#ajaxmon").html(wait_mess);
$.ajax( {
url: "options.py",
data: {
@@ -232,26 +232,26 @@ $( function() {
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('FAILED') != '-1') {
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
} else if (data.indexOf('success') != '-1' ){
$('.alert-danger').remove();
$('.alert-warning').remove();
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
} else if (data.indexOf('Info') != '-1' ){
$('.alert-danger').remove();
$('.alert-warning').remove();
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
} else {
$('.alert-danger').remove();
$('.alert-warning').remove();
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
}
}
} );
});
$('#haproxy_exp_install').click(function() {
- $("#ajax").html('')
- $("#ajax").html(wait_mess);
+ $("#ajaxmon").html('')
+ $("#ajaxmon").html(wait_mess);
$.ajax( {
url: "options.py",
data: {
@@ -262,17 +262,17 @@ $( function() {
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
} else if (data.indexOf('success') != '-1' ){
$('.alert-danger').remove();
$('.alert-warning').remove();
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
$('#cur_haproxy_exp_ver').text('HAProxy expoter is installed');
$('#haproxy_exp_install').text('Update');
} else if (data.indexOf('Info') != '-1' ){
$('.alert-danger').remove();
$('.alert-warning').remove();
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
} else {
$('.alert-danger').remove();
$('.alert-warning').remove();
@@ -282,8 +282,8 @@ $( function() {
} );
});
$('#nginx_exp_install').click(function() {
- $("#ajax").html('')
- $("#ajax").html(wait_mess);
+ $("#ajaxmon").html('')
+ $("#ajaxmon").html(wait_mess);
$.ajax( {
url: "options.py",
data: {
@@ -294,21 +294,21 @@ $( function() {
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
} else if (data.indexOf('success') != '-1' ){
$('.alert-danger').remove();
$('.alert-warning').remove();
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
$('#cur_nginx_exp_ver').text('Nginx expoter is installed');
$('#nginx_exp_install').text('Update');
} else if (data.indexOf('Info') != '-1' ){
$('.alert-danger').remove();
$('.alert-warning').remove();
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
} else {
$('.alert-danger').remove();
$('.alert-warning').remove();
- $("#ajax").html('
'+data+'
');
+ $("#ajaxmon").html('
'+data+'
');
}
}
} );