mirror of https://github.com/jetkvm/kvm.git
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:
parent
85c98ee998
commit
d7a56213ea
|
@ -8,6 +8,12 @@ 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
|
||||||
send("reboot", {force: true});
|
send("reboot", {force: true});
|
||||||
|
@ -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({
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue