(props: {
path: string;
segment: string;
depth: number;
count: number;
open: boolean;
onToggle: () => void;
search: string;
onSetPolicy?: (pattern: string, action: ToolPolicyAction) => void;
onClearPolicy?: (pattern: string) => void;
patternForDisplay: (displayPattern: string) => string;
exactRule?: ToolPolicyAction;
})
| 672 | } |
| 673 | |
| 674 | function ToolGroupRow(props: { |
| 675 | path: string; |
| 676 | segment: string; |
| 677 | depth: number; |
| 678 | count: number; |
| 679 | open: boolean; |
| 680 | onToggle: () => void; |
| 681 | search: string; |
| 682 | onSetPolicy?: (pattern: string, action: ToolPolicyAction) => void; |
| 683 | onClearPolicy?: (pattern: string) => void; |
| 684 | patternForDisplay: (displayPattern: string) => string; |
| 685 | exactRule?: ToolPolicyAction; |
| 686 | }) { |
| 687 | const showActions = !!props.onSetPolicy; |
| 688 | return ( |
| 689 | <div className="group/tt-row relative flex items-stretch hover:bg-accent/60"> |
| 690 | <Button |
| 691 | variant="ghost" |
| 692 | aria-expanded={props.open} |
| 693 | onClick={props.onToggle} |
| 694 | className={cn(rowBaseClasses, "hover:bg-transparent")} |
| 695 | style={{ |
| 696 | paddingLeft: rowIndent(props.depth), |
| 697 | paddingRight: showActions ? 36 : 12, |
| 698 | }} |
| 699 | > |
| 700 | <ChevronRightIcon |
| 701 | aria-hidden |
| 702 | className={cn( |
| 703 | "size-3.5 shrink-0 text-muted-foreground transition-transform duration-150", |
| 704 | props.open && "rotate-90", |
| 705 | )} |
| 706 | /> |
| 707 | <span className="min-w-0 flex-1 truncate text-left font-mono text-xs text-foreground"> |
| 708 | {highlightMatch(props.segment, props.search)} |
| 709 | </span> |
| 710 | <span className="shrink-0 tabular-nums text-xs text-muted-foreground">{props.count}</span> |
| 711 | </Button> |
| 712 | {showActions && ( |
| 713 | <div |
| 714 | className={cn( |
| 715 | "absolute right-1.5 top-1/2 -translate-y-1/2 transition-opacity", |
| 716 | props.exactRule |
| 717 | ? "opacity-100" |
| 718 | : "opacity-0 group-hover/tt-row:opacity-100 focus-within:opacity-100", |
| 719 | )} |
| 720 | > |
| 721 | <PolicyActionMenu |
| 722 | pattern={props.patternForDisplay(`${props.path}.*`)} |
| 723 | current={props.exactRule} |
| 724 | onSet={props.onSetPolicy!} |
| 725 | onClear={props.onClearPolicy} |
| 726 | triggerLabel={`Set policy for ${props.path}.*`} |
| 727 | /> |
| 728 | </div> |
| 729 | )} |
| 730 | </div> |
| 731 | ); |
nothing calls this directly
no test coverage detected