Add module event producer coverage
This commit is contained in:
32
webui/src/components/PolicyPathHelp.tsx
Normal file
32
webui/src/components/PolicyPathHelp.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { ReactNode } from "react";
|
||||
import type { PolicySourcePathItem } from "./PolicySourcePath";
|
||||
|
||||
export type PolicyPathHelpProps = {
|
||||
lines: ReactNode[];
|
||||
className?: string;
|
||||
lineClassName?: string;
|
||||
};
|
||||
|
||||
export type NormalizedPolicySourcePathItem = {
|
||||
label: string;
|
||||
policy?: unknown;
|
||||
};
|
||||
|
||||
export default function PolicyPathHelp({ lines, className = "", lineClassName = "" }: PolicyPathHelpProps) {
|
||||
return (
|
||||
<span className={["policy-path-help", className].filter(Boolean).join(" ")}>
|
||||
{lines.map((line, index) =>
|
||||
<span className={["policy-path-help-line", lineClassName].filter(Boolean).join(" ")} key={`${String(line)}-${index}`}>
|
||||
{line}
|
||||
</span>
|
||||
)}
|
||||
</span>);
|
||||
|
||||
}
|
||||
|
||||
export function normalizePolicySourcePathItems(items: PolicySourcePathItem[]): NormalizedPolicySourcePathItem[] {
|
||||
return items.map((item) => {
|
||||
if (typeof item === "string") return { label: item };
|
||||
return { label: item.label, policy: item.policy };
|
||||
}).filter((item) => item.label.trim());
|
||||
}
|
||||
Reference in New Issue
Block a user