refactor(utils): improve whiptail dialogs and logging utilities

- add adaptive terminal sizing for all whiptail dialogs (wt_get_size)
- add new wrapper functions: wt_checklist, wt_radiolist, wt_menu
- add safe parser wt_parse_choices to replace eval
- improve NEWT_COLORS theme with better contrast (brightgreen/brightcyan)
- add new logging functions: log_header, log_subheader, log_divider, log_box
- add spinner animation utilities for progress indication
- expand color palette with bright variants and text styles
- update 04_wizard.sh to use new whiptail wrappers
This commit is contained in:
Yury Kossakovsky
2025-12-12 13:43:20 -07:00
parent 7d922c4e67
commit 04e70cee2d
11 changed files with 423 additions and 205 deletions

View File

@@ -12,12 +12,9 @@ init_paths
# Load environment variables
load_env || exit 1
log_box "Update Preview (Dry Run)"
echo ""
echo "========================================"
echo " Update Preview (Dry Run)"
echo "========================================"
echo ""
echo "Checking for available updates..."
echo -e " ${CYAN}Checking for available updates...${NC}"
echo ""
# Function to get local image digest
@@ -74,108 +71,84 @@ log_info "Scanning images from docker-compose.yml..."
echo ""
# Core services (always checked)
echo "Core Services:"
echo "--------------"
log_subheader "Core Services"
check_image_update "postgres" "postgres:${POSTGRES_VERSION:-17}-alpine"
check_image_update "redis" "valkey/valkey:8-alpine"
check_image_update "caddy" "caddy:2-alpine"
echo ""
# Check n8n if profile is active
if is_profile_active "n8n"; then
echo "n8n Services:"
echo "-------------"
log_subheader "n8n Services"
check_image_update "n8n" "docker.n8n.io/n8nio/n8n:${N8N_VERSION:-latest}"
check_image_update "n8n-runner" "n8nio/runners:${N8N_VERSION:-latest}"
echo ""
fi
# Check monitoring if profile is active
if is_profile_active "monitoring"; then
echo "Monitoring Services:"
echo "--------------------"
log_subheader "Monitoring Services"
check_image_update "grafana" "grafana/grafana:latest"
check_image_update "prometheus" "prom/prometheus:latest"
check_image_update "node-exporter" "prom/node-exporter:latest"
check_image_update "cadvisor" "gcr.io/cadvisor/cadvisor:latest"
echo ""
fi
# Check other common services
if is_profile_active "flowise"; then
echo "Flowise:"
echo "--------"
log_subheader "Flowise"
check_image_update "flowise" "flowiseai/flowise:latest"
echo ""
fi
if is_profile_active "open-webui"; then
echo "Open WebUI:"
echo "-----------"
log_subheader "Open WebUI"
check_image_update "open-webui" "ghcr.io/open-webui/open-webui:main"
echo ""
fi
if is_profile_active "portainer"; then
echo "Portainer:"
echo "----------"
log_subheader "Portainer"
check_image_update "portainer" "portainer/portainer-ce:latest"
echo ""
fi
if is_profile_active "langfuse"; then
echo "Langfuse:"
echo "---------"
log_subheader "Langfuse"
check_image_update "langfuse-web" "langfuse/langfuse:latest"
check_image_update "langfuse-worker" "langfuse/langfuse-worker:latest"
echo ""
fi
if is_profile_active "cpu" || is_profile_active "gpu-nvidia" || is_profile_active "gpu-amd"; then
echo "Ollama:"
echo "-------"
log_subheader "Ollama"
check_image_update "ollama" "ollama/ollama:latest"
echo ""
fi
if is_profile_active "qdrant"; then
echo "Qdrant:"
echo "-------"
log_subheader "Qdrant"
check_image_update "qdrant" "qdrant/qdrant:latest"
echo ""
fi
if is_profile_active "searxng"; then
echo "SearXNG:"
echo "--------"
log_subheader "SearXNG"
check_image_update "searxng" "searxng/searxng:latest"
echo ""
fi
if is_profile_active "postgresus"; then
echo "Postgresus:"
echo "-----------"
log_subheader "Postgresus"
check_image_update "postgresus" "ghcr.io/postgresus/postgresus:latest"
echo ""
fi
# Summary
echo "========================================"
echo " Summary"
echo "========================================"
log_divider
echo ""
if [ $UPDATES_AVAILABLE -gt 0 ]; then
echo -e "${GREEN}$UPDATES_AVAILABLE update(s) available.${NC}"
echo -e " ${BRIGHT_GREEN}$UPDATES_AVAILABLE update(s) available!${NC}"
echo ""
echo "To apply updates, run:"
echo " make update"
echo -e " ${WHITE}To apply updates, run:${NC}"
echo -e " ${CYAN}make update${NC}"
echo ""
echo "Or manually:"
echo " docker compose -p localai pull"
echo " docker compose -p localai up -d"
echo -e " ${DIM}Or manually:${NC}"
echo -e " ${DIM}docker compose -p localai pull${NC}"
echo -e " ${DIM}docker compose -p localai up -d${NC}"
else
echo -e "${GREEN}All images are up to date!${NC}"
echo -e " ${BRIGHT_GREEN}All images are up to date!${NC}"
fi
echo ""