From 50f5e2e3784c4cbc8f85a56b44ddef449008eb1d Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 20 Mar 2026 01:11:58 -0400 Subject: [PATCH] fix: Remove deprecated code and complete menu-functions integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CLEANUP: - Removed unused safe_read_choice() function (replaced by menu-functions.sh) - Converted remaining handle_loadwatch_analyzer() to use new menu system - All menu handlers now use MENU_CHOICE and menu-functions consistently QA VERIFICATION: ✓ Syntax check: PASSED ✓ No deprecated read patterns remaining ✓ All 11 menu functions using new system ✓ All 11 handlers using MENU_CHOICE ✓ All error handling using menu_invalid_choice STATUS: Complete menu system migration to lib/menu-functions.sh Ready for production use in dev branch --- launcher.sh | 46 +++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/launcher.sh b/launcher.sh index 5097a16..2e4e797 100755 --- a/launcher.sh +++ b/launcher.sh @@ -33,18 +33,6 @@ source "$LIB_DIR/user-manager.sh" || { echo "ERROR: Failed to load user-manager. source "$LIB_DIR/reference-db.sh" || { echo "ERROR: Failed to load reference-db.sh"; return 1; } source "$LIB_DIR/menu-functions.sh" || { echo "ERROR: Failed to load menu-functions.sh"; return 1; } -# Safe read helper function - handles both interactive and non-interactive modes -safe_read_choice() { - if [ "$INTERACTIVE_MODE" -eq 0 ]; then - # Non-interactive: return 1 to indicate read failed - return 1 - fi - - if ! read -r choice /dev/null; then - return 1 - fi -} - # Color codes RED='\033[0;31m' YELLOW='\033[1;33m' @@ -502,33 +490,29 @@ handle_loadwatch_analyzer() { fi show_banner - echo -e "📊 Loadwatch Health Analyzer" - echo "" - echo -e "Select time range for analysis:" - echo "" - echo -e " 1) Last 1 Hour - Recent activity" - echo -e " 2) Last 6 Hours - Mid-term trending" - echo -e " 3) Last 24 Hours - Full day analysis" - echo -e " 4) Last 7 Days - Weekly patterns" - echo -e " 5) Last 30 Days - Monthly overview" - echo "" - echo -e " 0) Back" - echo "" - echo -e "──────────────────────────────────────────────────────────────" - echo -n "Select time range: " + menu_header "Loadwatch Health Analyzer" - if ! read -r range_choice /dev/null; then - return 0 # Exit if read fails - fi + menu_section "Select time range for analysis" + menu_option 1 "Last 1 Hour" "Recent activity" + menu_option 2 "Last 6 Hours" "Mid-term trending" + menu_option 3 "Last 24 Hours" "Full day analysis" + menu_option 4 "Last 7 Days" "Weekly patterns" + menu_option 5 "Last 30 Days" "Monthly overview" - case "$range_choice" in + echo "" + menu_back "Performance Menu" + menu_divider + + read_menu_choice "Select time range" 0 5 + + case "$MENU_CHOICE" in 1) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "1h" ;; 2) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "6h" ;; 3) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "24h" ;; 4) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "7d" ;; 5) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "30d" ;; 0) return ;; - *) echo -e "Invalid option"; sleep 1 ;; + *) menu_invalid_choice ;; esac }