diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyMenu/FeatureStrategyMenu.tsx b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyMenu/FeatureStrategyMenu.tsx index a7f58bb07c..25f611d938 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyMenu/FeatureStrategyMenu.tsx +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyMenu/FeatureStrategyMenu.tsx @@ -1,14 +1,10 @@ import type React from 'react'; import { useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; import PermissionButton, { type IPermissionButtonProps, } from 'component/common/PermissionButton/PermissionButton'; import { CREATE_FEATURE_STRATEGY } from 'component/providers/AccessProvider/permissions'; import { Box, Dialog, IconButton, styled, Typography } from '@mui/material'; -import { LegacyFeatureStrategyMenuCards } from './LegacyFeatureStrategyMenuCards/LegacyFeatureStrategyMenuCards.tsx'; -import { formatCreateStrategyPath } from '../FeatureStrategyCreate/FeatureStrategyCreate.tsx'; -import MoreVert from '@mui/icons-material/MoreVert'; import CloseIcon from '@mui/icons-material/Close'; import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; import type { IReleasePlanTemplate } from 'interfaces/releasePlans'; @@ -19,14 +15,11 @@ import { useReleasePlansApi } from 'hooks/api/actions/useReleasePlansApi/useRele import { useFeatureReleasePlans } from 'hooks/api/getters/useFeatureReleasePlans/useFeatureReleasePlans'; import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled'; import { formatUnknownError } from 'utils/formatUnknownError'; -import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; -import { LegacyReleasePlanReviewDialog } from 'component/feature/FeatureView/FeatureOverview/ReleasePlan/LegacyReleasePlanReviewDialog.tsx'; import { ReleasePlanPreview } from './ReleasePlanPreview.tsx'; import { FeatureStrategyMenuCards, type StrategyFilterValue, } from './FeatureStrategyMenuCards/FeatureStrategyMenuCards.tsx'; -import { useUiFlag } from 'hooks/useUiFlag.ts'; import { ReleasePlanConfirmationDialog } from './ReleasePlanConfirmationDialog.tsx'; interface IFeatureStrategyMenuProps { @@ -46,13 +39,6 @@ const StyledStrategyMenu = styled('div')(({ theme }) => ({ gap: theme.spacing(1), })); -const StyledAdditionalMenuButton = styled(PermissionButton)(({ theme }) => ({ - minWidth: 0, - width: theme.spacing(4.5), - alignSelf: 'stretch', - paddingBlock: 0, -})); - const StyledHeader = styled(Box)(({ theme }) => ({ display: 'flex', justifyContent: 'space-between', @@ -71,13 +57,10 @@ export const FeatureStrategyMenu = ({ }: IFeatureStrategyMenuProps) => { const [isStrategyMenuDialogOpen, setIsStrategyMenuDialogOpen] = useState(false); - const [onlyReleasePlans, setOnlyReleasePlans] = useState(false); const [filter, setFilter] = useState(null); - const navigate = useNavigate(); const { trackEvent } = usePlausibleTracker(); const [selectedTemplate, setSelectedTemplate] = useState(); - const [addReleasePlanOpen, setAddReleasePlanOpen] = useState(false); const [releasePlanPreview, setReleasePlanPreview] = useState(false); const [addReleasePlanConfirmationOpen, setAddReleasePlanConfirmationOpen] = useState(false); @@ -95,10 +78,7 @@ export const FeatureStrategyMenu = ({ environmentId, ); const { addReleasePlanToFeature } = useReleasePlansApi(); - const { isEnterprise } = useUiConfig(); - const displayReleasePlanButton = isEnterprise(); const crProtected = isChangeRequestConfigured(environmentId); - const newStrategyModalEnabled = useUiFlag('newStrategyModal'); const activeReleasePlan = releasePlans[0]; @@ -111,22 +91,7 @@ export const FeatureStrategyMenu = ({ setReleasePlanPreview(false); }, [isStrategyMenuDialogOpen]); - const openDefaultStrategyCreationModal = (event: React.SyntheticEvent) => { - trackEvent('strategy-add', { - props: { - buttonTitle: label, - }, - }); - navigate(createStrategyPath); - }; - const openMoreStrategies = (event: React.SyntheticEvent) => { - setOnlyReleasePlans(false); - setIsStrategyMenuDialogOpen(true); - }; - - const openReleasePlans = (event: React.SyntheticEvent) => { - setOnlyReleasePlans(true); setIsStrategyMenuDialogOpen(true); }; @@ -135,7 +100,7 @@ export const FeatureStrategyMenu = ({ confirmed?: boolean, ) => { try { - if (newStrategyModalEnabled && !confirmed && activeReleasePlan) { + if (!confirmed && activeReleasePlan) { setAddReleasePlanConfirmationOpen(true); return; } @@ -177,7 +142,6 @@ export const FeatureStrategyMenu = ({ }, }); setAddReleasePlanConfirmationOpen(false); - setAddReleasePlanOpen(false); setSelectedTemplate(undefined); onClose(); } catch (error: unknown) { @@ -185,91 +149,24 @@ export const FeatureStrategyMenu = ({ } }; - const createStrategyPath = formatCreateStrategyPath( - projectId, - featureId, - environmentId, - 'flexibleRollout', - true, - ); - return ( event.stopPropagation()}> - {newStrategyModalEnabled ? ( - - Add strategy - - ) : ( - <> - {displayReleasePlanButton ? ( - - Use template - - ) : null} - - - {label} - - - - - - - )} + + Add strategy + - {newStrategyModalEnabled ? ( - <> - - Add strategy - - - - - {releasePlanPreview && selectedTemplate ? ( - setReleasePlanPreview(false)} - onConfirm={() => { - addReleasePlan(selectedTemplate); - }} - /> - ) : ( - { - setSelectedTemplate(template); - addReleasePlan(template); - }} - onReviewReleasePlan={(template) => { - setSelectedTemplate(template); - setReleasePlanPreview(true); - }} - onClose={onClose} - /> - )} - - ) : ( - { - setSelectedTemplate(template); - addReleasePlan(template); - }} - onReviewReleasePlan={(template) => { - setSelectedTemplate(template); - setAddReleasePlanOpen(true); - onClose(); - }} - onClose={onClose} - /> - )} + <> + + Add strategy + + + + + {releasePlanPreview && selectedTemplate ? ( + setReleasePlanPreview(false)} + onConfirm={() => { + addReleasePlan(selectedTemplate); + }} + /> + ) : ( + { + setSelectedTemplate(template); + addReleasePlan(template); + }} + onReviewReleasePlan={(template) => { + setSelectedTemplate(template); + setReleasePlanPreview(true); + }} + onClose={onClose} + /> + )} + {selectedTemplate && ( - <> - { - setAddReleasePlanOpen(open); - if (!open) { - setIsStrategyMenuDialogOpen(true); - } - }} - onConfirm={() => { - addReleasePlan(selectedTemplate); - }} - template={selectedTemplate} - projectId={projectId} - featureName={featureId} - environment={environmentId} - crProtected={crProtected} - /> - { - addReleasePlan(selectedTemplate, true); - }} - /> - + { + addReleasePlan(selectedTemplate, true); + }} + /> )} ); diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index e7c532daa0..cae3531729 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -87,7 +87,6 @@ export type UiFlags = { impactMetrics?: boolean; plausibleMetrics?: boolean; lifecycleGraphs?: boolean; - newStrategyModal?: boolean; globalChangeRequestList?: boolean; trafficBillingDisplay?: boolean; milestoneProgression?: boolean; diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 1886239f02..3ae96be7cf 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -57,7 +57,6 @@ export type IFlagKey = | 'etagByEnv' | 'fetchMode' | 'optimizeLifecycle' - | 'newStrategyModal' | 'globalChangeRequestList' | 'trafficBillingDisplay' | 'milestoneProgression' @@ -265,10 +264,6 @@ const flags: IFlags = { false, ), }, - newStrategyModal: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_NEW_STRATEGY_MODAL, - false, - ), globalChangeRequestList: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_GLOBAL_CHANGE_REQUEST_LIST, false, diff --git a/src/server-dev.ts b/src/server-dev.ts index 3c6a9ea453..0657da5793 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -52,7 +52,6 @@ process.nextTick(async () => { customMetrics: true, impactMetrics: true, lifecycleGraphs: true, - newStrategyModal: true, globalChangeRequestList: true, trafficBillingDisplay: true, milestoneProgression: true,