From d13736d17ecdc1d99a194fa3a85e9e7437c839fc Mon Sep 17 00:00:00 2001 From: Adam Gastineau Date: Mon, 9 Dec 2024 12:01:01 -0800 Subject: [PATCH] feat: Add startTime to call tab --- packages/trace-viewer/src/ui/callTab.tsx | 20 +++++++++++++++----- packages/trace-viewer/src/ui/workbench.tsx | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/trace-viewer/src/ui/callTab.tsx b/packages/trace-viewer/src/ui/callTab.tsx index 1ab3b5b46f..cfa3be4880 100644 --- a/packages/trace-viewer/src/ui/callTab.tsx +++ b/packages/trace-viewer/src/ui/callTab.tsx @@ -27,24 +27,32 @@ import type { ActionTraceEventInContext } from './modelUtil'; export const CallTab: React.FunctionComponent<{ action: ActionTraceEventInContext | undefined, + executionStartTime: number, + executionStartWallTime: number, sdkLanguage: Language | undefined, -}> = ({ action, sdkLanguage }) => { +}> = ({ action, executionStartTime, executionStartWallTime, sdkLanguage }) => { if (!action) return ; const params = { ...action.params }; // Strip down the waitForEventInfo data, we never need it. delete params.info; const paramKeys = Object.keys(params); - const timeMillis = action.startTime + (action.context.wallTime - action.context.startTime); - const wallTime = new Date(timeMillis).toLocaleString(); + + const startTimeMillis = action.startTime - executionStartTime; + const startTime = msToString(startTimeMillis); + + const wallTimeMillis = startTimeMillis + executionStartWallTime; + const wallTime = new Date(wallTimeMillis).toLocaleString(); + const duration = action.endTime ? msToString(action.endTime - action.startTime) : 'Timed Out'; return
{action.apiName}
{<>
Time
- {wallTime &&
wall time:{wallTime}
} -
duration:{duration}
+ {wallTime && } + + } { !!paramKeys.length &&
Parameters
} { @@ -59,6 +67,8 @@ export const CallTab: React.FunctionComponent<{
; }; +const DateTimeCallLine: React.FC<{ name: string, value: string }> = ({ name, value }) =>
{name}{value}
; + type Property = { name: string; type: 'string' | 'number' | 'object' | 'locator' | 'handle' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'function'; diff --git a/packages/trace-viewer/src/ui/workbench.tsx b/packages/trace-viewer/src/ui/workbench.tsx index ad8a099ea4..a705b71ef9 100644 --- a/packages/trace-viewer/src/ui/workbench.tsx +++ b/packages/trace-viewer/src/ui/workbench.tsx @@ -176,7 +176,7 @@ export const Workbench: React.FunctionComponent<{ const callTab: TabbedPaneTabModel = { id: 'call', title: 'Call', - render: () => + render: () => }; const logTab: TabbedPaneTabModel = { id: 'log',