diff --git a/frontend/app/components/FFlags/FlagView/FlagView.tsx b/frontend/app/components/FFlags/FlagView/FlagView.tsx index 92bae6866..32269f5be 100644 --- a/frontend/app/components/FFlags/FlagView/FlagView.tsx +++ b/frontend/app/components/FFlags/FlagView/FlagView.tsx @@ -5,8 +5,7 @@ import { Toggler, Loader, Button, NoContent, ItemMenu } from 'UI'; import Breadcrumb from 'Shared/Breadcrumb'; import { useHistory } from 'react-router'; import { withSiteId, fflag, fflags } from 'App/routes'; -// import RolloutCondition from './Conditions'; -// import { Payload } from './Helpers'; +import Multivariant from "Components/FFlags/NewFFlag/Multivariant"; import { toast } from 'react-toastify'; import RolloutCondition from "Components/FFlags/NewFFlag/Conditions"; @@ -93,6 +92,9 @@ function FlagView({ siteId, fflagId }: { siteId: string; fflagId: string }) { : 'This flag is not persistent across authentication events.'} + {!current.isSingleOption ? ( + + ) : null} {current.conditions.length > 0 ? (
diff --git a/frontend/app/components/FFlags/NewFFlag/Multivariant.tsx b/frontend/app/components/FFlags/NewFFlag/Multivariant.tsx index aca69094a..d4ca5d7e9 100644 --- a/frontend/app/components/FFlags/NewFFlag/Multivariant.tsx +++ b/frontend/app/components/FFlags/NewFFlag/Multivariant.tsx @@ -34,7 +34,7 @@ const alphabet = [ 'Z', ]; -function Multivariant() { +function Multivariant({ readonly }: { readonly?: boolean }) { const { featureFlagsStore } = useStore(); const avg = React.useMemo(() => { @@ -57,12 +57,14 @@ function Multivariant() {
-
- Distribute Equally -
+ {readonly ? null : ( +
+ Distribute Equally +
+ )}
@@ -75,78 +77,102 @@ function Multivariant() {
- ) => { - if (e.target.value?.length > 25) return; - variant.setKey(e.target.value) - }} - /> + {readonly ? ( + + {variant.value} + + ) : ( + ) => { + if (e.target.value?.length > 25) return; + variant.setKey(e.target.value); + }} + /> + )}
- ) => - variant.setDescription(e.target.value) - } - /> + {readonly ? ( +
{variant.description}
+ ) : ( + ) => + variant.setDescription(e.target.value) + } + /> + )}
- ) => - variant.setPayload(e.target.value) - } - /> + {readonly ? ( + + {variant.payload} + + ) : ( + ) => + variant.setPayload(e.target.value) + } + /> + )}
- ) => { - if (e.target.value === '') variant.setRollout(0); - variant.setRollout(parseInt(e.target.value.replace(/\D/g, ''), 10)); - }} - /> -
- featureFlagsStore.currentFflag!.variants.length === 1 - ? null - : featureFlagsStore.currentFflag!.removeVariant(variant.index) - } - > - -
+ {readonly ? ( +
{variant.rolloutPercentage}
+ ) : ( + <> + ) => { + if (e.target.value === '') variant.setRollout(0); + variant.setRollout(parseInt(e.target.value.replace(/\D/g, ''), 10)); + }} + /> +
+ featureFlagsStore.currentFflag!.variants.length === 1 + ? null + : featureFlagsStore.currentFflag!.removeVariant(variant.index) + } + > + +
+ + )}
); })} -
- {featureFlagsStore.currentFflag!.variants.length < 10 ? ( - - ) : null} - {featureFlagsStore.currentFflag!.isRedDistribution ? ( -
Total distribution is less than 100%.
- ) : null} -
+ {readonly ? null : ( +
+ {featureFlagsStore.currentFflag!.variants.length < 10 ? ( + + ) : null} + {featureFlagsStore.currentFflag!.isRedDistribution ? ( +
Total distribution is less than 100%.
+ ) : null} +
+ )} ); }