mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
feat: show add strategy button when release plan (#9329)
Should show "add strategy" for redesigned page
This commit is contained in:
parent
b4bfadd95e
commit
e095411de4
@ -59,7 +59,6 @@ export const FeatureStrategyMenu = ({
|
||||
useState<IReleasePlanTemplate | undefined>();
|
||||
const isPopoverOpen = Boolean(anchor);
|
||||
const popoverId = isPopoverOpen ? 'FeatureStrategyMenuPopover' : undefined;
|
||||
const flagOverviewRedesignEnabled = useUiFlag('flagOverviewRedesign');
|
||||
const { setToastData } = useToast();
|
||||
const { addChange } = useChangeRequestApi();
|
||||
const { refetch: refetchChangeRequests } =
|
||||
@ -110,51 +109,6 @@ export const FeatureStrategyMenu = ({
|
||||
true,
|
||||
);
|
||||
|
||||
if (flagOverviewRedesignEnabled) {
|
||||
return (
|
||||
<StyledStrategyMenu onClick={(event) => event.stopPropagation()}>
|
||||
<PermissionButton
|
||||
data-testid='ADD_STRATEGY_BUTTON'
|
||||
permission={CREATE_FEATURE_STRATEGY}
|
||||
projectId={projectId}
|
||||
environmentId={environmentId}
|
||||
onClick={openMoreStrategies}
|
||||
aria-labelledby={popoverId}
|
||||
variant={variant}
|
||||
size={uiFontSizeRedesign ? undefined : size}
|
||||
sx={{ minWidth: matchWidth ? '282px' : 'auto' }}
|
||||
disabled={Boolean(disableReason)}
|
||||
tooltipProps={{
|
||||
title: disableReason ? disableReason : undefined,
|
||||
}}
|
||||
>
|
||||
{label}
|
||||
</PermissionButton>
|
||||
<Popover
|
||||
id={popoverId}
|
||||
open={isPopoverOpen}
|
||||
anchorEl={anchor}
|
||||
onClose={onClose}
|
||||
onClick={onClose}
|
||||
PaperProps={{
|
||||
sx: (theme) => ({
|
||||
paddingBottom: theme.spacing(1),
|
||||
}),
|
||||
}}
|
||||
>
|
||||
<FeatureStrategyMenuCards
|
||||
projectId={projectId}
|
||||
featureId={featureId}
|
||||
environmentId={environmentId}
|
||||
setTemplateForChangeRequestDialog={
|
||||
setTemplateForChangeRequestDialog
|
||||
}
|
||||
/>
|
||||
</Popover>
|
||||
</StyledStrategyMenu>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledStrategyMenu onClick={(event) => event.stopPropagation()}>
|
||||
<PermissionButton
|
||||
|
@ -10,7 +10,6 @@ import { formatUnknownError } from 'utils/formatUnknownError';
|
||||
import useToast from 'hooks/useToast';
|
||||
import { StrategyDraggableItem } from '../FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/StrategyDraggableItem';
|
||||
import type { IFeatureEnvironment } from 'interfaces/featureToggle';
|
||||
import { FeatureStrategyEmpty } from 'component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty';
|
||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||
import { useFeature } from 'hooks/api/getters/useFeature/useFeature';
|
||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||
@ -307,13 +306,8 @@ export const FeatureOverviewEnvironmentBody = ({
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<FeatureStrategyEmpty
|
||||
projectId={projectId}
|
||||
featureId={featureId}
|
||||
environmentId={featureEnvironment.name}
|
||||
/>
|
||||
)}
|
||||
) : null}
|
||||
{/* TODO: fit "copy from other environment" option somewhere */}
|
||||
</StyledAccordionBodyInnerContainer>
|
||||
</StyledAccordionBody>
|
||||
);
|
||||
|
@ -120,24 +120,21 @@ export const FeatureOverviewEnvironment = ({
|
||||
.map(({ name }) => name)
|
||||
.filter((name) => name !== environmentId)}
|
||||
/>
|
||||
{featureEnvironment?.strategies?.length > 0 ? (
|
||||
<>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
py: 1,
|
||||
}}
|
||||
>
|
||||
<FeatureStrategyMenu
|
||||
label='Add strategy'
|
||||
projectId={projectId}
|
||||
featureId={featureId}
|
||||
environmentId={environmentId}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
) : null}
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex', // TODO: refactor styles
|
||||
justifyContent: 'end',
|
||||
pt: 1,
|
||||
pb: 2,
|
||||
}}
|
||||
>
|
||||
<FeatureStrategyMenu
|
||||
label='Add strategy'
|
||||
projectId={projectId}
|
||||
featureId={featureId}
|
||||
environmentId={environmentId}
|
||||
/>
|
||||
</Box>
|
||||
</StyledFeatureOverviewEnvironment>
|
||||
);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user