Files
haproxy-wi/app/static/js/admin_settings.js
Aidaho 1954b60e13 v7.2.4.0: Update requirements and refactor date formatting function
The requirements for el9, deb, and main have been updated to specifically use version 2.27.1 of the "requests" package. In addition, the date formatting function get_time_zoned_date in common.py has been refactored. The default format for the date has been moved to the function arguments, and the function now also checks if the provided date is an instance of datetime before processing it.
2024-04-18 09:58:32 +03:00

96 lines
2.3 KiB
JavaScript

$( function() {
$('#nginx-section-head').click(function () {
hideAndShowSettings('nginx');
});
$('#main-section-head').click(function () {
hideAndShowSettings('main');
});
$('#monitoring-section-head').click(function () {
hideAndShowSettings('monitoring');
});
$('#haproxy-section-head').click(function () {
hideAndShowSettings('haproxy');
});
$('#ldap-section-head').click(function () {
hideAndShowSettings('ldap');
});
$('#logs-section-head').click(function () {
hideAndShowSettings('logs');
});
$('#rabbitmq-section-head').click(function () {
hideAndShowSettings('rabbitmq');
});
$('#apache-section-head').click(function () {
hideAndShowSettings('apache');
});
$('#keepalived-section-head').click(function () {
hideAndShowSettings('keepalived');
});
$('#mail-section-head').click(function () {
hideAndShowSettings('mail');
});
$('#smon-section-head').click(function () {
hideAndShowSettings('smon');
});
$( "#settings select" ).on('select2:select',function() {
var id = $(this).attr('id');
var val = $(this).val();
updateSettings(id, val);
updateSettings(id[1])
});
$( "#settings input" ).change(function() {
var id = $(this).attr('id');
var val = $(this).val();
if($('#'+id).is(':checkbox')) {
if ($('#'+id).is(':checked')){
val = 1;
} else {
val = 0;
}
}
updateSettings(id, val);
});
});
function hideAndShowSettings(section) {
var ElemId = $('#' + section + '-section-h3');
if(ElemId.attr('class') == 'plus-after') {
$('.' + section + '-section').show();
ElemId.removeClass('plus-after');
ElemId.addClass('minus-after');
$.getScript(awesome);
} else {
$('.' + section + '-section').hide();
ElemId.removeClass('minus-after');
ElemId.addClass('plus-after');
$.getScript(awesome);
}
}
function updateSettings(param, val) {
try {
val = val.replace(/\//g, "92");
} catch (e) {
val = val;
}
toastr.clear();
$.ajax({
url: "/app/admin/setting/" + param,
data: {
val: val,
token: $('#token').val()
},
type: "POST",
success: function (data) {
data = data.replace(/\s+/g, ' ');
if (data.indexOf('error:') != '-1') {
toastr.error(data);
} else {
toastr.clear();
$("#" + param).parent().parent().addClass("update", 1000);
setTimeout(function () {
$("#" + param).parent().parent().removeClass("update");
}, 2500);
}
}
});
}