From 92db912ee32ee5073ec148c47bcc972548a092e4 Mon Sep 17 00:00:00 2001 From: Yury Kossakovsky Date: Sun, 2 Nov 2025 10:02:16 -0700 Subject: [PATCH] Update PostgreSQL image version and enhance wizard dialog sizing - Changed PostgreSQL image version in docker-compose.yml to use the latest tag for improved compatibility. - Enhanced the service selection wizard in 04_wizard.sh to dynamically adjust dialog size based on terminal dimensions, ensuring better usability. --- docker-compose.yml | 2 +- scripts/04_wizard.sh | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 98448b1..99186d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -403,7 +403,7 @@ services: postgres: container_name: postgres - image: postgres:${POSTGRES_VERSION:-18} + image: postgres:${POSTGRES_VERSION:latest} restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] diff --git a/scripts/04_wizard.sh b/scripts/04_wizard.sh index 7f56abc..ef04e7e 100755 --- a/scripts/04_wizard.sh +++ b/scripts/04_wizard.sh @@ -110,9 +110,32 @@ while [ $idx -lt ${#base_services_data[@]} ]; do done # Use whiptail to display the checklist +# Dynamically size dialog to the terminal num_services=$(( ${#services[@]} / 3 )) + +# Determine terminal dimensions with safe fallbacks +TERM_LINES=$(tput lines 2>/dev/null || echo 32) +TERM_COLS=$(tput cols 2>/dev/null || echo 100) + +# Leave a small margin from terminal borders; clamp to sane min/max +DIALOG_HEIGHT=$(( TERM_LINES - 4 )) +[ $DIALOG_HEIGHT -lt 20 ] && DIALOG_HEIGHT=20 +[ $DIALOG_HEIGHT -gt 40 ] && DIALOG_HEIGHT=40 + +DIALOG_WIDTH=$(( TERM_COLS - 4 )) +[ $DIALOG_WIDTH -lt 70 ] && DIALOG_WIDTH=70 +[ $DIALOG_WIDTH -gt 200 ] && DIALOG_WIDTH=200 + +# Compute list height so buttons/text have space +LIST_HEIGHT=$(( DIALOG_HEIGHT - 6 )) +[ $LIST_HEIGHT -lt 10 ] && LIST_HEIGHT=10 + +# Cap list height to number of services to avoid extra empty space +[ $LIST_HEIGHT -gt $num_services ] && LIST_HEIGHT=$num_services + CHOICES=$(whiptail --title "Service Selection Wizard" --checklist \ - "Choose the services you want to deploy.\nUse ARROW KEYS to navigate, SPACEBAR to select/deselect, ENTER to confirm." 32 100 $num_services \ + "Choose the services you want to deploy.\nUse ARROW KEYS to navigate, SPACEBAR to select/deselect, ENTER to confirm." \ + $DIALOG_HEIGHT $DIALOG_WIDTH $LIST_HEIGHT \ "${services[@]}" \ 3>&1 1>&2 2>&3)