mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	chore: remove usage of feature naming pattern flag (#5364)
In preparation for this feature going GA
This commit is contained in:
		
							parent
							
								
									fd099e242e
								
							
						
					
					
						commit
						90d6c7c0ba
					
				@ -23,7 +23,6 @@ import React from 'react';
 | 
			
		||||
import { useAuthPermissions } from 'hooks/api/getters/useAuth/useAuthPermissions';
 | 
			
		||||
import { FeatureNamingType } from 'interfaces/project';
 | 
			
		||||
import { FeatureNamingPatternInfo } from '../FeatureNamingPatternInfo/FeatureNamingPatternInfo';
 | 
			
		||||
import { useUiFlag } from 'hooks/useUiFlag';
 | 
			
		||||
 | 
			
		||||
interface IFeatureToggleForm {
 | 
			
		||||
    type: string;
 | 
			
		||||
@ -122,15 +121,12 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
 | 
			
		||||
    const navigate = useNavigate();
 | 
			
		||||
    const { permissions } = useAuthPermissions();
 | 
			
		||||
    const editable = mode !== 'Edit';
 | 
			
		||||
    const featureNamingPatternEnabled = useUiFlag('featureNamingPattern');
 | 
			
		||||
 | 
			
		||||
    const renderToggleDescription = () => {
 | 
			
		||||
        return featureTypes.find((toggle) => toggle.id === type)?.description;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    const displayFeatureNamingInfo = Boolean(
 | 
			
		||||
        featureNamingPatternEnabled && featureNaming?.pattern,
 | 
			
		||||
    );
 | 
			
		||||
    const displayFeatureNamingInfo = Boolean(featureNaming?.pattern);
 | 
			
		||||
 | 
			
		||||
    React.useEffect(() => {
 | 
			
		||||
        if (featureNaming?.pattern && validateToggleName && name) {
 | 
			
		||||
 | 
			
		||||
@ -136,7 +136,6 @@ const ProjectEnterpriseSettingsForm: React.FC<IProjectEnterpriseSettingsForm> =
 | 
			
		||||
        clearErrors,
 | 
			
		||||
    }) => {
 | 
			
		||||
        const privateProjects = useUiFlag('privateProjects');
 | 
			
		||||
        const shouldShowFlagNaming = useUiFlag('featureNamingPattern');
 | 
			
		||||
 | 
			
		||||
        const { setPreviousPattern, trackPattern } =
 | 
			
		||||
            useFeatureNamePatternTracking();
 | 
			
		||||
@ -253,9 +252,6 @@ const ProjectEnterpriseSettingsForm: React.FC<IProjectEnterpriseSettingsForm> =
 | 
			
		||||
                        options={projectModeOptions}
 | 
			
		||||
                    />
 | 
			
		||||
                </>
 | 
			
		||||
                <ConditionallyRender
 | 
			
		||||
                    condition={Boolean(shouldShowFlagNaming)}
 | 
			
		||||
                    show={
 | 
			
		||||
                <StyledFieldset>
 | 
			
		||||
                    <Box
 | 
			
		||||
                        sx={{
 | 
			
		||||
@ -279,14 +275,14 @@ const ProjectEnterpriseSettingsForm: React.FC<IProjectEnterpriseSettingsForm> =
 | 
			
		||||
                                >
 | 
			
		||||
                                    JavaScript RegEx
 | 
			
		||||
                                </a>{' '}
 | 
			
		||||
                                        used to enforce feature flag names
 | 
			
		||||
                                        within this project. The regex will be
 | 
			
		||||
                                        surrounded by a leading <code>^</code>{' '}
 | 
			
		||||
                                        and a trailing <code>$</code>.
 | 
			
		||||
                                used to enforce feature flag names within this
 | 
			
		||||
                                project. The regex will be surrounded by a
 | 
			
		||||
                                leading <code>^</code> and a trailing{' '}
 | 
			
		||||
                                <code>$</code>.
 | 
			
		||||
                            </p>
 | 
			
		||||
                            <p>
 | 
			
		||||
                                        Leave it empty if you don’t want to add
 | 
			
		||||
                                        a naming pattern.
 | 
			
		||||
                                Leave it empty if you don’t want to add a naming
 | 
			
		||||
                                pattern.
 | 
			
		||||
                            </p>
 | 
			
		||||
                        </StyledPatternNamingExplanation>
 | 
			
		||||
                    </StyledSubtitle>
 | 
			
		||||
@ -313,16 +309,14 @@ const ProjectEnterpriseSettingsForm: React.FC<IProjectEnterpriseSettingsForm> =
 | 
			
		||||
                            error={Boolean(errors.featureNamingPattern)}
 | 
			
		||||
                            errorText={errors.featureNamingPattern}
 | 
			
		||||
                            onChange={(e) =>
 | 
			
		||||
                                        onSetFeatureNamingPattern(
 | 
			
		||||
                                            e.target.value,
 | 
			
		||||
                                        )
 | 
			
		||||
                                onSetFeatureNamingPattern(e.target.value)
 | 
			
		||||
                            }
 | 
			
		||||
                        />
 | 
			
		||||
                        <StyledSubtitle>
 | 
			
		||||
                            <p id='pattern-additional-description'>
 | 
			
		||||
                                        The example and description will be
 | 
			
		||||
                                        shown to users when they create a new
 | 
			
		||||
                                        feature flag in this project.
 | 
			
		||||
                                The example and description will be shown to
 | 
			
		||||
                                users when they create a new feature flag in
 | 
			
		||||
                                this project.
 | 
			
		||||
                            </p>
 | 
			
		||||
                        </StyledSubtitle>
 | 
			
		||||
 | 
			
		||||
@ -336,9 +330,7 @@ const ProjectEnterpriseSettingsForm: React.FC<IProjectEnterpriseSettingsForm> =
 | 
			
		||||
                            error={Boolean(errors.namingExample)}
 | 
			
		||||
                            errorText={errors.namingExample}
 | 
			
		||||
                            onChange={(e) =>
 | 
			
		||||
                                        onSetFeatureNamingExample(
 | 
			
		||||
                                            e.target.value,
 | 
			
		||||
                                        )
 | 
			
		||||
                                onSetFeatureNamingExample(e.target.value)
 | 
			
		||||
                            }
 | 
			
		||||
                        />
 | 
			
		||||
                        <StyledTextField
 | 
			
		||||
@ -353,15 +345,11 @@ The flag name should contain the project name, the feature name, and the ticket
 | 
			
		||||
                            minRows={5}
 | 
			
		||||
                            value={featureNamingDescription || ''}
 | 
			
		||||
                            onChange={(e) =>
 | 
			
		||||
                                        onSetFeatureNamingDescription(
 | 
			
		||||
                                            e.target.value,
 | 
			
		||||
                                        )
 | 
			
		||||
                                onSetFeatureNamingDescription(e.target.value)
 | 
			
		||||
                            }
 | 
			
		||||
                        />
 | 
			
		||||
                    </StyledFlagNamingContainer>
 | 
			
		||||
                </StyledFieldset>
 | 
			
		||||
                    }
 | 
			
		||||
                />
 | 
			
		||||
                <StyledButtonContainer>{children}</StyledButtonContainer>
 | 
			
		||||
            </StyledForm>
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
@ -61,7 +61,6 @@ export type UiFlags = {
 | 
			
		||||
    customRootRolesKillSwitch?: boolean;
 | 
			
		||||
    strategyVariant?: boolean;
 | 
			
		||||
    lastSeenByEnvironment?: boolean;
 | 
			
		||||
    featureNamingPattern?: boolean;
 | 
			
		||||
    doraMetrics?: boolean;
 | 
			
		||||
    variantTypeNumber?: boolean;
 | 
			
		||||
    privateProjects?: boolean;
 | 
			
		||||
 | 
			
		||||
@ -84,7 +84,6 @@ exports[`should create default config 1`] = `
 | 
			
		||||
      "doraMetrics": false,
 | 
			
		||||
      "embedProxy": true,
 | 
			
		||||
      "embedProxyFrontend": true,
 | 
			
		||||
      "featureNamingPattern": false,
 | 
			
		||||
      "featureSearchAPI": false,
 | 
			
		||||
      "featureSearchFrontend": false,
 | 
			
		||||
      "featuresExportImport": true,
 | 
			
		||||
 | 
			
		||||
@ -159,7 +159,6 @@ beforeAll(async () => {
 | 
			
		||||
            experimental: {
 | 
			
		||||
                flags: {
 | 
			
		||||
                    featuresExportImport: true,
 | 
			
		||||
                    featureNamingPattern: true,
 | 
			
		||||
                    dependentFeatures: true,
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
@ -1168,7 +1168,6 @@ class FeatureToggleService {
 | 
			
		||||
        projectId: string,
 | 
			
		||||
        featureNames: string[],
 | 
			
		||||
    ): Promise<FeatureNameCheckResultWithFeaturePattern> {
 | 
			
		||||
        if (this.flagResolver.isEnabled('featureNamingPattern')) {
 | 
			
		||||
        const project = await this.projectStore.get(projectId);
 | 
			
		||||
        const patternData = project.featureNaming;
 | 
			
		||||
        const namingPattern = patternData?.pattern;
 | 
			
		||||
@ -1183,7 +1182,7 @@ class FeatureToggleService {
 | 
			
		||||
                return { ...result, featureNaming: patternData };
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return { state: 'valid' };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,7 @@ const irrelevantDate = new Date();
 | 
			
		||||
beforeAll(async () => {
 | 
			
		||||
    const config = createTestConfig({
 | 
			
		||||
        experimental: {
 | 
			
		||||
            flags: { featureNamingPattern: true, playgroundImprovements: true },
 | 
			
		||||
            flags: { playgroundImprovements: true },
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
    db = await dbInit(
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,6 @@ export type IFlagKey =
 | 
			
		||||
    | 'filterInvalidClientMetrics'
 | 
			
		||||
    | 'lastSeenByEnvironment'
 | 
			
		||||
    | 'customRootRolesKillSwitch'
 | 
			
		||||
    | 'featureNamingPattern'
 | 
			
		||||
    | 'doraMetrics'
 | 
			
		||||
    | 'variantTypeNumber'
 | 
			
		||||
    | 'privateProjects'
 | 
			
		||||
@ -116,10 +115,6 @@ const flags: IFlags = {
 | 
			
		||||
        process.env.UNLEASH_EXPERIMENTAL_CUSTOM_ROOT_ROLES_KILL_SWITCH,
 | 
			
		||||
        false,
 | 
			
		||||
    ),
 | 
			
		||||
    featureNamingPattern: parseEnvVarBoolean(
 | 
			
		||||
        process.env.UNLEASH_EXPERIMENTAL_FEATURE_NAMING_PATTERN,
 | 
			
		||||
        false,
 | 
			
		||||
    ),
 | 
			
		||||
    doraMetrics: parseEnvVarBoolean(
 | 
			
		||||
        process.env.UNLEASH_EXPERIMENTAL_DORA_METRICS,
 | 
			
		||||
        false,
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,6 @@ process.nextTick(async () => {
 | 
			
		||||
                        anonymiseEventLog: false,
 | 
			
		||||
                        responseTimeWithAppNameKillSwitch: false,
 | 
			
		||||
                        lastSeenByEnvironment: true,
 | 
			
		||||
                        featureNamingPattern: true,
 | 
			
		||||
                        doraMetrics: true,
 | 
			
		||||
                        variantTypeNumber: true,
 | 
			
		||||
                        privateProjects: true,
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ beforeAll(async () => {
 | 
			
		||||
            experimental: {
 | 
			
		||||
                flags: {
 | 
			
		||||
                    strictSchemaValidation: true,
 | 
			
		||||
                    featureNamingPattern: true,
 | 
			
		||||
                    dependentFeatures: true,
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user