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