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.
This commit is contained in:
Yury Kossakovsky
2025-11-02 10:02:16 -07:00
parent 75fc090a22
commit 92db912ee3
2 changed files with 25 additions and 2 deletions

View File

@@ -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)