MCPcopy Create free account
hub / github.com/anomalyco/console / InvocationRow

Function InvocationRow

packages/web/workspace/src/common/invocation.tsx:261–545  ·  view source on GitHub ↗
(props: {
  invocation: Invocation;
  onSavePayload?: () => void;
  local: boolean;
  mixed?: {
    description: string;
    link: string;
  };
  expanded?: boolean;
  onClick?: () => void;
  onReplay?: () => void;
})

Source from the content-addressed store, hash-verified

259});
260
261export function InvocationRow(props: {
262 invocation: Invocation;
263 onSavePayload?: () => void;
264 local: boolean;
265 mixed?: {
266 description: string;
267 link: string;
268 };
269 expanded?: boolean;
270 onClick?: () => void;
271 onReplay?: () => void;
272}) {
273 const [tab, setTab] = createSignal<
274 "logs" | "request" | "response" | "report"
275 >("logs");
276
277 const shortDate = createMemo(() =>
278 new Intl.DateTimeFormat("en-US", shortDateOptions)
279 .format(props.invocation.start)
280 .replace(" at ", ", "),
281 );
282 const longDate = createMemo(() =>
283 new Intl.DateTimeFormat("en-US", longDateOptions).format(
284 props.invocation.start,
285 ),
286 );
287 const [replaying, setReplaying] = createSignal(false);
288 const level = createMemo(() =>
289 props.invocation.errors.length
290 ? props.invocation.errors.some((error) => error.failed)
291 ? "fail"
292 : "error"
293 : "info",
294 );
295
296 return (
297 <Root
298 data-element="invocation"
299 data-invocation-id={props.invocation.id}
300 data-expanded={props.expanded ? true : undefined}
301 expanded={props.expanded}
302 level={level() === "info" ? "info" : "danger"}
303 onClick={props.onClick}
304 >
305 <Summary>
306 <Row flex={false} space="2" vertical="center">
307 <CaretIcon>
308 <IconCaretRight />
309 </CaretIcon>
310 <Level level={level()} />
311 </Row>
312 <Timestamp title={longDate()}>{shortDate()}</Timestamp>
313 <Duration
314 coldStart={props.invocation.cold}
315 title={props.invocation.cold ? "Cold start" : ""}
316 >
317 {props.invocation.report?.duration
318 ? formatDuration(props.invocation.report?.duration)

Callers

nothing calls this directly

Calls 2

formatDurationFunction · 0.90
formatBytesFunction · 0.90

Tested by

no test coverage detected