Skip to content

Commit 5b2b89e

Browse files
authored
AXON-1515: add onLinkClick handler for DebugPanel (#1298)
1 parent be0e1c7 commit 5b2b89e

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

src/rovo-dev/ui/messaging/ChatStream.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ interface ChatStreamProps {
4848
jiraWorkItems: MinimalIssue<DetailedSiteInfo>[] | undefined;
4949
onJiraItemClick: (issue: MinimalIssue<DetailedSiteInfo>) => void;
5050
onToolPermissionChoice: (toolCallId: string, choice: ToolPermissionDialogChoice | 'enableYolo') => void;
51+
onLinkClick: (href: string) => void;
5152
}
5253

5354
export const ChatStream: React.FC<ChatStreamProps> = ({
@@ -71,6 +72,7 @@ export const ChatStream: React.FC<ChatStreamProps> = ({
7172
jiraWorkItems,
7273
onJiraItemClick,
7374
onToolPermissionChoice,
75+
onLinkClick,
7476
}) => {
7577
const chatEndRef = React.useRef<HTMLDivElement>(null);
7678
const sentinelRef = React.useRef<HTMLDivElement>(null);
@@ -88,13 +90,6 @@ export const ChatStream: React.FC<ChatStreamProps> = ({
8890
);
8991
setHasChangesInGit(response.hasChanges);
9092
}, [messagingApi]);
91-
92-
const onLinkClick = React.useCallback(
93-
(href: string) => {
94-
messagingApi.postMessage({ type: RovoDevViewResponseType.OpenExternalLink, href });
95-
},
96-
[messagingApi],
97-
);
9893
const [autoScrollEnabled, setAutoScrollEnabled] = React.useState(true);
9994

10095
// Helper to perform auto-scroll when enabled

src/rovo-dev/ui/rovoDevView.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,12 @@ const RovoDevView: React.FC = () => {
805805

806806
const onYoloModeToggled = useCallback(() => setIsYoloModeToggled((prev) => !prev), [setIsYoloModeToggled]);
807807

808+
const onLinkClick = React.useCallback(
809+
(href: string) => {
810+
postMessage({ type: RovoDevViewResponseType.OpenExternalLink, href });
811+
},
812+
[postMessage],
813+
);
808814
React.useEffect(() => {
809815
// the event below (YoloModeToggled) with value true automatically approves any pending confirmation
810816
if (isYoloModeToggled) {
@@ -859,6 +865,7 @@ const RovoDevView: React.FC = () => {
859865
currentState={currentState}
860866
debugContext={debugPanelContext}
861867
debugMcpContext={debugPanelMcpContext}
868+
onLinkClick={onLinkClick}
862869
/>
863870
)}
864871
<ChatStream
@@ -891,6 +898,7 @@ const RovoDevView: React.FC = () => {
891898
jiraWorkItems={jiraWorkItems}
892899
onJiraItemClick={onJiraItemClick}
893900
onToolPermissionChoice={onToolPermissionChoice}
901+
onLinkClick={onLinkClick}
894902
/>
895903
{!hidePromptBox && (
896904
<div className="input-section-container">

src/rovo-dev/ui/tools/DebugPanel.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ export const DebugPanel: React.FC<{
77
currentState: State;
88
debugContext: Record<string, string>;
99
debugMcpContext: Record<string, string>;
10-
}> = ({ currentState, debugContext, debugMcpContext }) => {
10+
onLinkClick: (href: string) => void;
11+
}> = ({ currentState, debugContext, debugMcpContext, onLinkClick }) => {
1112
return (
1213
<div style={{ width: '100%', border: '1px solid var(--vscode-inputValidation-errorBorder)', padding: '4px' }}>
1314
<DebugStatePanel currentState={currentState} />
1415
{Object.keys(debugContext).length > 0 && (
1516
<>
1617
<hr />
17-
<DebugContextPanel title="Process state" debugContext={debugContext} />
18+
<DebugContextPanel title="Process state" debugContext={debugContext} onLinkClick={onLinkClick} />
1819
</>
1920
)}
2021
{Object.keys(debugMcpContext).length > 0 && (
2122
<>
2223
<hr />
23-
<DebugContextPanel title="MCP servers" debugContext={debugMcpContext} />
24+
<DebugContextPanel title="MCP servers" debugContext={debugMcpContext} onLinkClick={onLinkClick} />
2425
</>
2526
)}
2627
</div>
@@ -63,7 +64,8 @@ const DebugStatePanel: React.FC<{
6364
const DebugContextPanel: React.FC<{
6465
title: string;
6566
debugContext: Record<string, string>;
66-
}> = ({ title, debugContext }) => {
67+
onLinkClick: (href: string) => void;
68+
}> = ({ title, debugContext, onLinkClick }) => {
6769
const props = React.useMemo(() => {
6870
const p: [string, string][] = [];
6971
for (const key in debugContext) {
@@ -81,7 +83,7 @@ const DebugContextPanel: React.FC<{
8183
<td>{key}</td>
8284
{key === 'RovoDevAddress' && (
8385
<td>
84-
<MarkedDown value={value + '/docs'} />
86+
<MarkedDown value={value + '/docs'} onLinkClick={onLinkClick} />
8587
</td>
8688
)}
8789
{key !== 'RovoDevAddress' && <td>{value}</td>}

0 commit comments

Comments
 (0)