Skip to content

Commit

Permalink
[SecuritySolution] Allow custom sorting on integration cards (#195397)
Browse files Browse the repository at this point in the history
Part of #193131

It shows the customised cards without applying the default sorting under
the `recommended` tab:

Added two optional props:
1. `calloutTopSpacerSize` - Props to decide the size of the spacer above
callout. Security Solution uses this prop to customize the size of the
spacer
2. `sortByFeaturedIntegrations` - Customizing whether to sort by the
default featured integrations' categories. Security Solution has `custom
sorting logic`

Featured cards:

1. AWS
3. GCP
4. Azure
5. Elastic Defend
6. CrowdStrike (to promote our extended protections/3rd party EDR
support)
7. Wiz (or another cloud integration to promote extended protections)
8. Network Packet Capture
9. Osquery Manager
10. ~**Cloud Asset Inventory (need to confirm that's confirmed for
8.16)** - Currently Not Found any integration matched~

<img width="1249" alt="Screenshot 2024-10-08 at 13 31 12"
src="https:/user-attachments/assets/95fb03a4-5a7b-4e8f-8b03-ee45b0e18633">
  • Loading branch information
angorayc authored Oct 8, 2024
1 parent 8281517 commit d20c579
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
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

0 comments on commit d20c579

Please sign in to comment.