Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions services/hackbot-ui/components/RunDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ function commentPreview(a: RunAction): string | null {
return typeof text === "string" && text.trim() ? text : null;
}

//Every action may have a result.url, which is a link to the external system (e.g. Bugzilla) where the action was applied.
// We surface that as an "Open" link in the actions list.
function actionUrl(a: RunAction): string | null {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this function? I guess we could use the URL as it is. WDYT?

const url = a.result?.url;
return typeof url === "string" && url.trim() ? url : null;
}
Comment thread
jpangas marked this conversation as resolved.

const POLL_MS = 4000;

function formatBytes(n: number): string {
Expand Down Expand Up @@ -271,11 +278,17 @@ export function RunDetail({ runId }: { runId: string }) {
<ul className="action-list">
{actions.map((a) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to file a follow-up issue to replace a with action to have better readability.

const preview = commentPreview(a);
const url = actionUrl(a);
return (
<li key={a.idx}>
<div className="action-row">
<span className={`badge ${a.status}`}>{a.status}</span>
<code>{a.type}</code>
{url && (
<a href={url} target="_blank" rel="noreferrer">
Open
</a>
Comment thread
jpangas marked this conversation as resolved.
)}
{a.error && <span className="muted">{a.error}</span>}
</div>
{preview && (
Expand Down