mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-06 03:03:20 +02:00
Properly hide things with disable enterprise flag
This commit is contained in:
@@ -43,6 +43,7 @@ import { usePaidStatus } from "@app/hooks/usePaidStatus";
|
|||||||
import { tierMatrix, TierFeature } from "@server/lib/billing/tierMatrix";
|
import { tierMatrix, TierFeature } from "@server/lib/billing/tierMatrix";
|
||||||
import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert";
|
import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert";
|
||||||
import { ExternalLink } from "lucide-react";
|
import { ExternalLink } from "lucide-react";
|
||||||
|
import { env } from "process";
|
||||||
|
|
||||||
// Schema for general organization settings
|
// Schema for general organization settings
|
||||||
const GeneralFormSchema = z.object({
|
const GeneralFormSchema = z.object({
|
||||||
@@ -165,6 +166,7 @@ function DeleteForm({ org }: SectionFormProps) {
|
|||||||
|
|
||||||
function GeneralSectionForm({ org }: SectionFormProps) {
|
function GeneralSectionForm({ org }: SectionFormProps) {
|
||||||
const { updateOrg } = useOrgContext();
|
const { updateOrg } = useOrgContext();
|
||||||
|
const { env } = useEnvContext();
|
||||||
const form = useForm({
|
const form = useForm({
|
||||||
resolver: zodResolver(
|
resolver: zodResolver(
|
||||||
GeneralFormSchema.pick({
|
GeneralFormSchema.pick({
|
||||||
@@ -265,6 +267,7 @@ function GeneralSectionForm({ org }: SectionFormProps) {
|
|||||||
<PaidFeaturesAlert
|
<PaidFeaturesAlert
|
||||||
tiers={tierMatrix.newtAutoUpdate}
|
tiers={tierMatrix.newtAutoUpdate}
|
||||||
/>
|
/>
|
||||||
|
{!env.flags.disableEnterpriseFeatures && (
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="settingsEnableGlobalNewtAutoUpdate"
|
name="settingsEnableGlobalNewtAutoUpdate"
|
||||||
@@ -275,8 +278,12 @@ function GeneralSectionForm({ org }: SectionFormProps) {
|
|||||||
id="settings-enable-global-newt-auto-update"
|
id="settings-enable-global-newt-auto-update"
|
||||||
label={t("newtAutoUpdate")}
|
label={t("newtAutoUpdate")}
|
||||||
checked={field.value}
|
checked={field.value}
|
||||||
onCheckedChange={field.onChange}
|
onCheckedChange={
|
||||||
disabled={!hasAutoUpdateFeature}
|
field.onChange
|
||||||
|
}
|
||||||
|
disabled={
|
||||||
|
!hasAutoUpdateFeature
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormDescription>
|
<FormDescription>
|
||||||
@@ -295,6 +302,7 @@ function GeneralSectionForm({ org }: SectionFormProps) {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
</SettingsSectionForm>
|
</SettingsSectionForm>
|
||||||
|
|||||||
@@ -253,7 +253,9 @@ export default function GeneralPage() {
|
|||||||
<PaidFeaturesAlert
|
<PaidFeaturesAlert
|
||||||
tiers={tierMatrix.newtAutoUpdate}
|
tiers={tierMatrix.newtAutoUpdate}
|
||||||
/>
|
/>
|
||||||
{site && site.type === "newt" && (
|
{site &&
|
||||||
|
site.type === "newt" &&
|
||||||
|
!env.flags.disableEnterpriseFeatures && (
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="autoUpdateEnabled"
|
name="autoUpdateEnabled"
|
||||||
|
|||||||
@@ -75,7 +75,11 @@ export function NewtSiteInstallCommands({
|
|||||||
: "";
|
: "";
|
||||||
|
|
||||||
const disableSshFlag =
|
const disableSshFlag =
|
||||||
supportsSshOption && !allowPangolinSsh ? " --disable-ssh" : "";
|
supportsSshOption &&
|
||||||
|
!allowPangolinSsh &&
|
||||||
|
!env.flags.disableEnterpriseFeatures
|
||||||
|
? " --disable-ssh"
|
||||||
|
: "";
|
||||||
const runAsRootPrefix =
|
const runAsRootPrefix =
|
||||||
supportsSshOption && allowPangolinSsh ? "sudo " : "";
|
supportsSshOption && allowPangolinSsh ? "sudo " : "";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user