From aa7c6fe082cbfe8c2b039a1d51fe1dc1c6d7a749 Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Fri, 31 Oct 2025 18:51:51 +0100 Subject: [PATCH] feat: enhance version update settings with reset configuration option --- ui/localization/messages/en.json | 38 ++++++++++--------- .../routes/devices.$id.settings.advanced.tsx | 18 +++++++-- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/ui/localization/messages/en.json b/ui/localization/messages/en.json index 69a44fda..c8a6e948 100644 --- a/ui/localization/messages/en.json +++ b/ui/localization/messages/en.json @@ -74,6 +74,7 @@ "advanced_error_update_ssh_key": "Failed to update SSH key: {error}", "advanced_error_usb_emulation_disable": "Failed to disable USB emulation: {error}", "advanced_error_usb_emulation_enable": "Failed to enable USB emulation: {error}", + "advanced_error_version_update": "Failed to initiate version update: {error}", "advanced_loopback_only_description": "Restrict web interface access to localhost only (127.0.0.1)", "advanced_loopback_only_title": "Loopback-Only Mode", "advanced_loopback_warning_before": "Before enabling this feature, make sure you have either:", @@ -100,6 +101,19 @@ "advanced_update_ssh_key_button": "Update SSH Key", "advanced_usb_emulation_description": "Control the USB emulation state", "advanced_usb_emulation_title": "USB Emulation", + "advanced_version_update_app_label": "App Version", + "advanced_version_update_button": "Update to Version", + "advanced_version_update_description": "Install a specific version from GitHub releases", + "advanced_version_update_github_link": "JetKVM releases page", + "advanced_version_update_helper": "Find available versions on the", + "advanced_version_update_reset_config_description": "Reset configuration after the update", + "advanced_version_update_reset_config_label": "Reset configuration", + "advanced_version_update_system_label": "System Version", + "advanced_version_update_target_app": "App only", + "advanced_version_update_target_both": "Both App and System", + "advanced_version_update_target_label": "What to update", + "advanced_version_update_target_system": "System only", + "advanced_version_update_title": "Update to Specific Version", "already_adopted_new_owner": "If you're the new owner, please ask the previous owner to de-register the device from their account in the cloud dashboard. If you believe this is an error, contact our support team for assistance.", "already_adopted_other_user": "This device is currently registered to another user in our cloud dashboard.", "already_adopted_return_to_dashboard": "Return to Dashboard", @@ -241,8 +255,8 @@ "general_auto_update_description": "Automatically update the device to the latest version", "general_auto_update_error": "Failed to set auto-update: {error}", "general_auto_update_title": "Auto Update", - "general_check_for_updates": "Check for Updates", "general_check_for_stable_updates": "Downgrade", + "general_check_for_updates": "Check for Updates", "general_page_description": "Configure device settings and update preferences", "general_reboot_description": "Do you want to proceed with rebooting the system?", "general_reboot_device": "Reboot Device", @@ -262,9 +276,13 @@ "general_update_checking_title": "Checking for updates…", "general_update_completed_description": "Your device has been successfully updated to the latest version. Enjoy the new features and improvements!", "general_update_completed_title": "Update Completed Successfully", + "general_update_downgrade_available_description": "A downgrade is available to revert to a previous version.", + "general_update_downgrade_available_title": "Downgrade Available", + "general_update_downgrade_button": "Downgrade Now", "general_update_error_description": "An error occurred while updating your device. Please try again later.", "general_update_error_details": "Error details: {errorMessage}", "general_update_error_title": "Update Error", + "general_update_keep_current_button": "Keep Current Version", "general_update_later_button": "Do it later", "general_update_now_button": "Update Now", "general_update_rebooting": "Rebooting to complete the update…", @@ -898,21 +916,5 @@ "wake_on_lan_invalid_mac": "Invalid MAC address", "wake_on_lan_magic_sent_success": "Magic Packet sent successfully", "welcome_to_jetkvm": "Welcome to JetKVM", - "welcome_to_jetkvm_description": "Control any computer remotely", - "advanced_version_update_app_label": "App Version", - "advanced_version_update_button": "Update to Version", - "advanced_version_update_description": "Install a specific version from GitHub releases", - "advanced_version_update_github_link": "JetKVM releases page", - "advanced_version_update_helper": "Find available versions on the", - "advanced_version_update_system_label": "System Version", - "advanced_version_update_target_app": "App only", - "advanced_version_update_target_both": "Both App and System", - "advanced_version_update_target_label": "What to update", - "advanced_version_update_target_system": "System only", - "advanced_version_update_title": "Update to Specific Version", - "advanced_error_version_update": "Failed to initiate version update: {error}", - "general_update_downgrade_available_description": "A downgrade is available to revert to a previous version.", - "general_update_downgrade_available_title": "Downgrade Available", - "general_update_downgrade_button": "Downgrade Now", - "general_update_keep_current_button": "Keep Current Version" + "welcome_to_jetkvm_description": "Control any computer remotely" } diff --git a/ui/src/routes/devices.$id.settings.advanced.tsx b/ui/src/routes/devices.$id.settings.advanced.tsx index 6df14bec..e0facfaf 100644 --- a/ui/src/routes/devices.$id.settings.advanced.tsx +++ b/ui/src/routes/devices.$id.settings.advanced.tsx @@ -4,7 +4,7 @@ import { useSettingsStore } from "@hooks/stores"; import { JsonRpcResponse, useJsonRpc } from "@hooks/useJsonRpc"; import { useDeviceUiNavigation } from "@hooks/useAppNavigation"; import { Button } from "@components/Button"; -import Checkbox from "@components/Checkbox"; +import Checkbox, { CheckboxWithLabel } from "@components/Checkbox"; import { ConfirmDialog } from "@components/ConfirmDialog"; import { GridCard } from "@components/Card"; import { SettingsItem } from "@components/SettingsItem"; @@ -31,6 +31,7 @@ export default function SettingsAdvancedRoute() { const [updateTarget, setUpdateTarget] = useState("app"); const [appVersion, setAppVersion] = useState(""); const [systemVersion, setSystemVersion] = useState(""); + const [resetConfig, setResetConfig] = useState(false); const settings = useSettingsStore(); @@ -192,6 +193,7 @@ export default function SettingsAdvancedRoute() { // no need to reset config for a check only update resetConfig: false, }; + send("tryUpdateComponents", params, (resp: JsonRpcResponse) => { if ("error" in resp) { notifications.error( @@ -201,14 +203,13 @@ export default function SettingsAdvancedRoute() { } const pageParams = new URLSearchParams(); pageParams.set("downgrade", "true"); - // TODO: implement this - pageParams.set("resetConfig", "true"); + pageParams.set("resetConfig", resetConfig.toString()); pageParams.set("components", updateTarget == "both" ? "app,system" : updateTarget); // Navigate to update page navigateTo(`/settings/general/update?${pageParams.toString()}`); }); - }, [updateTarget,appVersion, systemVersion, devChannel, send, navigateTo]); + }, [updateTarget, appVersion, systemVersion, devChannel, send, navigateTo, resetConfig]); return (
@@ -347,6 +348,15 @@ export default function SettingsAdvancedRoute() {

+
+ setResetConfig(e.target.checked)} + /> +
+