v8.1.3: Refactor and expand service settings checks in ha.js

Update the JavaScript to enhance the granularity of service checks under cluster settings by incorporating nested properties for haproxy and nginx, including Docker settings. Additionally, add checks for the new Apache service and remove a console log statement for cleaner code.
pull/410/head
Aidaho 2024-12-10 04:35:49 +03:00
parent 91802b3cd6
commit 6bb5124b07
1 changed files with 17 additions and 3 deletions

View File

@ -135,16 +135,31 @@ function createHaClusterStep1(edited=false, cluster_id=0, clean=true) {
$('#ha-cluster-desc').val(clusterSettings.description.replaceAll("'", "")); $('#ha-cluster-desc').val(clusterSettings.description.replaceAll("'", ""));
$('#ha-cluster-master-interface').val(clusterSettings.eth); $('#ha-cluster-master-interface').val(clusterSettings.eth);
$('#vrrp-ip').val(clusterSettings.vip); $('#vrrp-ip').val(clusterSettings.vip);
if (clusterSettings.haproxy) { if (clusterSettings.services.haproxy.enabled) {
$('#hap').prop('checked', true); $('#hap').prop('checked', true);
if (clusterSettings.services.haproxy.docker) {
$('#hap_docker').prop('checked', true);
} else {
$('#hap_docker').prop('checked', false);
}
} else { } else {
$('#hap').prop('checked', false); $('#hap').prop('checked', false);
} }
if (clusterSettings.nginx) { if (clusterSettings.services.nginx.enabled) {
$('#nginx').prop('checked', true); $('#nginx').prop('checked', true);
if (clusterSettings.services.nginx.docker) {
$('#nginx_docker').prop('checked', true);
} else {
$('#nginx_docker').prop('checked', false);
}
} else { } else {
$('#nginx').prop('checked', false); $('#nginx').prop('checked', false);
} }
if (clusterSettings.services.apache.enabled) {
$('#apache').prop('checked', true);
} else {
$('#apache').prop('checked', false);
}
if (clusterSettings.return_master) { if (clusterSettings.return_master) {
$('#return_master').prop('checked', true); $('#return_master').prop('checked', true);
} else { } else {
@ -790,7 +805,6 @@ function createJsonVip(div_id) {
return jsonData; return jsonData;
} }
function validateSlaves(jsonData) { function validateSlaves(jsonData) {
console.log(jsonData)
if (Object.keys(jsonData['servers']).length === 1) { if (Object.keys(jsonData['servers']).length === 1) {
toastr.error('error: There is must be at least one slave server'); toastr.error('error: There is must be at least one slave server');
return false; return false;