1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-23 00:16:25 +01:00

Inline paginate strategies

This commit is contained in:
Thomas Heartman 2025-03-20 10:38:49 +01:00
parent c1cea1e5a6
commit c08a334f98
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78

View File

@ -244,46 +244,6 @@ export const EnvironmentAccordionBody = ({
const paginateStrategies =
strategies.length >= 50 && manyStrategiesPagination;
const strategyList = paginateStrategies ? (
<>
{page.map((strategy, index) => (
<StyledListItem key={strategy.id}>
{index > 0 || releasePlans.length > 0 ? (
<StyledStrategySeparator />
) : null}
<ProjectEnvironmentStrategyDraggableItem
strategy={strategy}
index={index + pageIndex * pageSize}
environmentName={featureEnvironment.name}
otherEnvironments={otherEnvironments}
/>
</StyledListItem>
))}
</>
) : (
<>
{strategies.map((strategy, index) => (
<StyledListItem key={strategy.id}>
{index > 0 || releasePlans.length > 0 ? (
<StyledStrategySeparator />
) : null}
<ProjectEnvironmentStrategyDraggableItem
strategy={strategy}
index={index}
environmentName={featureEnvironment.name}
otherEnvironments={otherEnvironments}
isDragging={dragItem?.id === strategy.id}
onDragStartRef={onDragStartRef}
onDragOver={onDragOver(strategy.id)}
onDragEnd={onDragEnd}
/>
</StyledListItem>
))}
</>
);
return (
<StyledAccordionBodyInnerContainer>
{paginateStrategies ? (
@ -304,9 +264,46 @@ export const EnvironmentAccordionBody = ({
/>
</StyledListItem>
))}
{strategyList}
</StyledContentList>
{paginateStrategies ? (
<>
{page.map((strategy, index) => (
<StyledListItem key={strategy.id}>
{index > 0 || releasePlans.length > 0 ? (
<StyledStrategySeparator />
) : null}
<ProjectEnvironmentStrategyDraggableItem
strategy={strategy}
index={index + pageIndex * pageSize}
environmentName={featureEnvironment.name}
otherEnvironments={otherEnvironments}
/>
</StyledListItem>
))}
</>
) : (
<>
{strategies.map((strategy, index) => (
<StyledListItem key={strategy.id}>
{index > 0 || releasePlans.length > 0 ? (
<StyledStrategySeparator />
) : null}
<ProjectEnvironmentStrategyDraggableItem
strategy={strategy}
index={index}
environmentName={featureEnvironment.name}
otherEnvironments={otherEnvironments}
isDragging={dragItem?.id === strategy.id}
onDragStartRef={onDragStartRef}
onDragOver={onDragOver(strategy.id)}
onDragEnd={onDragEnd}
/>
</StyledListItem>
))}
</>
)}
</StyledContentList>
{paginateStrategies ? (
<Pagination
count={pages.length}