diff --git a/resources/js/components/update-instructions.tsx b/resources/js/components/update-instructions.tsx index 5c24b005..cdf52312 100644 --- a/resources/js/components/update-instructions.tsx +++ b/resources/js/components/update-instructions.tsx @@ -1,3 +1,4 @@ +import { UpdateOptionsDialog } from '@/components/update-options-dialog'; import { useTranslation } from '@/hooks/use-translation'; import { cn } from '@/lib/utils'; @@ -45,9 +46,10 @@ export function UpdateInstructions({ if (compact) { return ( -

- {t('To update, run sudo ./update.sh in the install directory — it asks before it downloads or changes anything.')} -

+
+

{t('To update, run sudo ./update.sh in the install directory — it asks before it downloads or changes anything.')}

+ +
); } @@ -65,6 +67,9 @@ export function UpdateInstructions({ 'It asks before checking for a release, before downloading one, and before touching your installation — and verifies the checksum of what it downloads. UPDATE.md has the full procedure.', )}

+
+ +
); } diff --git a/resources/js/components/update-options-dialog.tsx b/resources/js/components/update-options-dialog.tsx new file mode 100644 index 00000000..13341ffe --- /dev/null +++ b/resources/js/components/update-options-dialog.tsx @@ -0,0 +1,72 @@ +import { useState } from 'react'; + +import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'; +import { useTranslation } from '@/hooks/use-translation'; + +/** + * The handful of update.sh options worth knowing about, behind a link + * rather than printed on the page. + * + * The screen that tells somebody how to update has one job: the one + * command. Listing every flag beside it would bury that command under + * options most people never need — but two of them are the ones an + * administrator most wants at exactly that moment ("can it back up for + * me?", "can I just look?"), and finding them meant opening UPDATE.md on + * a machine they are probably not sitting at. + * + * So: nothing on screen until asked for, and then four lines. The script + * documents the rest with --help, and UPDATE.md documents the procedure. + * + * It opens from inside the update dialog as well as from the dashboard + * card. A dialog on top of a dialog is unusual, and correct here — the + * reader asked for a footnote to what they are already reading, and + * Escape returns them to it. + */ +export function UpdateOptionsDialog() { + const { t } = useTranslation(); + const [open, setOpen] = useState(false); + + const options: { flag: string; description: string }[] = [ + { flag: '--backup', description: t('Dump the database before touching anything, and stop if the dump fails.') }, + { flag: '--check', description: t('Report which version is installed and which is available, and change nothing.') }, + { flag: '--i-have-a-backup', description: t('Skip the question about backups, for a run you are not sitting in front of.') }, + { flag: '--no-restart', description: t('Leave PHP and the worker alone, for when you restart them yourself.') }, + ]; + + return ( + <> + + + + + + {t('Update options')} + + +
+

+ {t('Run the script with no options and it asks about each of these as it goes. These are for the runs where you already know the answer.')} +

+ +
+ {options.map((option) => ( +
+
+ {option.flag} +
+
{option.description}
+
+ ))} +
+ +

+ {t('sudo ./update.sh --help lists every option, and UPDATE.md walks through the whole procedure, including doing it by hand.')} +

+
+
+
+ + ); +}