Skip to content

Commit d8a20c4

Browse files
Copilotalexr00
andcommitted
Add View Session button next to Cancel Coding Agent button
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 42b57dd commit d8a20c4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

webviews/components/header.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function ButtonGroup({ isCurrentlyCheckedOut, canEdit, isIssue, repositoryDefaul
134134
}
135135

136136
function CancelCodingAgentButton({ canEdit, codingAgentEvent }: { canEdit: boolean, codingAgentEvent: TimelineEvent | undefined }) {
137-
const { cancelCodingAgent, updatePR } = useContext(PullRequestContext);
137+
const { cancelCodingAgent, updatePR, openSessionLog } = useContext(PullRequestContext);
138138
const [isBusy, setBusy] = useState(false);
139139

140140
const cancel = async () => {
@@ -149,11 +149,19 @@ function CancelCodingAgentButton({ canEdit, codingAgentEvent }: { canEdit: boole
149149
setBusy(false);
150150
};
151151

152+
// Extract sessionLink from the coding agent event
153+
const sessionLink = codingAgentEvent && 'sessionLink' in codingAgentEvent ? codingAgentEvent.sessionLink : undefined;
154+
152155
return (canEdit && codingAgentEvent && copilotEventToStatus(codingAgentEvent) === CopilotPRStatus.Started)
153156
? <div className="button-group">
154157
<button title="Cancel Coding Agent" disabled={isBusy} className="small-button danger" onClick={cancel}>
155158
Cancel Coding Agent
156159
</button>
160+
{sessionLink && (
161+
<button title="View Session" className="secondary small-button" onClick={() => openSessionLog(sessionLink)}>
162+
View Session
163+
</button>
164+
)}
157165
</div>
158166
: null;
159167
}

0 commit comments

Comments
 (0)