1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

1-1385: hide display of pattern info behind a flag (#4744)

Previously, the front end would show info about the pattern if it
exists, regardless of whether the feature is active or not. The
pattern wouldn't be enforced, but it's confusing anyway, so let's hide
it.
This commit is contained in:
Thomas Heartman 2023-09-15 12:43:56 +02:00 committed by GitHub
parent a96110eb36
commit d838b5f2c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ 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;
@ -121,12 +122,15 @@ 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(featureNaming?.pattern); const displayFeatureNamingInfo = Boolean(
featureNamingPatternEnabled && featureNaming?.pattern
);
React.useEffect(() => { React.useEffect(() => {
if (featureNaming?.pattern && validateToggleName && name) { if (featureNaming?.pattern && validateToggleName && name) {