From cac743fea6bb9a5f488584e58ef4f16f239314ef Mon Sep 17 00:00:00 2001 From: Aidaho Date: Fri, 2 Aug 2024 21:21:18 +0300 Subject: [PATCH] v8.0: Refactor installation process feedback and retries Commented out the JSON parsing function and added success notifications for service installations, consolidated "nice_service_name" object to variables.js, and reduced retry attempts and delay intervals in the Ansible Playbook for HAProxy installation tasks. --- app/scripts/ansible/roles/haproxy/tasks/installation.yml | 8 ++++---- app/static/js/ha.js | 1 - app/static/js/install.js | 4 +++- app/static/js/variables.js | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/scripts/ansible/roles/haproxy/tasks/installation.yml b/app/scripts/ansible/roles/haproxy/tasks/installation.yml index 8dd25046..70d6cde8 100644 --- a/app/scripts/ansible/roles/haproxy/tasks/installation.yml +++ b/app/scripts/ansible/roles/haproxy/tasks/installation.yml @@ -30,9 +30,9 @@ when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and HAPVER|length > 0 ignore_errors: yes register: install_result - retries: 5 + retries: 3 until: install_result.rc == 0 - delay: 5 + delay: 3 environment: http_proxy: "{{PROXY}}" https_proxy: "{{PROXY}}" @@ -48,9 +48,9 @@ when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ("'timed out' in install_result.stderr") ignore_errors: yes register: install_result1 - retries: 5 + retries: 3 until: install_result1.rc == 0 - delay: 5 + delay: 3 environment: http_proxy: "{{PROXY}}" https_proxy: "{{PROXY}}" diff --git a/app/static/js/ha.js b/app/static/js/ha.js index 7e99d312..66a3c094 100644 --- a/app/static/js/ha.js +++ b/app/static/js/ha.js @@ -435,7 +435,6 @@ function installServiceCluster(jsonData, service, progress_step, cluster_id) { let install_mess = translate_div.attr('data-installing'); let timeout_mess = translate_div.attr('data-roxywi_timeout'); let something_wrong = translate_div.attr('data-something_wrong'); - let nice_service_name = {'keepalived': 'HA Custer', 'haproxy': 'HAProxy', 'nginx': 'NGINX', 'apache': 'Apache'}; $('#server_creating_list').append('
  • ' + install_mess + ' ' + nice_service_name[service] + '
  • '); return $.ajax({ url: "/install/" + service, diff --git a/app/static/js/install.js b/app/static/js/install.js index 86e77cd4..264b2bc4 100644 --- a/app/static/js/install.js +++ b/app/static/js/install.js @@ -111,7 +111,8 @@ $( function() { if (data.status === 'failed') { toastr.error(data.error); } else { - parseAnsibleJsonOutput(data, service + ' GeoIP', '#geoip_service'); + // parseAnsibleJsonOutput(data, service + ' GeoIP', '#geoip_service'); + toastr.success('GeoIP has been installed'); $("#geoip_service").trigger("selectmenuchange"); } } @@ -183,6 +184,7 @@ function installService(service) { toastr.error(data.error); } else { $(select_id).trigger("selectmenuchange"); + toastr.success(nice_service_name[service] + ' has been installed'); $("#ajax").empty(); } } diff --git a/app/static/js/variables.js b/app/static/js/variables.js index ce3903c8..f79dac52 100644 --- a/app/static/js/variables.js +++ b/app/static/js/variables.js @@ -11,6 +11,7 @@ const upload_and_restart = translate_div.attr('data-upload_and_restart'); const edit_word = translate_div.attr('data-edit'); const delete_word = translate_div.attr('data-delete'); const back_word = translate_div.attr('data-back'); +const nice_service_name = {'keepalived': 'HA Custer', 'haproxy': 'HAProxy', 'nginx': 'NGINX', 'apache': 'Apache'}; // JS scripts URL const scriptPath = "/static/js"