-
Notifications
You must be signed in to change notification settings - Fork 81
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
enhance: add remediation supported features bubble #624
Merged
rr404
merged 12 commits into
crowdsecurity:main
from
LaurenceJJones:remediation_support_features
Mar 20, 2025
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3476599
enhance: add remediation supported features bubble
LaurenceJJones 68bda86
enhance: updates
LaurenceJJones dace117
enhance: rename for clarity
LaurenceJJones b8f0bd5
fixed conflicts (except packages.json.lock)
LaurenceJJones a5f83af
Merge branch 'main' into remediation_support_features
rr404 5851f0e
updated capabilities of a few bouncers
d70b5ec
enhance: conflicts
LaurenceJJones c117f67
enhance: audit fix
LaurenceJJones 20712cf
enhance: remove unused var
LaurenceJJones f70b580
changed the support system slightly to have a Mode-bubble variation
4d1a5f3
mini fix/test
42e7cb0
mini fix/test2
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"tailwind": { | ||
"config": "tailwind.config.js", | ||
"css": "src/css/custom.css", | ||
"baseColor": "neutral", | ||
"prefix": "tw-", | ||
"cssVariables": false | ||
}, | ||
"rsc": true, | ||
"aliases": { | ||
"utils": "@/src/utils", | ||
"components": "@/src/components", | ||
"ui": "@/src/ui", | ||
"hooks": "@/src/hooks", | ||
"lib": "@/src/lib" | ||
}, | ||
"style": "default" | ||
} | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from 'react'; | ||
import { clsx } from 'clsx'; | ||
import { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipProvider, | ||
TooltipTrigger, | ||
ToolTipArrow | ||
} from "@site/src/ui/tooltip" | ||
|
||
|
||
type RemediationSupportBadgesProps = { | ||
Prometheus: boolean; // Prometheus is a boolean that controls the color of the Prometheus bubble | ||
MTLS: boolean; // MTLS is a boolean that controls the color of the MTLS bubble | ||
Mode: boolean; // Mode is a boolean that controls the color of the Mode bubble | ||
Metrics: boolean; // Metrics is a boolean that controls the color of the Metrics bubble | ||
Appsec?: boolean; // Appsec is a boolean that controls the color of the AppSec bubble | ||
} | ||
|
||
const RemediationSupportBadge = ({ title, description, support }: { title: string, description: string, support: string }) => { | ||
//ugly, for test | ||
const colorClass = support === 'Unsupported' ? 'tw-bg-red-400' : 'tw-bg-green-400'; | ||
return ( | ||
<TooltipProvider> | ||
<Tooltip> | ||
<TooltipTrigger asChild> | ||
<div className='tw-border tw-rounded-full tw-flex tw-text-black'> | ||
<span className='tw-bg-slate-400 tw-px-2 tw-rounded-l-lg'>{title}</span> | ||
<span className={clsx('tw-rounded-r-lg tw-px-2', colorClass)}>{support}</span> | ||
</div> | ||
</TooltipTrigger> | ||
<TooltipContent> | ||
<p>{description}</p> | ||
<ToolTipArrow className='dark:tw-fill-white'/> | ||
</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
); | ||
} | ||
|
||
export default function RemediationSupportBadges({ MTLS, Metrics, Prometheus, Mode, Appsec }: RemediationSupportBadgesProps): React.JSX.Element { | ||
const mtlsSupport = MTLS ? 'Supported' : 'Unsupported'; | ||
const metricsSupport = Metrics ? 'Supported' : 'Unsupported'; | ||
const prometheusSupport = Prometheus ? 'Supported' : 'Unsupported'; | ||
const modeSupport = Mode ? 'Live & Stream' : 'Live only'; | ||
const appsecSupport = (Appsec !== undefined && Appsec) ? 'Supported' : 'Unsupported'; | ||
|
||
return ( | ||
<div className='tw-flex tw-justify-center tw-flex-wrap tw-mb-4 tw-gap-2'> | ||
{Appsec !== undefined && ( | ||
<RemediationSupportBadge title='AppSec' description='Can forward HTTP requests to the AppSec Component' support={appsecSupport} /> | ||
)} | ||
<RemediationSupportBadge title='Mode' description='Can be configured in different modes, typically live or stream' support={modeSupport} /> | ||
<RemediationSupportBadge title='Metrics' description='Can send detailed metrics to LAPI' support={metricsSupport} /> | ||
<RemediationSupportBadge title='MTLS' description='Can do mutual TLS authentication to LAPI' support={mtlsSupport} /> | ||
<RemediationSupportBadge title='Prometheus' description='Can expose metrics to Prometheus' support={prometheusSupport} /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import * as React from "react" | ||
import * as TooltipPrimitive from "@radix-ui/react-tooltip" | ||
|
||
import { cn } from "@site/src/utils" | ||
|
||
const TooltipProvider = TooltipPrimitive.Provider | ||
|
||
const Tooltip = TooltipPrimitive.Root | ||
|
||
const TooltipTrigger = TooltipPrimitive.Trigger | ||
|
||
const ToolTipArrow = TooltipPrimitive.Arrow | ||
|
||
const TooltipContent = React.forwardRef< | ||
React.ElementRef<typeof TooltipPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> | ||
>(({ className, sideOffset = 4, ...props }, ref) => ( | ||
<TooltipPrimitive.Content | ||
ref={ref} | ||
sideOffset={sideOffset} | ||
className={cn( | ||
"tw-z-50 tw-overflow-hidden tw-rounded-md tw-border tw-border-neutral-200 tw-bg-white tw-px-3 tw-py-1.5 tw-text-sm tw-text-neutral-950 tw-shadow-md tw-animate-in tw-fade-in-0 tw-zoom-in-95 data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=closed]:tw-zoom-out-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2 dark:tw-border-neutral-800 dark:tw-bg-neutral-950 dark:tw-text-neutral-50", | ||
className | ||
)} | ||
{...props} | ||
/> | ||
)) | ||
TooltipContent.displayName = TooltipPrimitive.Content.displayName | ||
|
||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, ToolTipArrow } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { clsx, type ClassValue } from "clsx" | ||
import { twMerge } from "tailwind-merge" | ||
|
||
export function cn(...inputs: ClassValue[]) { | ||
return twMerge(clsx(inputs)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"esModuleInterop": true, | ||
"jsx": "react", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["./*"], | ||
"@site/*": ["./*"] | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the description doesnt really match the present values anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, I was just testing to see what looked like. but we need to do a slight improve on the Mode bubble