From 46e8a174aee9cd5f5f0aeae8058f516c3b8e6b12 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Thu, 3 Jul 2025 12:57:15 +0200 Subject: [PATCH] Add default to strategy change --- .../Changes/Change/FeatureChange.tsx | 13 ++++++++++-- .../Changes/Change/LegacyStrategyChange.tsx | 20 ++++++++++++++++--- .../Changes/Change/StrategyChange.tsx | 13 +++++++++--- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/FeatureChange.tsx b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/FeatureChange.tsx index 13524b0dd6..72b48cfd9b 100644 --- a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/FeatureChange.tsx +++ b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/FeatureChange.tsx @@ -96,7 +96,15 @@ export const FeatureChange: FC<{ change: IFeatureChange; feature: IChangeRequestFeature; onNavigate?: () => void; -}> = ({ index, change, feature, changeRequest, actions, onNavigate }) => { +}> = ({ + index, + change, + feature, + changeRequest, + actions, + onNavigate, + isDefaultChange, +}) => { const lastIndex = feature.defaultChange ? feature.changes.length + 1 : feature.changes.length; @@ -190,7 +198,7 @@ export const FeatureChange: FC<{ )} {change.action === 'updateEnabled' && ( @@ -204,6 +212,7 @@ export const FeatureChange: FC<{ change.action === 'updateStrategy' ? ( = ({ change, actions }) => ( + isDefaultChange?: boolean; +}> = ({ change, actions, isDefaultChange }) => ( <> @@ -288,7 +289,14 @@ const AddStrategy: FC<{ /> -
{actions}
+
+ {isDefaultChange ? ( + + Default strategy will be added + + ) : null} + {actions} +
{change.payload.variants?.length ? ( @@ -316,6 +324,7 @@ export const LegacyStrategyChange: FC<{ featureName: string; projectId: string; changeRequestState: ChangeRequestState; + isDefaultChange?: boolean; }> = ({ actions, change, @@ -323,6 +332,7 @@ export const LegacyStrategyChange: FC<{ environmentName, projectId, changeRequestState, + isDefaultChange, }) => { const currentStrategy = useCurrentStrategy( change, @@ -334,7 +344,11 @@ export const LegacyStrategyChange: FC<{ return ( <> {change.action === 'addStrategy' && ( - + )} {change.action === 'deleteStrategy' && ( = ({ change, actions }) => ( +}> = ({ change, isDefaultChange, actions }) => ( <> - Adding strategy + Adding {isDefaultChange && 'default'} strategy = ({ actions, change, @@ -307,6 +309,7 @@ export const StrategyChange: FC<{ environmentName, projectId, changeRequestState, + isDefaultChange, }) => { const currentStrategy = useCurrentStrategy( change, @@ -328,7 +331,11 @@ export const StrategyChange: FC<{ return ( {change.action === 'addStrategy' && ( - + )} {change.action === 'deleteStrategy' && (