Skip to content

Commit 5d71be4

Browse files
authored
feat(ui): show total duration and gas in executions table header (#175)
## Summary - Show total execution duration and total gas used (in MGas) on the top right of the Executions table in the test detail modal - Sums all per-execution `duration_ns` and `gas_used` values from the result details ## Test plan - [x] Open a test detail modal on the run detail page - [x] Verify "Total: {duration} ({MGas})" appears on the top right of the Executions heading for both Test and Setup phases - [x] Verify it doesn't show when there's no duration data
1 parent 95fce66 commit 5d71be4

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

ui/src/components/run-detail/ExecutionsList.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,28 @@ export function ExecutionsList({ runId, suiteHash, testName, stepType }: Executi
201201
return <p className="py-2 text-sm/6 text-gray-500 dark:text-gray-400">No execution data available</p>
202202
}
203203

204+
const totalDurationNs = resultDetails?.duration_ns.reduce((sum, ns) => sum + ns, 0) ?? 0
205+
const totalGasUsed = resultDetails?.gas_used
206+
? Object.values(resultDetails.gas_used).reduce((sum, g) => sum + g, 0)
207+
: 0
208+
204209
return (
205210
<div className="mt-4 max-w-full overflow-hidden">
206-
<h4 className="mb-2 text-sm/6 font-medium text-gray-900 dark:text-gray-100">
207-
Executions ({requests.length})
208-
</h4>
211+
<div className="mb-2 flex items-center justify-between">
212+
<h4 className="text-sm/6 font-medium text-gray-900 dark:text-gray-100">
213+
Executions ({requests.length})
214+
</h4>
215+
{totalDurationNs > 0 && (
216+
<span className="text-sm/6 text-gray-500 dark:text-gray-400">
217+
Total: <Duration nanoseconds={totalDurationNs} />
218+
{totalGasUsed > 0 && (
219+
<span className="ml-2 text-xs text-gray-400 dark:text-gray-500">
220+
({(totalGasUsed / 1_000_000).toFixed(2)} MGas)
221+
</span>
222+
)}
223+
</span>
224+
)}
225+
</div>
209226
<div className="overflow-hidden rounded-xs border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800">
210227
{requests.map((request, index) => (
211228
<ExecutionRow

0 commit comments

Comments
 (0)