Modal overlay-close removed from data-entry; console menu grouped

This commit is contained in:
2026-08-05 13:49:34 -04:00
parent 469113d0a4
commit 07d390789a
32 changed files with 241 additions and 195 deletions

View File

@@ -949,32 +949,73 @@ function Show-Uninstall {
Say ' Take a backup first: shopdb-admin.ps1 backup' 'Yellow'
}
# Cached for the session. Test-Provisioned shells out to flask twice, which is
# far too slow to repeat on every redraw of the menu - and the answer does not
# change while somebody reads the screen. Cleared after a repair so the warning
# disappears once it is actually fixed.
$script:Attention = $null
function Show-Attention {
<#
Say what is wrong, and which key fixes it.
A server whose seeds never ran answers 500 on most pages, and until now the
console reported all of that as ordinary status lines that read as normal
unless you knew what to look for. The one thing an operator needs is the
next action.
#>
if ($null -eq $script:Attention) {
$state = Test-Provisioned
$script:Attention = @{
Provisioned = -not (($state.SchemaCurrent -eq $false) -or ($state.Seeded -eq $false))
Detail = $state.Detail
}
}
if (-not $script:Attention.Provisioned) {
Write-Host ''
Say ' ! This server is not fully provisioned - most pages will fail.' 'Red'
foreach ($detail in $script:Attention.Detail) { Say (" {0}" -f $detail) 'Red' }
Say ' Press F to fix it.' 'Yellow'
}
}
function Show-Menu {
$first = $true
while ($true) {
if ($first) { Show-Banner; $first = $false }
Show-Status
Show-Attention
Write-Host ''
Write-Host ' 1 Restart the application 6 Back up the database' -ForegroundColor White
Write-Host ' 2 Stop the application 7 Worker processes' -ForegroundColor White
Write-Host ' 3 Start the application 8 Open in browser' -ForegroundColor White
Write-Host ' 4 View recent logs 9 Plugins' -ForegroundColor White
Write-Host ' 5 Health check V Verify this install' -ForegroundColor White
Write-Host ' R Repair provisioning C Load equipment catalog' -ForegroundColor White
Write-Host ' 0 Exit' -ForegroundColor White
Write-Host ' APPLICATION DATA DIAGNOSE' -ForegroundColor DarkGray
Write-Host ' R Restart B Back up H Health check' -ForegroundColor White
Write-Host ' S Stop C Load catalog L Recent logs' -ForegroundColor White
Write-Host ' T Start P Plugins W Processes' -ForegroundColor White
Write-Host ' O Open in browser F Repair V Verify install' -ForegroundColor White
Write-Host ''
Write-Host ' Q Quit' -ForegroundColor White
Write-Host ''
$c = Read-Host ' Choose'
switch ($c) {
'1' { Restart-App } '2' { Stop-App } '3' { Start-App }
'4' { Show-Logs } '5' { Invoke-Check } '6' { Backup-Db $Path }
'7' { Show-Sessions } '8' { Open-Site }
'v' { Invoke-Verify } 'V' { Invoke-Verify }
'r' { Invoke-Repair } 'R' { Invoke-Repair }
'c' { Invoke-Catalog } 'C' { Invoke-Catalog }
# The old numbers still work. Somebody who has used this for months
# should not be stopped by a menu that was rearranged under them.
switch ($c.ToUpper()) {
'R' { Restart-App } '1' { Restart-App }
'S' { Stop-App } '2' { Stop-App }
'T' { Start-App } '3' { Start-App }
'L' { Show-Logs } '4' { Show-Logs }
'H' { Invoke-Check } '5' { Invoke-Check }
'B' { Backup-Db $Path } '6' { Backup-Db $Path }
'W' { Show-Sessions } '7' { Show-Sessions }
'O' { Open-Site } '8' { Open-Site }
'V' { Invoke-Verify }
'F' { Invoke-Repair; $script:Attention = $null }
'C' { Invoke-Catalog }
'P' { Show-Plugins
$add = Read-Host ' Name of a shipped plugin to add (Enter to skip)'
if ($add) { Add-Plugin $add } }
'9' { Show-Plugins
$add = Read-Host ' Name of a shipped plugin to add (Enter to skip)'
if ($add) { Add-Plugin $add } }
'0' { return }
'Q' { return } '0' { return }
default { Say ' not a choice' 'Yellow' }
}
Write-Host ''