1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-04 13:48:56 +02:00

fix: banner duplication on strategy edit with change requests (#7452)

## About the changes
Only one banner info about the outcome of strategy edit should appear
when change requests are enabled.


![image](https://github.com/Unleash/unleash/assets/2625371/72e734b4-14b2-4179-9d31-6382f4c9575d)


[issue/1-2292](https://linear.app/unleash/issue/1-2292/bug-do-not-show-feature-toggle-is-currently-enabled-banner-when-change)
This commit is contained in:
Tymoteusz Czech 2024-06-27 10:04:02 +02:00 committed by GitHub
parent db525a6617
commit 4c1d8dd423
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 30 deletions

View File

@ -1,4 +1,3 @@
import type React from 'react';
import type { FC } from 'react'; import type { FC } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
@ -11,14 +10,13 @@ interface IFeatureStrategyEnabledProps {
projectId: string; projectId: string;
featureId: string; featureId: string;
environmentId: string; environmentId: string;
children?: React.ReactNode; isChangeRequest?: boolean;
} }
export const FeatureStrategyEnabled: FC<IFeatureStrategyEnabledProps> = ({ export const FeatureStrategyEnabled: FC<IFeatureStrategyEnabledProps> = ({
projectId, projectId,
featureId, featureId,
environmentId, environmentId,
children,
}) => { }) => {
const featurePagePath = formatFeaturePath(projectId, featureId); const featurePagePath = formatFeaturePath(projectId, featureId);
const { feature } = useFeature(projectId, featureId); const { feature } = useFeature(projectId, featureId);
@ -28,7 +26,14 @@ export const FeatureStrategyEnabled: FC<IFeatureStrategyEnabledProps> = ({
return ( return (
<ConditionallyRender <ConditionallyRender
condition={isFeatureEnabledInEnvironment(feature, environmentId)} condition={isFeatureEnabledInEnvironment(feature, environmentId)}
show={children} show={
<Alert severity='success'>
This feature flag is currently enabled in the{' '}
<strong>{environmentId}</strong> environment. Any changes
made here will be available to users as soon as you hit{' '}
<strong>save</strong>.
</Alert>
}
elseShow={ elseShow={
<Alert severity='warning'> <Alert severity='warning'>
This feature flag is currently disabled in the{' '} This feature flag is currently disabled in the{' '}

View File

@ -413,32 +413,16 @@ export const FeatureStrategyForm = ({
</Alert> </Alert>
} }
/> />
<FeatureStrategyEnabled <ConditionallyRender
projectId={feature.project} condition={!isChangeRequest}
featureId={feature.name} show={
environmentId={environmentId} <FeatureStrategyEnabled
> projectId={feature.project}
<ConditionallyRender featureId={feature.name}
condition={Boolean(isChangeRequest)} environmentId={environmentId}
show={ />
<Alert severity='success'> }
This feature flag is currently enabled in the{' '} />
<strong>{environmentId}</strong> environment.
Any changes made here will be available to users
as soon as these changes are approved and
applied.
</Alert>
}
elseShow={
<Alert severity='success'>
This feature flag is currently enabled in the{' '}
<strong>{environmentId}</strong> environment.
Any changes made here will be available to users
as soon as you hit <strong>save</strong>.
</Alert>
}
/>
</FeatureStrategyEnabled>
</StyledAlertBox> </StyledAlertBox>
<StyledTabs value={tab} onChange={handleChange}> <StyledTabs value={tab} onChange={handleChange}>