diff --git a/messages/en-US.json b/messages/en-US.json index 4f826a609..dd8de3773 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1601,16 +1601,15 @@ "contents": "Contents", "parsedContents": "Parsed Contents (Read Only)", "enableDockerSocket": "Enable Docker Blueprint", - "enableDockerSocketDescription": "Enable Docker Socket label scraping for blueprint labels. Socket path must be provided to Newt. Read about how this works in the documentation.", - "newtAutoUpdate": "Enable Newt Auto-Update", - "newtAutoUpdateDescription": "When enabled, Newt clients will automatically update to the latest version when a new release is available.", - "newtAutoUpdateDisabledDescription": "This feature requires a valid license (Enterprise) or active subscription (SaaS)", - "siteAutoUpdate": "Newt Auto-Update", + "enableDockerSocketDescription": "Enable Docker Socket label scraping for blueprint labels. Socket path must be provided to the site connector. Read about how this works in the documentation.", + "newtAutoUpdate": "Enable Site Auto-Update", + "newtAutoUpdateDescription": "When enabled, site connectors will automatically update to the latest version when a new release is available.", + "siteAutoUpdate": "Site Auto-Update", "siteAutoUpdateLabel": "Enable Auto-Update", - "siteAutoUpdateDescription": "Control whether this site's Newt client automatically updates. When not overriding, the organization default is used.", + "siteAutoUpdateDescription": "Control whether this site's connector automatically downloads the latest version.", "siteAutoUpdateOrgDefault": "Organization default: {state}", "siteAutoUpdateOverriding": "Overriding organization setting", - "siteAutoUpdateResetToOrg": "Reset to organization default", + "siteAutoUpdateResetToOrg": "Reset to Organization Default", "siteAutoUpdateEnabled": "enabled", "siteAutoUpdateDisabled": "disabled", "viewDockerContainers": "View Docker Containers", diff --git a/src/app/[orgId]/settings/general/page.tsx b/src/app/[orgId]/settings/general/page.tsx index 009f2c830..bef9b0cd7 100644 --- a/src/app/[orgId]/settings/general/page.tsx +++ b/src/app/[orgId]/settings/general/page.tsx @@ -217,6 +217,7 @@ function GeneralSectionForm({ org }: SectionFormProps) { title: t("orgUpdated"), description: t("orgUpdatedDescription") }); + router.refresh(); } catch (e) { toast({ @@ -260,6 +261,9 @@ function GeneralSectionForm({ org }: SectionFormProps) { )} /> + - {hasAutoUpdateFeature - ? t("newtAutoUpdateDescription") - : t( - "newtAutoUpdateDisabledDescription" - )} + {t("newtAutoUpdateDescription")} diff --git a/src/app/[orgId]/settings/sites/[niceId]/general/page.tsx b/src/app/[orgId]/settings/sites/[niceId]/general/page.tsx index 9c1bb467d..cb3f0706d 100644 --- a/src/app/[orgId]/settings/sites/[niceId]/general/page.tsx +++ b/src/app/[orgId]/settings/sites/[niceId]/general/page.tsx @@ -40,6 +40,7 @@ import { useOrgContext } from "@app/hooks/useOrgContext"; import { usePaidStatus } from "@app/hooks/usePaidStatus"; import { tierMatrix, TierFeature } from "@server/lib/billing/tierMatrix"; import { Button as ButtonUI } from "@/components/ui/button"; +import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert"; const GeneralFormSchema = z.object({ name: z.string().nonempty("Name is required"), @@ -70,8 +71,7 @@ export default function GeneralPage() { null ); - const orgAutoUpdate = - org.org.settingsEnableGlobalNewtAutoUpdate ?? false; + const orgAutoUpdate = org.org.settingsEnableGlobalNewtAutoUpdate ?? false; const form = useForm({ resolver: zodResolver(GeneralFormSchema), @@ -221,7 +221,9 @@ export default function GeneralPage() { {t.rich( "enableDockerSocketDescription", { - docsLink: (chunks) => ( + docsLink: ( + chunks + ) => ( )} + {site && site.type === "newt" && ( { - const isOverriding = - form.watch( - "autoUpdateOverrideOrg" - ); + const isOverriding = form.watch( + "autoUpdateOverrideOrg" + ); return ( - { - field.onChange( +
+ - - - {isOverriding ? ( - - - {t( - "siteAutoUpdateOverriding" - )} - + ) => { + field.onChange( + checked + ); + form.setValue( + "autoUpdateOverrideOrg", + true + ); + }} + disabled={ + !hasAutoUpdateFeature + } + /> + {isOverriding && ( { form.setValue( "autoUpdateOverrideOrg", @@ -302,20 +301,12 @@ export default function GeneralPage() { "siteAutoUpdateResetToOrg" )} - - ) : ( - t( - "siteAutoUpdateOrgDefault", - { - state: orgAutoUpdate - ? t( - "siteAutoUpdateEnabled" - ) - : t( - "siteAutoUpdateDisabled" - ) - } - ) + )} +
+
+ + {t( + "siteAutoUpdateDescription" )} diff --git a/src/app/[orgId]/settings/sites/[niceId]/layout.tsx b/src/app/[orgId]/settings/sites/[niceId]/layout.tsx index ba65d06e0..ef79908c3 100644 --- a/src/app/[orgId]/settings/sites/[niceId]/layout.tsx +++ b/src/app/[orgId]/settings/sites/[niceId]/layout.tsx @@ -1,6 +1,8 @@ import SiteProvider from "@app/providers/SiteProvider"; +import OrgProvider from "@app/providers/OrgProvider"; import { internal } from "@app/lib/api"; import { GetSiteResponse } from "@server/routers/site"; +import { GetOrgResponse } from "@server/routers/org"; import { AxiosResponse } from "axios"; import { redirect } from "next/navigation"; import { authCookieHeader } from "@app/lib/api/cookies"; @@ -35,6 +37,17 @@ export default async function SettingsLayout(props: SettingsLayoutProps) { redirect(`/${params.orgId}/settings/sites`); } + let org = null; + try { + const res = await internal.get>( + `/org/${params.orgId}`, + await authCookieHeader() + ); + org = res.data.data; + } catch { + redirect(`/${params.orgId}/settings/sites`); + } + const t = await getTranslations(); const navItems = [ @@ -64,10 +77,14 @@ export default async function SettingsLayout(props: SettingsLayoutProps) { /> -
- - {children} -
+ +
+ + + {children} + +
+
); diff --git a/src/components/SwitchInput.tsx b/src/components/SwitchInput.tsx index a33d00ffe..caaf910ba 100644 --- a/src/components/SwitchInput.tsx +++ b/src/components/SwitchInput.tsx @@ -45,7 +45,16 @@ export function SwitchInput({ return (
- {label && } + {label && ( + + )}