mirror of https://github.com/jetkvm/kvm.git
feat: redirect to setup page after config reset
This commit is contained in:
parent
aa7c6fe082
commit
95e5e15226
|
|
@ -177,16 +177,19 @@ func (s *State) doUpdate(ctx context.Context, params UpdateParams) error {
|
||||||
if s.rebootNeeded {
|
if s.rebootNeeded {
|
||||||
scopedLogger.Info().Msg("System Rebooting due to OTA update")
|
scopedLogger.Info().Msg("System Rebooting due to OTA update")
|
||||||
|
|
||||||
|
redirectUrl := fmt.Sprintf("/settings/general/update?version=%s", systemUpdate.version)
|
||||||
|
|
||||||
if params.ResetConfig {
|
if params.ResetConfig {
|
||||||
scopedLogger.Info().Msg("Resetting config")
|
scopedLogger.Info().Msg("Resetting config")
|
||||||
if err := s.resetConfig(); err != nil {
|
if err := s.resetConfig(); err != nil {
|
||||||
return s.componentUpdateError("Error resetting config", err, &scopedLogger)
|
return s.componentUpdateError("Error resetting config", err, &scopedLogger)
|
||||||
}
|
}
|
||||||
|
redirectUrl = "/device/setup"
|
||||||
}
|
}
|
||||||
|
|
||||||
postRebootAction := &PostRebootAction{
|
postRebootAction := &PostRebootAction{
|
||||||
HealthCheck: "/device/status",
|
HealthCheck: "/device/status",
|
||||||
RedirectUrl: fmt.Sprintf("/settings/general/update?version=%s", systemUpdate.version),
|
RedirectUrl: redirectUrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.reboot(true, postRebootAction, 10*time.Second); err != nil {
|
if err := s.reboot(true, postRebootAction, 10*time.Second); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@
|
||||||
"advanced_error_update_ssh_key": "Failed to update SSH key: {error}",
|
"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_disable": "Failed to disable USB emulation: {error}",
|
||||||
"advanced_error_usb_emulation_enable": "Failed to enable 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_description": "Restrict web interface access to localhost only (127.0.0.1)",
|
||||||
"advanced_loopback_only_title": "Loopback-Only Mode",
|
"advanced_loopback_only_title": "Loopback-Only Mode",
|
||||||
"advanced_loopback_warning_before": "Before enabling this feature, make sure you have either:",
|
"advanced_loopback_warning_before": "Before enabling this feature, make sure you have either:",
|
||||||
|
|
@ -101,19 +100,6 @@
|
||||||
"advanced_update_ssh_key_button": "Update SSH Key",
|
"advanced_update_ssh_key_button": "Update SSH Key",
|
||||||
"advanced_usb_emulation_description": "Control the USB emulation state",
|
"advanced_usb_emulation_description": "Control the USB emulation state",
|
||||||
"advanced_usb_emulation_title": "USB Emulation",
|
"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_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_other_user": "This device is currently registered to another user in our cloud dashboard.",
|
||||||
"already_adopted_return_to_dashboard": "Return to Dashboard",
|
"already_adopted_return_to_dashboard": "Return to Dashboard",
|
||||||
|
|
@ -255,8 +241,8 @@
|
||||||
"general_auto_update_description": "Automatically update the device to the latest version",
|
"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_error": "Failed to set auto-update: {error}",
|
||||||
"general_auto_update_title": "Auto Update",
|
"general_auto_update_title": "Auto Update",
|
||||||
"general_check_for_stable_updates": "Downgrade",
|
|
||||||
"general_check_for_updates": "Check for Updates",
|
"general_check_for_updates": "Check for Updates",
|
||||||
|
"general_check_for_stable_updates": "Downgrade",
|
||||||
"general_page_description": "Configure device settings and update preferences",
|
"general_page_description": "Configure device settings and update preferences",
|
||||||
"general_reboot_description": "Do you want to proceed with rebooting the system?",
|
"general_reboot_description": "Do you want to proceed with rebooting the system?",
|
||||||
"general_reboot_device": "Reboot Device",
|
"general_reboot_device": "Reboot Device",
|
||||||
|
|
@ -276,13 +262,9 @@
|
||||||
"general_update_checking_title": "Checking for updates…",
|
"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_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_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_description": "An error occurred while updating your device. Please try again later.",
|
||||||
"general_update_error_details": "Error details: {errorMessage}",
|
"general_update_error_details": "Error details: {errorMessage}",
|
||||||
"general_update_error_title": "Update Error",
|
"general_update_error_title": "Update Error",
|
||||||
"general_update_keep_current_button": "Keep Current Version",
|
|
||||||
"general_update_later_button": "Do it later",
|
"general_update_later_button": "Do it later",
|
||||||
"general_update_now_button": "Update Now",
|
"general_update_now_button": "Update Now",
|
||||||
"general_update_rebooting": "Rebooting to complete the update…",
|
"general_update_rebooting": "Rebooting to complete the update…",
|
||||||
|
|
@ -916,5 +898,23 @@
|
||||||
"wake_on_lan_invalid_mac": "Invalid MAC address",
|
"wake_on_lan_invalid_mac": "Invalid MAC address",
|
||||||
"wake_on_lan_magic_sent_success": "Magic Packet sent successfully",
|
"wake_on_lan_magic_sent_success": "Magic Packet sent successfully",
|
||||||
"welcome_to_jetkvm": "Welcome to JetKVM",
|
"welcome_to_jetkvm": "Welcome to JetKVM",
|
||||||
"welcome_to_jetkvm_description": "Control any computer remotely"
|
"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",
|
||||||
|
"advanced_version_update_reset_config_description": "Reset configuration after the update",
|
||||||
|
"advanced_version_update_reset_config_label": "Reset configuration"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ export default function SettingsGeneralUpdateRoute() {
|
||||||
|
|
||||||
const downgrade = useMemo(() => searchParams.get("downgrade") === "true", [searchParams]);
|
const downgrade = useMemo(() => searchParams.get("downgrade") === "true", [searchParams]);
|
||||||
const updateComponents = useMemo(() => searchParams.get("components") || "", [searchParams]);
|
const updateComponents = useMemo(() => searchParams.get("components") || "", [searchParams]);
|
||||||
|
const resetConfig = useMemo(() => searchParams.get("resetConfig") === "true", [searchParams]);
|
||||||
|
|
||||||
const onClose = useCallback(async () => {
|
const onClose = useCallback(async () => {
|
||||||
navigate(".."); // back to the devices.$id.settings page
|
navigate(".."); // back to the devices.$id.settings page
|
||||||
|
|
@ -46,11 +47,10 @@ export default function SettingsGeneralUpdateRoute() {
|
||||||
},
|
},
|
||||||
includePreRelease: true,
|
includePreRelease: true,
|
||||||
checkOnly: false,
|
checkOnly: false,
|
||||||
// TODO: implement this
|
resetConfig: resetConfig,
|
||||||
resetConfig: false,
|
|
||||||
});
|
});
|
||||||
setModalView("updating");
|
setModalView("updating");
|
||||||
}, [send, setModalView, updateComponents]);
|
}, [send, setModalView, updateComponents, resetConfig]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (otaState.updating) {
|
if (otaState.updating) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue