Skip to content

Commit 5bce03c

Browse files
📝 Add docstrings to pangolin
Docstrings generation was requested by @hhftechnology. The following files were modified: * `web/src/pages/Bouncers.tsx` These file types are not supported: * `web/package.json`
1 parent 0804496 commit 5bce03c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

web/src/pages/Bouncers.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ function isBouncer(obj: unknown): obj is Bouncer {
5555
)
5656
}
5757

58+
/**
59+
* Extracts an array of valid `Bouncer` objects from API payloads.
60+
*
61+
* Accepts either a raw array of items or an object containing a `bouncers` array and returns
62+
* only entries that conform to the expected `Bouncer` shape.
63+
*
64+
* @param raw - The API response payload to normalize; may be an array or an object with a `bouncers` property
65+
* @returns An array of `Bouncer` objects extracted from `raw`, or an empty array if none were found
66+
*/
5867
function normalizeBouncers(raw: unknown): Bouncer[] {
5968
if (Array.isArray(raw)) {
6069
return raw.filter(isBouncer)
@@ -67,6 +76,13 @@ function normalizeBouncers(raw: unknown): Bouncer[] {
6776
return []
6877
}
6978

79+
/**
80+
* Page component that renders the Bouncers management UI for listing, searching, adding, and deleting CrowdSec bouncers.
81+
*
82+
* Renders a searchable table of registered bouncers, provides a dialog to create new bouncers (showing the API key once), and exposes delete actions with confirmation. Fetches and normalizes bouncer data from the Local API and performs add/delete mutations with user-facing success/error toasts.
83+
*
84+
* @returns The page's React element rendering the bouncers management interface.
85+
*/
7086
export default function Bouncers() {
7187
const queryClient = useQueryClient()
7288
const [urlFilters, setUrlFilter] = useUrlFilters(['q'], { q: '' })

0 commit comments

Comments
 (0)