diff --git a/frontend/app/components/FFlags/NewFFlag/Conditions.tsx b/frontend/app/components/FFlags/NewFFlag/Conditions.tsx index 96a738c59..b66a81a7a 100644 --- a/frontend/app/components/FFlags/NewFFlag/Conditions.tsx +++ b/frontend/app/components/FFlags/NewFFlag/Conditions.tsx @@ -6,6 +6,7 @@ import { nonFlagFilters } from 'Types/filter/newFilter'; import { observer } from 'mobx-react-lite'; import { Conditions } from "App/mstore/types/FeatureFlag"; import FilterSelection from 'Shared/Filters/FilterSelection'; +import { toast } from 'react-toastify'; interface Props { set: number; @@ -17,7 +18,10 @@ interface Props { function RolloutCondition({ set, conditions, removeCondition, index, readonly }: Props) { const [forceRender, forceRerender] = React.useState(false); - const onAddFilter = (filter = {}) => { + const onAddFilter = (filter: Record = {}) => { + if (conditions.filter.filters.findIndex(f => f.key === filter.key) !== -1) { + return toast.error('Filter already exists') + } conditions.filter.addFilter(filter); forceRerender(!forceRender); }; diff --git a/frontend/app/components/FFlags/NewFFlag/Multivariant.tsx b/frontend/app/components/FFlags/NewFFlag/Multivariant.tsx index 2a16a0c65..ceccd46a8 100644 --- a/frontend/app/components/FFlags/NewFFlag/Multivariant.tsx +++ b/frontend/app/components/FFlags/NewFFlag/Multivariant.tsx @@ -58,7 +58,7 @@ function Multivariant() {
Distribute Equally @@ -76,7 +76,7 @@ function Multivariant() {
) => variant.setKey(e.target.value) @@ -137,9 +137,11 @@ function Multivariant() { })}
- + {featureFlagsStore.currentFflag!.variants.length <= 10 ? ( + + ) : null} {featureFlagsStore.currentFflag!.isRedDistribution ? (
Total distribution is less than 100%.
) : null} diff --git a/frontend/app/components/FFlags/NewFFlag/NewFFlag.tsx b/frontend/app/components/FFlags/NewFFlag/NewFFlag.tsx index f45cbf935..1240c0dd4 100644 --- a/frontend/app/components/FFlags/NewFFlag/NewFFlag.tsx +++ b/frontend/app/components/FFlags/NewFFlag/NewFFlag.tsx @@ -50,7 +50,7 @@ function NewFFlag({ siteId, fflagId }: { siteId: string; fflagId?: string }) { }; const onCancel = () => { - history.push(withSiteId(fflags(), siteId)); + history.goBack() }; const onError = (e: string) => toast.error(`Failed to update flag: ${e}`)