Skip to content

The open alternative to Salesforce, designed for AI.

Add readable admin feature flag names and descriptions (#25927)

Thomas des Francsbc39bc326212
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata.ts b/packages/twenty-front/src/modules/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata.ts
new file mode 100644
index 00000000000..4a05d6d81a0
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata.ts
@@ -0,0 +1,69 @@
+import { type MessageDescriptor } from '@lingui/core';
+import { msg } from '@lingui/core/macro';
+
+import { FeatureFlagKey } from '~/generated-admin/graphql';
+
+// Public flags use server-provided client config metadata to stay consistent with the lab.
+export const SETTINGS_ADMIN_FEATURE_FLAG_METADATA: Partial<
+ Record<
+ FeatureFlagKey,
+ { label: MessageDescriptor; description: MessageDescriptor }
+ >
+> = {
+ [FeatureFlagKey.IS_APP_CLAIMING_ENABLED]: {
+ label: msg`App claiming`,
+ description: msg`Allow developers to claim ownership of applications.`,
+ },
+ [FeatureFlagKey.IS_UNIQUE_INDEXES_ENABLED]: {
+ label: msg`Unique indexes`,
+ description: msg`Allow unique indexes to prevent duplicate field values.`,
+ },
+ [FeatureFlagKey.IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED]: {
+ label: msg`Configurable search fields`,
+ description: msg`Choose which fields are used when searching for records.`,
+ },
+ [FeatureFlagKey.IS_JSON_FILTER_ENABLED]: {
+ label: msg`JSON filters`,
+ description: msg`Allow filtering records by values inside JSON fields.`,
+ },
+ [FeatureFlagKey.IS_EMAIL_GROUP_ENABLED]: {
+ label: msg`Email campaigns`,
+ description: msg`Enable email campaigns and sending domain management.`,
+ },
+ [FeatureFlagKey.IS_REST_METADATA_API_NEW_FORMAT_DIRECT]: {
+ label: msg`Direct REST metadata responses`,
+ description: msg`Return metadata directly instead of wrapping it in the legacy response envelope.`,
+ },
+ [FeatureFlagKey.IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED]: {
+ label: msg`Prebuilt logic functions`,
+ description: msg`Run logic functions from prebuilt application bundles.`,
+ },
+ [FeatureFlagKey.IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED]: {
+ label: msg`Workflow index page`,
+ description: msg`Use the dedicated workflow index page to browse workflows and their versions.`,
+ },
+ [FeatureFlagKey.IS_API_RATE_LIMIT_V2_ENABLED]: {
+ label: msg`API rate limits v2`,
+ description: msg`Use the usage limit engine to enforce API request speed limits.`,
+ },
+ [FeatureFlagKey.IS_MESSAGE_CALENDAR_TARGET_READ_ENABLED]: {
+ label: msg`Message and calendar target reads`,
+ description: msg`Use target relations to find messages and calendar events linked to records.`,
+ },
+ [FeatureFlagKey.IS_QUOTA_ENGINE_CREDIT_BOUND_ENABLED]: {
+ label: msg`Credit allowance quotas`,
+ description: msg`Use the quota engine to enforce credit allowances.`,
+ },
+ [FeatureFlagKey.IS_RECORD_CREATION_FORM_ENABLED]: {
+ label: msg`Record creation form`,
+ description: msg`Use a dedicated form when creating records.`,
+ },
+ [FeatureFlagKey.IS_RECORD_SHARING_ENABLED]: {
+ label: msg`Record sharing`,
+ description: msg`Allow sharing individual records with workspace members.`,
+ },
+ [FeatureFlagKey.IS_WEBHOOK_RATE_LIMIT_ENABLED]: {
+ label: msg`Webhook rate limits`,
+ description: msg`Limit the rate of outgoing webhook deliveries.`,
+ },
+};
diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
index f02987e24fc..14b015a0d65 100644
--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
@@ -2,18 +2,25 @@ import { useParams } from 'react-router-dom';
import { useMutation, useQuery } from '@apollo/client/react';
import { t } from '@lingui/core/macro';
+import { styled } from '@linaria/react';
import { isNonEmptyString } from '@sniptt/guards';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath, isDefined } from 'twenty-shared/utils';
import { currentUserState } from '@/auth/states/currentUserState';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { labPublicFeatureFlagsState } from '@/client-config/states/labPublicFeatureFlagsState';
import { billingState } from '@/client-config/states/billingState';
import { canManageFeatureFlagsState } from '@/client-config/states/canManageFeatureFlagsState';
import { AI_ADMIN_PATH } from '@/settings/admin-panel/ai/constants/AiAdminPath';
import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';
import { SettingsAdminWorkspaceBillingContent } from '@/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent';
+import { SETTINGS_ADMIN_FEATURE_FLAG_METADATA } from '@/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata';
import { SettingsAdminWorkspaceContent } from '@/settings/admin-panel/components/SettingsAdminWorkspaceContent';
+import {
+ SettingsTableListSection,
+ type SettingsTableListSectionColumn,
+} from '@/settings/components/SettingsTableListSection';
import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';
import { GET_ADMIN_WORKSPACE_CHAT_THREADS } from '@/settings/admin-panel/graphql/queries/getAdminWorkspaceChatThreads';
import { WORKSPACE_LOOKUP_ADMIN_PANEL } from '@/settings/admin-panel/graphql/queries/workspaceLookupAdminPanel';
@@ -42,8 +49,12 @@ import {
IconSettings2,
IconUsers,
} from 'twenty-ui/icon';
-import { Card, OverflowingTextWithTooltip } from 'twenty-ui/surfaces';
-import { H2Title } from 'twenty-ui/typography';
+import {
+ Card,
+ OverflowingTextWithTooltip,
+ TooltipPosition,
+} from 'twenty-ui/surfaces';
+import { H2Title, Text } from 'twenty-ui/typography';
import { Button, Switch } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
import { themeCssVariables } from 'twenty-ui/theme-constants';
@@ -56,6 +67,13 @@ import {
UpdateWorkspaceFeatureFlagDocument,
} from '~/generated-admin/graphql';
+const StyledFeatureFlagName = styled(Text)`
+ color: ${themeCssVariables.font.color.primary};
+ font-size: ${themeCssVariables.font.size.md};
+ font-weight: ${themeCssVariables.font.weight.regular};
+ min-width: 0;
+`;
+
const WORKSPACE_DETAIL_TABS_ID = 'settings-admin-workspace-detail-tabs';
const WORKSPACE_DETAIL_TAB_IDS = {
@@ -78,6 +96,7 @@ export const SettingsAdminWorkspaceDetail = () => {
const currentUser = useAtomStateValue(currentUserState);
const currentWorkspace = useAtomStateValue(currentWorkspaceState);
const billing = useAtomStateValue(billingState);
+ const labPublicFeatureFlags = useAtomStateValue(labPublicFeatureFlagsState);
const isBillingEnabled = billing?.isBillingEnabled ?? false;
const canManageFeatureFlags = useAtomStateValue(canManageFeatureFlagsState);
const { enqueueErrorSnackBar } = useSnackBar();
@@ -202,6 +221,81 @@ export const SettingsAdminWorkspaceDetail = () => {
? workspace.logo
: DEFAULT_WORKSPACE_LOGO;
+ const featureFlagItems = (workspace?.featureFlags ?? []).flatMap((flag) => {
+ if (!isDefined(flag.key)) {
+ return [];
+ }
+
+ const metadata = SETTINGS_ADMIN_FEATURE_FLAG_METADATA[flag.key];
+ const publicMetadata = labPublicFeatureFlags.find(
+ (publicFeatureFlag) => publicFeatureFlag.key === flag.key,
+ )?.metadata;
+ const currentWorkspaceValue =
+ currentWorkspace?.id === workspaceId
+ ? currentWorkspace?.featureFlags?.find(
+ (featureFlag) => featureFlag.key === flag.key,
+ )?.value
+ : undefined;
+
+ return [
+ {
+ id: flag.key,
+ label:
+ publicMetadata?.label ??
+ (isDefined(metadata) ? t(metadata.label) : flag.key),
+ description:
+ publicMetadata?.description ??
+ (isDefined(metadata) ? t(metadata.description) : ''),
+ value: currentWorkspaceValue ?? flag.value,
+ },
+ ];
+ });
+
+ const featureFlagColumns: SettingsTableListSectionColumn<
+ (typeof featureFlagItems)[number]
+ >[] = [
+ {
+ label: t`Name`,
+ overflow: 'hidden',
+ Cell: ({ item }) => (
+ <StyledFeatureFlagName>
+ <OverflowingTextWithTooltip
+ text={<>{item.label}</>}
+ tooltipContent={item.id}
+ tooltipPlace={TooltipPosition.Top}
+ alwaysShowTooltip
+ isFocusable
+ />
+ </StyledFeatureFlagName>
+ ),
+ },
+ {
+ label: t`Description`,
+ overflow: 'hidden',
+ Cell: ({ item }) => (
+ <OverflowingTextWithTooltip
+ text={item.description}
+ isTooltipMultiline
+ isFocusable
+ />
+ ),
+ },
+ {
+ label: t`Status`,
+ align: 'right',
+ Cell: ({ item }) => (
+ <Switch
+ aria-label={item.label}
+ aria-description={item.description}
+ checked={item.value}
+ onCheckedChange={(newValue) =>
+ handleFeatureFlagUpdate(item.id, newValue)
+ }
+ />
+ ),
+ },
+ ];
+
if (isLoadingWorkspace) {
return <SettingsSkeletonLoader />;
}
@@ -328,52 +422,13 @@ export const SettingsAdminWorkspaceDetail = () => {
{effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.FEATURE_FLAGS &&
workspace && (
- <Section>
- <H2Title
- title={t`Feature Flags`}
- description={t`Manage feature flags for this workspace`}
- />
- <Table>
- <TableBody>
- <TableRow
- gridAutoColumns="1fr 100px"
- mobileGridAutoColumns="1fr 80px"
- >
- <TableHeader>{t`Feature Flag`}</TableHeader>
- <TableHeader align="right">{t`Status`}</TableHeader>
- </TableRow>
- {workspace.featureFlags?.map((flag) => {
- const currentWorkspaceValue =
- currentWorkspace?.id === workspaceId
- ? currentWorkspace?.featureFlags?.find(
- (f) => f.key === flag.key,
- )?.value
- : undefined;
- const displayedValue = currentWorkspaceValue ?? flag.value;
- return (
- <TableRow
- gridAutoColumns="1fr 100px"
- mobileGridAutoColumns="1fr 80px"
- key={flag.key}
- >
- <TableCell>{flag.key}</TableCell>
- <TableCell align="right">
- {isDefined(flag.key) && (
- <Switch
- aria-label={flag.key}
- checked={displayedValue}
- onCheckedChange={(newValue) =>
- handleFeatureFlagUpdate(flag.key!, newValue)
- }
- />
- )}
- </TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
- </Section>
+ <SettingsTableListSection
+ title={t`Feature Flags`}
+ description={t`Manage feature flags for this workspace`}
+ gridAutoColumns="minmax(0, 240px) minmax(0, 1fr) 56px"
+ items={featureFlagItems}
+ columns={featureFlagColumns}
+ />
)}
{effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.CHATS && (