Stop a stray click outside a modal discarding what was typed
Some checks failed
CI / backend (push) Failing after 8s
CI / naming (push) Successful in 1s
CI / frontend (push) Successful in 8s
CI / migrations-mysql (push) Failing after 7s

Operators reported losing a part-filled form by clicking slightly outside it.
Every data-entry modal closed on a backdrop click with no warning and no way
back - the worst possible response to a misplaced click, and it happens most to
someone adding their first records at a new site.

Close-on-overlay is removed from 35 modals across 30 files: anything containing
an input, textarea, select or v-model. They still close by Cancel or the X.

Confirmation dialogs keep it, because a delete prompt holds nothing to lose and
dismissing one by clicking away is the behaviour people expect. VendorsList
shows the distinction - its edit form no longer closes that way, its delete
confirmation still does.

The shared Modal component now defaults closeOnOverlay to FALSE. Every current
caller holds a form, a checkout, a stock adjustment or a map position being
picked, and not one passed the prop, so all of them had the same fault. A modal
that genuinely wants dismissing that way opts in explicitly.

Also regroups the operator console menu, which had grown to numbers 1-9 plus
three letters bolted on with no order to them. Actions are now grouped by what
they touch, keyed by their first letter, and the old numbers still work so
nobody who has used it for months is stopped by a rearrangement.

The menu also warns when the server is not fully provisioned and names the key
that fixes it, instead of reporting it as ordinary status lines that read as
normal unless you already knew what to look for. That check is cached for the
session because it shells out to flask twice and the answer does not change
while somebody reads the screen.
This commit is contained in:
cproudlock
2026-08-05 13:42:20 -04:00
parent 23b1dfff41
commit d8fe0a48b2
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 ''