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>();
|
useState<IReleasePlanTemplate | undefined>();
|
||||||
const isPopoverOpen = Boolean(anchor);
|
const isPopoverOpen = Boolean(anchor);
|
||||||
const popoverId = isPopoverOpen ? 'FeatureStrategyMenuPopover' : undefined;
|
const popoverId = isPopoverOpen ? 'FeatureStrategyMenuPopover' : undefined;
|
||||||
const flagOverviewRedesignEnabled = useUiFlag('flagOverviewRedesign');
|
|
||||||
const { setToastData } = useToast();
|
const { setToastData } = useToast();
|
||||||
const { addChange } = useChangeRequestApi();
|
const { addChange } = useChangeRequestApi();
|
||||||
const { refetch: refetchChangeRequests } =
|
const { refetch: refetchChangeRequests } =
|
||||||
@ -110,51 +109,6 @@ export const FeatureStrategyMenu = ({
|
|||||||
true,
|
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 (
|
return (
|
||||||
<StyledStrategyMenu onClick={(event) => event.stopPropagation()}>
|
<StyledStrategyMenu onClick={(event) => event.stopPropagation()}>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
|
@ -10,7 +10,6 @@ import { formatUnknownError } from 'utils/formatUnknownError';
|
|||||||
import useToast from 'hooks/useToast';
|
import useToast from 'hooks/useToast';
|
||||||
import { StrategyDraggableItem } from '../FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/StrategyDraggableItem';
|
import { StrategyDraggableItem } from '../FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/StrategyDraggableItem';
|
||||||
import type { IFeatureEnvironment } from 'interfaces/featureToggle';
|
import type { IFeatureEnvironment } from 'interfaces/featureToggle';
|
||||||
import { FeatureStrategyEmpty } from 'component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty';
|
|
||||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||||
import { useFeature } from 'hooks/api/getters/useFeature/useFeature';
|
import { useFeature } from 'hooks/api/getters/useFeature/useFeature';
|
||||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||||
@ -307,13 +306,8 @@ export const FeatureOverviewEnvironmentBody = ({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : null}
|
||||||
<FeatureStrategyEmpty
|
{/* TODO: fit "copy from other environment" option somewhere */}
|
||||||
projectId={projectId}
|
|
||||||
featureId={featureId}
|
|
||||||
environmentId={featureEnvironment.name}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</StyledAccordionBodyInnerContainer>
|
</StyledAccordionBodyInnerContainer>
|
||||||
</StyledAccordionBody>
|
</StyledAccordionBody>
|
||||||
);
|
);
|
||||||
|
@ -120,24 +120,21 @@ export const FeatureOverviewEnvironment = ({
|
|||||||
.map(({ name }) => name)
|
.map(({ name }) => name)
|
||||||
.filter((name) => name !== environmentId)}
|
.filter((name) => name !== environmentId)}
|
||||||
/>
|
/>
|
||||||
{featureEnvironment?.strategies?.length > 0 ? (
|
<Box
|
||||||
<>
|
sx={{
|
||||||
<Box
|
display: 'flex', // TODO: refactor styles
|
||||||
sx={{
|
justifyContent: 'end',
|
||||||
display: 'flex',
|
pt: 1,
|
||||||
justifyContent: 'center',
|
pb: 2,
|
||||||
py: 1,
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<FeatureStrategyMenu
|
||||||
<FeatureStrategyMenu
|
label='Add strategy'
|
||||||
label='Add strategy'
|
projectId={projectId}
|
||||||
projectId={projectId}
|
featureId={featureId}
|
||||||
featureId={featureId}
|
environmentId={environmentId}
|
||||||
environmentId={environmentId}
|
/>
|
||||||
/>
|
</Box>
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
</StyledFeatureOverviewEnvironment>
|
</StyledFeatureOverviewEnvironment>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user