diff --git a/frontend/src/scenes/experiments/ExperimentImplementationDetails.tsx b/frontend/src/scenes/experiments/ExperimentImplementationDetails.tsx index 526bd52595f4d..50d7c81373ef0 100644 --- a/frontend/src/scenes/experiments/ExperimentImplementationDetails.tsx +++ b/frontend/src/scenes/experiments/ExperimentImplementationDetails.tsx @@ -192,7 +192,7 @@ export function ExperimentImplementationDetails({ experiment }: ExperimentImplem } return ( -
+

Implementation

diff --git a/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx b/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx index 96d3dd3ff86e4..c884d555f0ce0 100644 --- a/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx @@ -27,16 +27,34 @@ import { ReleaseConditionsModal, ReleaseConditionsTable } from './ReleaseConditi import { Results } from './Results' import { SecondaryMetricsTable } from './SecondaryMetricsTable' -const ResultsTab = (): JSX.Element => { - const { experiment, metricResults, featureFlags } = useValues(experimentLogic) - const result = metricResults?.[0] - const hasResultsInsight = result && result.insight +const NewResultsTab = (): JSX.Element => { + const { experiment, metricResults } = useValues(experimentLogic) + const hasSomeResults = metricResults?.some((result) => result?.insight) return ( -
- {featureFlags[FEATURE_FLAGS.EXPERIMENTS_MULTIPLE_METRICS] ? ( - - ) : hasResultsInsight ? ( + <> + {!hasSomeResults && ( + <> + {experiment.type === 'web' ? ( + + ) : ( + + )} + + )} + + + + ) +} + +const OldResultsTab = (): JSX.Element => { + const { experiment, metricResults } = useValues(experimentLogic) + const hasSomeResults = metricResults?.some((result) => result?.insight) + + return ( + <> + {hasSomeResults ? ( ) : ( <> @@ -54,15 +72,16 @@ const ResultsTab = (): JSX.Element => { )} )} - {featureFlags[FEATURE_FLAGS.EXPERIMENTS_MULTIPLE_METRICS] ? ( - - ) : ( - - )} -
+ + ) } +const ResultsTab = (): JSX.Element => { + const { featureFlags } = useValues(experimentLogic) + return <>{featureFlags[FEATURE_FLAGS.EXPERIMENTS_MULTIPLE_METRICS] ? : } +} + const VariantsTab = (): JSX.Element => { return (
@@ -87,8 +106,8 @@ export function ExperimentView(): JSX.Element { } = useValues(experimentLogic) const { setTabKey } = useActions(experimentLogic) - const result = metricResults?.[0] - const hasResultsInsight = result && result.insight + // Instead, check if any result in the array has an insight + const hasSomeResults = metricResults?.some((result) => result?.insight) return ( <> @@ -103,7 +122,7 @@ export function ExperimentView(): JSX.Element { ) : ( <> - {hasResultsInsight && !featureFlags[FEATURE_FLAGS.EXPERIMENTS_MULTIPLE_METRICS] ? ( + {hasSomeResults && !featureFlags[FEATURE_FLAGS.EXPERIMENTS_MULTIPLE_METRICS] ? (
diff --git a/frontend/src/scenes/experiments/ExperimentView/components.tsx b/frontend/src/scenes/experiments/ExperimentView/components.tsx index cd252785b116c..1cd2158dbadd4 100644 --- a/frontend/src/scenes/experiments/ExperimentView/components.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/components.tsx @@ -580,12 +580,17 @@ export function PageHeaderCustom(): JSX.Element { } export function ShipVariantModal({ experimentId }: { experimentId: Experiment['id'] }): JSX.Element { - const { experiment, sortedWinProbabilities, isShipVariantModalOpen } = useValues(experimentLogic({ experimentId })) + const { experiment, isShipVariantModalOpen } = useValues(experimentLogic({ experimentId })) const { closeShipVariantModal, shipVariant } = useActions(experimentLogic({ experimentId })) const { aggregationLabel } = useValues(groupsModel) const [selectedVariantKey, setSelectedVariantKey] = useState() - useEffect(() => setSelectedVariantKey(sortedWinProbabilities(0)[0]?.key), [sortedWinProbabilities(0)]) + useEffect(() => { + if (experiment.parameters?.feature_flag_variants?.length > 0) { + // First test variant selected by default + setSelectedVariantKey(experiment.parameters.feature_flag_variants[1].key) + } + }, [experiment]) const aggregationTargetName = experiment.filters.aggregation_group_type_index != null @@ -625,20 +630,19 @@ export function ShipVariantModal({ experimentId }: { experimentId: Experiment['i className="w-full" data-attr="metrics-selector" value={selectedVariantKey} - onChange={(variantKey) => setSelectedVariantKey(variantKey)} - options={sortedWinProbabilities(0).map(({ key }) => ({ - value: key, - label: ( -
- - {key === sortedWinProbabilities(0)[0]?.key && ( - - Winning - - )} -
- ), - }))} + onChange={(variantKey) => { + setSelectedVariantKey(variantKey) + }} + options={ + experiment.parameters?.feature_flag_variants?.map(({ key }) => ({ + value: key, + label: ( +
+ +
+ ), + })) || [] + } />
diff --git a/frontend/src/scenes/experiments/MetricsView/DeltaChart.tsx b/frontend/src/scenes/experiments/MetricsView/DeltaChart.tsx index 820b7b38acfd3..92be36e7f8331 100644 --- a/frontend/src/scenes/experiments/MetricsView/DeltaChart.tsx +++ b/frontend/src/scenes/experiments/MetricsView/DeltaChart.tsx @@ -274,34 +274,40 @@ export function DeltaChart({ {isFirstMetric &&
} {/* eslint-disable-next-line react/forbid-dom-props */}
- {variants.map((variant) => ( -
+ {result && + variants.map((variant) => (
-
- + > +
+
+ +
-
- ))} + ))}
{/* SVGs container */} @@ -537,7 +543,7 @@ export function DeltaChart({ ) : (