1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-27 01:19:00 +02:00

fix(1-3489): strategy dragging is broken in env overview (#9538)

Fixes strategy dragging in project envs. Not sure why this works, but
apparently, making it a variable instead of react component takes care
of it?
This commit is contained in:
Thomas Heartman 2025-03-14 11:22:02 +01:00 committed by GitHub
parent 8e67594f1b
commit af705ad0e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View File

@ -238,8 +238,8 @@ export const EnvironmentAccordionBody = ({
); );
}; };
const Strategies = () => { const strategyList =
return strategies.length < 50 || !manyStrategiesPagination ? ( strategies.length < 50 || !manyStrategiesPagination ? (
<StyledContentList> <StyledContentList>
{strategies.map((strategy, index) => ( {strategies.map((strategy, index) => (
<StyledListItem key={strategy.id}> <StyledListItem key={strategy.id}>
@ -287,7 +287,6 @@ export const EnvironmentAccordionBody = ({
/> />
</PaginatedStrategyContainer> </PaginatedStrategyContainer>
); );
};
return ( return (
<StyledAccordionBodyInnerContainer> <StyledAccordionBodyInnerContainer>
@ -305,12 +304,12 @@ export const EnvironmentAccordionBody = ({
{strategies.length > 0 ? ( {strategies.length > 0 ? (
<li> <li>
<StrategySeparator /> <StrategySeparator />
<Strategies /> {strategyList}
</li> </li>
) : null} ) : null}
</> </>
) : strategies.length > 0 ? ( ) : strategies.length > 0 ? (
<Strategies /> strategyList
) : null} ) : null}
</StyledContentList> </StyledContentList>
</StyledAccordionBodyInnerContainer> </StyledAccordionBodyInnerContainer>

View File

@ -85,6 +85,7 @@ export const ProjectEnvironmentStrategyDraggableItem = ({
onDragStartRef={onDragStartRef} onDragStartRef={onDragStartRef}
onDragOver={onDragOver} onDragOver={onDragOver}
index={index} index={index}
isDragging={isDragging}
headerItemsRight={ headerItemsRight={
<> <>
{draftChange && !isSmallScreen ? ( {draftChange && !isSmallScreen ? (

View File

@ -115,6 +115,7 @@ const StyledAccordionFooter = styled('div')(({ theme }) => ({
justifyContent: 'flex-end', justifyContent: 'flex-end',
gap: theme.spacing(3), gap: theme.spacing(3),
backgroundColor: 'inherit', backgroundColor: 'inherit',
borderTop: `1px solid ${theme.palette.divider}`,
})); }));
const StyledIconButton = styled(IconButton)(({ theme }) => ({ const StyledIconButton = styled(IconButton)(({ theme }) => ({
@ -324,12 +325,11 @@ export const MilestoneCard = ({
height: ref.current?.offsetHeight || 0, height: ref.current?.offsetHeight || 0,
}); });
if (ref?.current) {
event.dataTransfer.effectAllowed = 'move'; event.dataTransfer.effectAllowed = 'move';
event.dataTransfer.setData('text/html', ref.current.outerHTML); event.dataTransfer.setData('text/html', ref.current.outerHTML);
event.dataTransfer.setDragImage(ref.current, 20, 20); event.dataTransfer.setDragImage(ref.current, 20, 20);
}
}; };
const onStrategyDragEnd = () => { const onStrategyDragEnd = () => {
setDragItem(null); setDragItem(null);
onReOrderStrategies(); onReOrderStrategies();