From c552f3ae7232541a7239859c1c8bd633583d0f18 Mon Sep 17 00:00:00 2001 From: Fredrik Strand Oseberg Date: Wed, 13 Dec 2023 12:34:43 +0100 Subject: [PATCH] Feat/new strategy configuration general tab (#5628) * Adds the new general tab settings behind a feature flag * Adds a test for the FlexibleStrategy component --- frontend/src/component/common/select.tsx | 9 ++- .../FeatureStrategyEnabledDisabled.tsx | 38 +++++++++- .../NewFeatureStrategyForm.tsx | 16 ++--- .../FlexibleStrategy.test.tsx | 63 ++++++++++++++++ .../FlexibleStrategy/FlexibleStrategy.tsx | 69 +++++++++++++++++- .../StickinessSelect/StickinessSelect.tsx | 7 +- .../RolloutSlider/RolloutSlider.tsx | 71 ++++++++++++++++--- 7 files changed, 251 insertions(+), 22 deletions(-) create mode 100644 frontend/src/component/feature/StrategyTypes/FlexibleStrategy/FlexibleStrategy.test.tsx diff --git a/frontend/src/component/common/select.tsx b/frontend/src/component/common/select.tsx index 9b3ba120eb..9129a85742 100644 --- a/frontend/src/component/common/select.tsx +++ b/frontend/src/component/common/select.tsx @@ -24,6 +24,7 @@ export interface ISelectMenuProps { disabled?: boolean; className?: string; classes?: any; + formControlStyles?: React.CSSProperties; } const SelectMenu: React.FC = ({ @@ -36,6 +37,7 @@ const SelectMenu: React.FC = ({ disabled = false, className, classes, + formControlStyles = {}, ...rest }) => { const renderSelectItems = () => @@ -51,7 +53,12 @@ const SelectMenu: React.FC = ({ )); return ( - + {label} + onUpdate('groupId')(e.target.value) + } + data-testid={FLEXIBLE_STRATEGY_GROUP_ID} + /> + + + + ); + } + return (
{ const { context } = useUnleashContext(); + const newStrategyConfiguration = useUiFlag('newStrategyConfiguration'); const theme = useTheme(); const resolveStickinessOptions = () => { @@ -51,6 +53,9 @@ export const StickinessSelect = ({ return options; }; + // newStrategyConfiguration - Temporary check for backwards compatibility + const formControlStyles = newStrategyConfiguration ? { width: '100%' } : {}; + const stickinessOptions = resolveStickinessOptions(); return (