Added force page reload to the onClose events of update/reboot

Updated the text about reboot/update and used a smaller button.
Ensure we get the correct UI version.
Also fixed comment about the system update progress
This commit is contained in:
Marc Brooks 2025-09-30 17:45:00 -05:00
parent 85c98ee998
commit d7a56213ea
No known key found for this signature in database
GPG Key ID: 583A6AF2D6AE1DC6
2 changed files with 28 additions and 13 deletions

View File

@ -7,6 +7,12 @@ import { Button } from "@components/Button";
export default function SettingsGeneralRebootRoute() { export default function SettingsGeneralRebootRoute() {
const navigate = useNavigate(); const navigate = useNavigate();
const { send } = useJsonRpc(); const { send } = useJsonRpc();
const onClose = useCallback(() => {
navigate(".."); // back to the devices.$id.settings page
window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded
}, [navigate]);
const onConfirmUpdate = useCallback(() => { const onConfirmUpdate = useCallback(() => {
// This is where we send the RPC to the golang binary // This is where we send the RPC to the golang binary
@ -16,7 +22,7 @@ export default function SettingsGeneralRebootRoute() {
{ {
/* TODO: Migrate to using URLs instead of the global state. To simplify the refactoring, we'll keep the global state for now. */ /* TODO: Migrate to using URLs instead of the global state. To simplify the refactoring, we'll keep the global state for now. */
} }
return <Dialog onClose={() => navigate("..")} onConfirmUpdate={onConfirmUpdate} />; return <Dialog onClose={onClose} onConfirmUpdate={onConfirmUpdate} />;
} }
export function Dialog({ export function Dialog({

View File

@ -1,5 +1,5 @@
import { useLocation, useNavigate } from "react-router";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import { useLocation, useNavigate } from "react-router";
import { CheckCircleIcon } from "@heroicons/react/20/solid"; import { CheckCircleIcon } from "@heroicons/react/20/solid";
import { MdConnectWithoutContact, MdRestartAlt } from "react-icons/md"; import { MdConnectWithoutContact, MdRestartAlt } from "react-icons/md";
@ -19,6 +19,11 @@ export default function SettingsGeneralUpdateRoute() {
const { setModalView, otaState } = useUpdateStore(); const { setModalView, otaState } = useUpdateStore();
const { send } = useJsonRpc(); const { send } = useJsonRpc();
const onClose = useCallback(() => {
navigate(".."); // back to the devices.$id.settings page
window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded
}, [navigate]);
const onConfirmUpdate = useCallback(() => { const onConfirmUpdate = useCallback(() => {
send("tryUpdate", {}); send("tryUpdate", {});
setModalView("updating"); setModalView("updating");
@ -39,7 +44,7 @@ export default function SettingsGeneralUpdateRoute() {
{ {
/* TODO: Migrate to using URLs instead of the global state. To simplify the refactoring, we'll keep the global state for now. */ /* TODO: Migrate to using URLs instead of the global state. To simplify the refactoring, we'll keep the global state for now. */
} }
return <Dialog onClose={() => navigate("..")} onConfirmUpdate={onConfirmUpdate} />; return <Dialog onClose={onClose} onConfirmUpdate={onConfirmUpdate} />;
} }
export function Dialog({ export function Dialog({
@ -223,7 +228,7 @@ function UpdatingDeviceState({
100, 100,
); );
} else { } else {
// System: 10% download, 90% update // System: 10% download, 10% verification, 80% update
return Math.min( return Math.min(
downloadProgress * 0.1 + verificationProgress * 0.1 + updateProgress * 0.8, downloadProgress * 0.1 + verificationProgress * 0.1 + updateProgress * 0.8,
100, 100,
@ -287,17 +292,19 @@ function UpdatingDeviceState({
<span className="font-medium text-black dark:text-white"> <span className="font-medium text-black dark:text-white">
Rebooting the device to complete the update... Rebooting the device to complete the update...
</span> </span>
<p> <p className="font-medium text-black dark:text-white">
This may take a few minutes. The device will automatically This may take a few minutes. The device will automatically
reconnect once it is back online. If it doesn{"'"}t, you can reconnect once it is back online.<br/>
manually reconnect. If it doesn{"'"}t reconnect automatically, you can manually
reconnect by clicking here:
<LinkButton <LinkButton
size="SM" size="XS"
theme="light" theme="light"
text="Reconnect to KVM" text="Reconnect to KVM"
LeadingIcon={MdConnectWithoutContact} LeadingIcon={MdConnectWithoutContact}
textAlign="center" textAlign="center"
to={".."} reloadDocument={true}
to={"/"}
/> />
</p> </p>
</div> </div>
@ -307,15 +314,17 @@ function UpdatingDeviceState({
<span className="font-medium text-black dark:text-white"> <span className="font-medium text-black dark:text-white">
Device reboot is pending... Device reboot is pending...
</span> </span>
<p> <p className="font-medium text-black dark:text-white">
The JetKVM is preparing to reboot. This may take a while. If it doesn{"'"}t automatically reboot The JetKVM is preparing to reboot. This may take a while.<br/>
after a few minutes, you can manually request a reboot. If it doesn{"'"}t automatically reboot after a few minutes, you
can manually request a reboot by clicking here:
<LinkButton <LinkButton
size="SM" size="XS"
theme="light" theme="light"
text="Reboot the KVM" text="Reboot the KVM"
LeadingIcon={MdRestartAlt} LeadingIcon={MdRestartAlt}
textAlign="center" textAlign="center"
reloadDocument={true}
to={"../reboot"} to={"../reboot"}
/> />
</p> </p>