Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [SecuritySolution] Allow custom sorting on integration cards (#195397) #195428

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export const GridColumn = ({
}: GridColumnProps) => {
const itemsSizeRefs = useRef(new Map<number, number>());
const listRef = useRef<List>(null);

const onHeightChange = useCallback((index: number, size: number) => {
itemsSizeRefs.current.set(index, size);
if (listRef.current) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export interface PackageListGridProps {
setUrlandReplaceHistory: (params: IntegrationsURLParameters) => void;
setUrlandPushHistory: (params: IntegrationsURLParameters) => void;
callout?: JSX.Element | null;
// Props to decide the size of the spacer above callout. Security Solution uses this prop to customize the size of the spacer
calloutTopSpacerSize?: 's' | 'm' | 'xs' | 'l' | 'xl' | 'xxl';
// Props used only in AvailablePackages component:
showCardLabels?: boolean;
title?: string;
Expand All @@ -70,6 +72,8 @@ export interface PackageListGridProps {
showMissingIntegrationMessage?: boolean;
showControls?: boolean;
showSearchTools?: boolean;
// Customizing whether to sort by the default featured integrations' categories. Security Solution has custom sorting logic
sortByFeaturedIntegrations?: boolean;
spacer?: boolean;
// Security Solution sends the id to determine which element to scroll when the user interacting with the package list
scrollElementId?: string;
Expand All @@ -92,7 +96,9 @@ export const PackageListGrid: FunctionComponent<PackageListGridProps> = ({
setUrlandReplaceHistory,
setUrlandPushHistory,
showMissingIntegrationMessage = false,
sortByFeaturedIntegrations = true,
callout,
calloutTopSpacerSize = 'l', // Default EUI spacer size
showCardLabels = true,
showControls = true,
showSearchTools = true,
Expand Down Expand Up @@ -141,9 +147,10 @@ export const PackageListGrid: FunctionComponent<PackageListGridProps> = ({
)
: list;

return promoteFeaturedIntegrations(filteredList, selectedCategory);
}, [isLoading, list, localSearchRef, searchTerm, selectedCategory]);

return sortByFeaturedIntegrations
? promoteFeaturedIntegrations(filteredList, selectedCategory)
: filteredList;
}, [isLoading, list, localSearchRef, searchTerm, selectedCategory, sortByFeaturedIntegrations]);
const splitSubcategories = (
subcategories: CategoryFacet[] | undefined
): { visibleSubCategories?: CategoryFacet[]; hiddenSubCategories?: CategoryFacet[] } => {
Expand Down Expand Up @@ -270,7 +277,7 @@ export const PackageListGrid: FunctionComponent<PackageListGridProps> = ({
) : null}
{callout ? (
<>
<EuiSpacer />
<EuiSpacer size={calloutTopSpacerSize} />
{callout}
</>
) : null}
Expand Down
Loading