-
Notifications
You must be signed in to change notification settings - Fork 180
[dashboard] feat: add auto_update_always toggle to client settings #580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import { | |
| SelectDropdown, | ||
| SelectOption, | ||
| } from "@components/select/SelectDropdown"; | ||
| import { Callout } from "@components/Callout"; | ||
| import { useHasChanges } from "@hooks/useHasChanges"; | ||
| import * as Tabs from "@radix-ui/react-tabs"; | ||
| import { useApiCall } from "@utils/api"; | ||
|
|
@@ -20,6 +21,7 @@ import { | |
| ExternalLinkIcon, | ||
| FlaskConicalIcon, | ||
| MonitorSmartphoneIcon, | ||
| AlertTriangle, | ||
| RefreshCcw, | ||
| } from "lucide-react"; | ||
| import React, { useMemo, useState } from "react"; | ||
|
|
@@ -84,6 +86,10 @@ function ClientSettingsTabContent({ account }: Readonly<Props>) { | |
| isCustomVersion ? autoUpdateSetting : "", | ||
| ); | ||
|
|
||
| const [autoUpdateAlways, setAutoUpdateAlways] = useState( | ||
| account.settings?.auto_update_always ?? false, | ||
| ); | ||
|
|
||
| const [peerExposeEnabled, setPeerExposeEnabled] = useState<boolean>( | ||
| account?.settings?.peer_expose_enabled ?? false, | ||
| ); | ||
|
|
@@ -99,6 +105,7 @@ function ClientSettingsTabContent({ account }: Readonly<Props>) { | |
| const { hasChanges, updateRef } = useHasChanges([ | ||
| autoUpdateMethod, | ||
| autoUpdateCustomVersion, | ||
| autoUpdateAlways, | ||
| peerExposeEnabled, | ||
| peerExposeGroupNames, | ||
| ]); | ||
|
|
@@ -155,6 +162,7 @@ function ClientSettingsTabContent({ account }: Readonly<Props>) { | |
| settings: { | ||
| ...account.settings, | ||
| auto_update_version: autoUpdateCustomVersion || autoUpdateMethod, | ||
| auto_update_always: autoUpdateAlways, | ||
| peer_expose_enabled: peerExposeEnabled, | ||
| peer_expose_groups: peerExposeGroupIds, | ||
| }, | ||
|
|
@@ -164,6 +172,7 @@ function ClientSettingsTabContent({ account }: Readonly<Props>) { | |
| updateRef([ | ||
| autoUpdateMethod, | ||
| autoUpdateCustomVersion, | ||
| autoUpdateAlways, | ||
| peerExposeEnabled, | ||
| peerExposeGroupNames, | ||
| ]); | ||
|
|
@@ -235,9 +244,9 @@ function ClientSettingsTabContent({ account }: Readonly<Props>) { | |
| /> | ||
| </Label> | ||
| <HelpText> | ||
| Select how NetBird clients handle automatic updates by choosing | ||
| the latest version, a custom version, or disabling updates | ||
| altogether. Automatic Updates require at least NetBird{" "} | ||
| Configure how NetBird clients receive update notifications. | ||
| When enabled, users will be prompted to install the selected | ||
| version. Automatic Updates require at least NetBird{" "} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new automatic-update copy contradicts itself. Lines 247-249 say enabled updates prompt the user to install, while Lines 287-289 say they install automatically without user interaction. When the force toggle is on, both statements are shown together. ✏️ Possible wording- Configure how NetBird clients receive update notifications.
- When enabled, users will be prompted to install the selected
- version. Automatic Updates require at least NetBird{" "}
+ Configure how NetBird clients receive updates. By default, users
+ are prompted to install the selected version, or you can enable
+ Force Automatic Updates below to install it in the background.
+ Automatic Updates require at least NetBird{" "}Also applies to: 287-289 🤖 Prompt for AI Agents
pappz marked this conversation as resolved.
Outdated
|
||
| <span className={"text-white font-medium"}>v0.61.0</span>.{" "} | ||
| <InlineLink | ||
| href={"https://docs.netbird.io/manage/peers/auto-update"} | ||
|
|
@@ -265,6 +274,39 @@ function ClientSettingsTabContent({ account }: Readonly<Props>) { | |
| }} | ||
| /> | ||
| </div> | ||
| <FancyToggleSwitch | ||
| className={"mt-4"} | ||
| value={autoUpdateAlways} | ||
| onChange={setAutoUpdateAlways} | ||
| label={ | ||
| <> | ||
| <AlertTriangle size={15} className={"text-yellow-400"} /> | ||
| Force Automatic Updates | ||
| </> | ||
| } | ||
| helpText={ | ||
| "When enabled, updates are installed automatically in the background without user interaction." | ||
| } | ||
| disabled={ | ||
| !permission.settings.update || autoUpdateMethod === "disabled" | ||
| } | ||
| /> | ||
| {autoUpdateAlways && autoUpdateMethod !== "disabled" && ( | ||
| <Callout | ||
| className={"mt-3"} | ||
| variant={"warning"} | ||
| icon={ | ||
| <AlertTriangle | ||
| size={14} | ||
| className={"shrink-0 relative top-[3px]"} | ||
| /> | ||
| } | ||
| > | ||
| Enabling automatic updates will restart the NetBird client | ||
| during updates, which can temporarily disrupt active | ||
| connections. Use with caution in production environments. | ||
| </Callout> | ||
| )} | ||
| </div> | ||
|
|
||
| <div> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normalize
autoUpdateAlwayswhen auto updates are disabled.This state is restored from Line 90 and always persisted again on Line 165, but nothing clears it when the update method becomes
"disabled". A user can saveauto_update_version: "disabled"together withauto_update_always: true, and after reload the force toggle comes back on but disabled.💡 Suggested fix
const handleUpdateMethodChange = (value: string) => { setAutoUpdateMethod(value); if (value === "disabled" || value === "latest") { setAutoUpdateCustomVersion(""); } + if (value === "disabled") { + setAutoUpdateAlways(false); + } };...account.settings, auto_update_version: autoUpdateCustomVersion || autoUpdateMethod, - auto_update_always: autoUpdateAlways, + auto_update_always: + autoUpdateMethod === "disabled" ? false : autoUpdateAlways, peer_expose_enabled: peerExposeEnabled,Also applies to: 164-166
🤖 Prompt for AI Agents