This commit is contained in:
David Schroeder
2026-09-23 17:02:08 -05:00
parent fdbd08e1b0
commit cd4d505064
5 changed files with 25 additions and 26 deletions
+2
View File
@@ -39,6 +39,8 @@ discarded.
Menus use cyan for the selection and task prompts, muted context and navigation Menus use cyan for the selection and task prompts, muted context and navigation
help, and text labels alongside success, warning, and error colors. A `>` on the help, and text labels alongside success, warning, and error colors. A `>` on the
right of an item marks a submenu. Extra context appears below the selected item. right of an item marks a submenu. Extra context appears below the selected item.
Menus and disk reports share a 75-column maximum and wrap on narrower terminals.
CPU and ISO detail views wrap full values instead of truncating them.
The header stacks host details on narrow terminals and separates update status The header stacks host details on narrow terminals and separates update status
from menu actions. Task output replaces the choices while retaining the header. from menu actions. Task output replaces the choices while retaining the header.
+1 -1
View File
@@ -3,7 +3,7 @@
action="${1:-}" action="${1:-}"
FOLDER='/opt/idssys/ta-proxmenu' FOLDER='/opt/idssys/ta-proxmenu'
VERS='2026.9.22-17' VERS='2026.9.22-18'
noupdate=' ' noupdate=' '
+1 -1
View File
@@ -185,7 +185,7 @@ class ReportDisplay:
self.stream = stream if stream is not None else sys.stdout self.stream = stream if stream is not None else sys.stdout
self.color = (self.stream.isatty() and os.environ.get('TERM', 'dumb') != 'dumb' self.color = (self.stream.isatty() and os.environ.get('TERM', 'dumb') != 'dumb'
and 'NO_COLOR' not in os.environ) and 'NO_COLOR' not in os.environ)
self.width = max(20, min(100, shutil.get_terminal_size((80, 24)).columns)) self.width = max(20, min(75, shutil.get_terminal_size((80, 24)).columns))
def line(self, text='', style='', indent=0): def line(self, text='', style='', indent=0):
codes = {'bold': '1', 'muted': '90', 'accent': '96', codes = {'bold': '1', 'muted': '90', 'accent': '96',
+1 -1
View File
@@ -15,7 +15,7 @@ TAPM_UI_INIT() {
TAPM_UI_WIDTH="$(tput cols 2>/dev/null)" || TAPM_UI_WIDTH="${COLUMNS:-80}" TAPM_UI_WIDTH="$(tput cols 2>/dev/null)" || TAPM_UI_WIDTH="${COLUMNS:-80}"
fi fi
[[ "$TAPM_UI_WIDTH" =~ ^[0-9]+$ ]] || TAPM_UI_WIDTH=80 [[ "$TAPM_UI_WIDTH" =~ ^[0-9]+$ ]] || TAPM_UI_WIDTH=80
(( TAPM_UI_WIDTH > 100 )) && TAPM_UI_WIDTH=100 (( TAPM_UI_WIDTH > 75 )) && TAPM_UI_WIDTH=75
(( TAPM_UI_WIDTH < 20 )) && TAPM_UI_WIDTH=20 (( TAPM_UI_WIDTH < 20 )) && TAPM_UI_WIDTH=20
return 0 return 0
} }
+20 -23
View File
@@ -1004,14 +1004,14 @@ SHOW_LOCAL_VIRTIO_ISOS() {
echo echo
if TAPM_REFRESH_ISO_STORAGES; then if TAPM_REFRESH_ISO_STORAGES; then
for index in "${!VIRTIO_STORAGE_IDS[@]}"; do for index in "${!VIRTIO_STORAGE_IDS[@]}"; do
echo -e " ${idsCL[LightCyan]}${VIRTIO_STORAGE_IDS[$index]}${idsCL[Default]} (${VIRTIO_STORAGE_TYPES[$index]})" TAPM_UI_TEXT "$TAPM_UI_ACCENT" "${VIRTIO_STORAGE_IDS[$index]} (${VIRTIO_STORAGE_TYPES[$index]})"
echo " ${VIRTIO_STORAGE_DIRS[$index]}" TAPM_UI_TEXT "$TAPM_UI_MUTED" "${VIRTIO_STORAGE_DIRS[$index]}"
while IFS= read -r -d '' file; do while IFS= read -r -d '' file; do
found=1 found=1
printf ' %-42s %10s %s\n' \ TAPM_UI_TEXT "$TAPM_UI_BOLD" "${file##*/}"
"${file##*/}" \ TAPM_UI_TEXT '' " Size: $(numfmt --to=iec-i --suffix=B "$(stat -c '%s' "$file")")"
"$(numfmt --to=iec-i --suffix=B "$(stat -c '%s' "$file")")" \ TAPM_UI_TEXT "$TAPM_UI_MUTED" " Modified: $(date --date="@$(stat -c '%Y' "$file")" '+%F %R')"
"$(date --date="@$(stat -c '%Y' "$file")" '+%F %R')"
done < <( done < <(
find "${VIRTIO_STORAGE_DIRS[$index]}" -maxdepth 1 -type f \ find "${VIRTIO_STORAGE_DIRS[$index]}" -maxdepth 1 -type f \
-name 'virtio-win*.iso' -print0 2>/dev/null | sort -z -name 'virtio-win*.iso' -print0 2>/dev/null | sort -z
@@ -1262,6 +1262,7 @@ print(" ".join(model.split()))
} }
TAPM_SHOW_CLUSTER_CPU_TABLE() { TAPM_SHOW_CLUSTER_CPU_TABLE() {
TAPM_UI_INIT
local proxclmc_output local proxclmc_output
local host_rows local host_rows
local node local node
@@ -1280,11 +1281,6 @@ TAPM_SHOW_CLUSTER_CPU_TABLE() {
return 0 return 0
fi fi
printf ' %-16s %-42s %-34s %-14s\n' \
'HOST' 'PHYSICAL CPU' 'GENERATION / FAMILY' 'BEST VM MODEL'
printf ' %-16s %-42s %-34s %-14s\n' \
'----------------' '------------------------------------------' \
'----------------------------------' '--------------'
while IFS=$'\034' read -r node address host_max; do while IFS=$'\034' read -r node address host_max; do
[[ -n "$node" ]] || continue [[ -n "$node" ]] || continue
@@ -1297,12 +1293,16 @@ TAPM_SHOW_CLUSTER_CPU_TABLE() {
generation='Unavailable' generation='Unavailable'
fi fi
printf ' %-16.16s %-42.42s %-34.34s %-14s\n' \ TAPM_UI_TEXT "$TAPM_UI_BOLD" "$node"
"$node" "$cpu_name" "$generation" "$host_max" TAPM_UI_TEXT '' " Physical CPU: $cpu_name"
TAPM_UI_TEXT '' " Generation / family: $generation"
TAPM_UI_TEXT '' " Best VM model: $host_max"
echo
done <<< "$host_rows" done <<< "$host_rows"
} }
DETECT_CPU() { DETECT_CPU() {
TAPM_UI_INIT
local answer local answer
local cpu_model local cpu_model
local current_cpu local current_cpu
@@ -1379,15 +1379,15 @@ DETECT_CPU() {
return return
fi fi
printf '\n%-7s %-28s %-20s %-10s %-24s %s\n' \ echo
'VMID' 'NAME' 'NODE' 'TEMPLATE' 'CURRENT CPU' 'PROPOSED CPU' TAPM_UI_TEXT "$TAPM_UI_BOLD" 'Proposed CPU changes'
printf '%-7s %-28s %-20s %-10s %-24s %s\n' \
'-------' '----------------------------' '--------------------' \
'----------' '------------------------' '----------------'
for guest in "${changes[@]}"; do for guest in "${changes[@]}"; do
IFS=$'\x1f' read -r vmid name node template current_cpu <<< "$guest" IFS=$'\x1f' read -r vmid name node template current_cpu <<< "$guest"
printf '%-7s %-28.28s %-20.20s %-10s %-24.24s %s\n' \ TAPM_UI_TEXT "$TAPM_UI_BOLD" "${name:-unnamed} (VM $vmid)"
"$vmid" "${name:-unnamed}" "$node" "$template" "$current_cpu" "$cpu_model" TAPM_UI_TEXT '' " Node: $node Template: $template"
TAPM_UI_TEXT '' " Current CPU: $current_cpu"
TAPM_UI_TEXT '' " Proposed CPU: $cpu_model"
echo
done done
echo -en "\n${idsCL[LightCyan]}Apply cluster-wide baseline ${cpu_model} to ${#changes[@]} VM(s) and template(s) (y/N)?${idsCL[Default]} " echo -en "\n${idsCL[LightCyan]}Apply cluster-wide baseline ${cpu_model} to ${#changes[@]} VM(s) and template(s) (y/N)?${idsCL[Default]} "
@@ -1766,9 +1766,6 @@ MENU_HEADER() {
local version="${VERS}" spacing host local version="${VERS}" spacing host
host="$(hostname -s)" host="$(hostname -s)"
TAPM_UI_INIT TAPM_UI_INIT
# Keep the header compact without changing the menu's available width.
local TAPM_UI_WIDTH="$TAPM_UI_WIDTH"
(( TAPM_UI_WIDTH > 75 )) && TAPM_UI_WIDTH=75
TAPM_LOAD_HEADER_INFO TAPM_LOAD_HEADER_INFO
if [[ "$UPDATE_STATUS" == unknown || "$UPDATE_STATUS" == checking ]]; then if [[ "$UPDATE_STATUS" == unknown || "$UPDATE_STATUS" == checking ]]; then
LOAD_UPDATE_STATUS LOAD_UPDATE_STATUS