mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-21 13:47:39 +02:00
Flatten the list
This commit is contained in:
parent
038c10f612
commit
4d8f8c343a
@ -246,80 +246,74 @@ export const EnvironmentAccordionBody = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const strategyList =
|
const paginateStrategies =
|
||||||
strategies.length < 50 || !manyStrategiesPagination ? (
|
strategies.length >= 50 && manyStrategiesPagination;
|
||||||
<StyledContentList>
|
|
||||||
{strategies.map((strategy, index) => (
|
|
||||||
<StyledListItem key={strategy.id}>
|
|
||||||
{index > 0 ? <StyledStrategySeparator /> : null}
|
|
||||||
|
|
||||||
<ProjectEnvironmentStrategyDraggableItem
|
const strategyList = paginateStrategies ? (
|
||||||
strategy={strategy}
|
<>
|
||||||
index={index}
|
{page.map((strategy, index) => (
|
||||||
environmentName={featureEnvironment.name}
|
<StyledListItem key={strategy.id}>
|
||||||
otherEnvironments={otherEnvironments}
|
{index > 0 ? <StyledStrategySeparator /> : null}
|
||||||
isDragging={dragItem?.id === strategy.id}
|
|
||||||
onDragStartRef={onDragStartRef}
|
<ProjectEnvironmentStrategyDraggableItem
|
||||||
onDragOver={onDragOver(strategy.id)}
|
strategy={strategy}
|
||||||
onDragEnd={onDragEnd}
|
index={index + pageIndex * pageSize}
|
||||||
/>
|
environmentName={featureEnvironment.name}
|
||||||
</StyledListItem>
|
otherEnvironments={otherEnvironments}
|
||||||
))}
|
/>
|
||||||
</StyledContentList>
|
</StyledListItem>
|
||||||
) : (
|
))}
|
||||||
<PaginatedStrategyContainer>
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{strategies.map((strategy, index) => (
|
||||||
|
<StyledListItem key={strategy.id}>
|
||||||
|
{index > 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 ? (
|
||||||
<StyledAlert severity='warning'>
|
<StyledAlert severity='warning'>
|
||||||
We noticed you're using a high number of activation
|
We noticed you're using a high number of activation
|
||||||
strategies. To ensure a more targeted approach, consider
|
strategies. To ensure a more targeted approach, consider
|
||||||
leveraging constraints or segments.
|
leveraging constraints or segments.
|
||||||
</StyledAlert>
|
</StyledAlert>
|
||||||
<StyledContentList>
|
) : null}
|
||||||
{page.map((strategy, index) => (
|
<StyledContentList>
|
||||||
<StyledListItem key={strategy.id}>
|
{releasePlans.map((plan) => (
|
||||||
{index > 0 ? <StyledStrategySeparator /> : null}
|
<StyledListItem type='release plan' key={plan.id}>
|
||||||
|
<ReleasePlan
|
||||||
|
plan={plan}
|
||||||
|
environmentIsDisabled={isDisabled}
|
||||||
|
/>
|
||||||
|
</StyledListItem>
|
||||||
|
))}
|
||||||
|
{strategyList}
|
||||||
|
</StyledContentList>
|
||||||
|
|
||||||
<ProjectEnvironmentStrategyDraggableItem
|
{paginateStrategies ? (
|
||||||
strategy={strategy}
|
|
||||||
index={index + pageIndex * pageSize}
|
|
||||||
environmentName={featureEnvironment.name}
|
|
||||||
otherEnvironments={otherEnvironments}
|
|
||||||
/>
|
|
||||||
</StyledListItem>
|
|
||||||
))}
|
|
||||||
</StyledContentList>
|
|
||||||
<Pagination
|
<Pagination
|
||||||
count={pages.length}
|
count={pages.length}
|
||||||
shape='rounded'
|
shape='rounded'
|
||||||
page={pageIndex + 1}
|
page={pageIndex + 1}
|
||||||
onChange={(_, page) => setPageIndex(page - 1)}
|
onChange={(_, page) => setPageIndex(page - 1)}
|
||||||
/>
|
/>
|
||||||
</PaginatedStrategyContainer>
|
) : null}
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<StyledAccordionBodyInnerContainer>
|
|
||||||
<StyledContentList>
|
|
||||||
{releasePlans.length > 0 ? (
|
|
||||||
<>
|
|
||||||
{releasePlans.map((plan) => (
|
|
||||||
<StyledListItem type='release plan' key={plan.id}>
|
|
||||||
<ReleasePlan
|
|
||||||
plan={plan}
|
|
||||||
environmentIsDisabled={isDisabled}
|
|
||||||
/>
|
|
||||||
</StyledListItem>
|
|
||||||
))}
|
|
||||||
{strategies.length > 0 ? (
|
|
||||||
<li>
|
|
||||||
<StyledStrategySeparator />
|
|
||||||
{strategyList}
|
|
||||||
</li>
|
|
||||||
) : null}
|
|
||||||
</>
|
|
||||||
) : strategies.length > 0 ? (
|
|
||||||
strategyList
|
|
||||||
) : null}
|
|
||||||
</StyledContentList>
|
|
||||||
</StyledAccordionBodyInnerContainer>
|
</StyledAccordionBodyInnerContainer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user