Skip to content

Commit 98c624c

Browse files
authored
Add action row for invocations table (#462)
Signed-off-by: Nik Nasr <nik@restate.dev>
1 parent 9993e9d commit 98c624c

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

libs/features/batch-operations/src/lib/BatchProgressBar.tsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,10 @@ export function BatchProgressBar({
7474
<div className="flex flex-col gap-3.5">
7575
<div className="flex translate-y-4 flex-col">
7676
<span className="inline-flex transform items-baseline gap-1 text-lg font-normal text-gray-600 transition-all">
77-
{successful ? (
78-
<span className="transform text-blue-600 transition-all">
79-
{successful}{' '}
80-
<span className="text-0.5xs text-gray-500">succeeded</span>{' '}
81-
</span>
82-
) : (
83-
<br />
84-
)}{' '}
77+
<span className="transform text-blue-600 transition-all">
78+
{successful}{' '}
79+
<span className="text-0.5xs text-gray-500">succeeded</span>{' '}
80+
</span>{' '}
8581
{!!failed && (
8682
<Popover>
8783
<PopoverTrigger>
@@ -97,7 +93,7 @@ export function BatchProgressBar({
9793
</span>
9894
</Button>
9995
</span>
100-
<PopoverContent>
96+
<PopoverContent className="max-w-lg">
10197
<DropdownSection
10298
title={`Failed invocations ${(failedInvocations?.length || 0) === MAX_FAILED_INVOCATIONS ? `(last ${MAX_FAILED_INVOCATIONS})` : ''}`}
10399
>
@@ -144,15 +140,17 @@ export function BatchProgressBar({
144140
<div className="flex flex-col gap-3.5">
145141
<div className="relative mt-1 flex h-3 w-full gap-0.5">
146142
{/* Success portion */}
147-
<div
148-
className={progressBarStyles({
149-
variant: 'success',
150-
isZero: successful === 0,
151-
})}
152-
style={{
153-
width: `${successRatio * 100}%`,
154-
}}
155-
/>
143+
{successful > 0 && (
144+
<div
145+
className={progressBarStyles({
146+
variant: 'success',
147+
isZero: successful === 0,
148+
})}
149+
style={{
150+
width: `${successRatio * 100}%`,
151+
}}
152+
/>
153+
)}
156154
{/* Failed portion */}
157155
{failed > 0 && (
158156
<div

libs/features/invocations-route/src/lib/invocations.route.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import {
4747
ClientLoaderFunctionArgs,
4848
Form,
4949
ShouldRevalidateFunctionArgs,
50+
useNavigate,
5051
useSearchParams,
5152
} from 'react-router';
5253
import { useQueryClient } from '@tanstack/react-query';
@@ -477,6 +478,9 @@ function Component() {
477478
setSelectedInvocationIds(new Set());
478479
}, [isFetching, pageIndex]);
479480

481+
const navigate = useNavigate();
482+
const { baseUrl } = useRestateContext();
483+
480484
return (
481485
<SnapshotTimeProvider lastSnapshot={dataUpdate}>
482486
<div className="relative flex flex-auto flex-col gap-2">
@@ -644,6 +648,12 @@ function Component() {
644648
setSelectedInvocationIds(keys as Set<string>);
645649
}
646650
}}
651+
onRowAction={(key) => {
652+
navigate({
653+
pathname: `${baseUrl}/invocations/${key}`,
654+
search: searchParams.toString(),
655+
});
656+
}}
647657
>
648658
<TableHeader className="[&_th:nth-last-child(2)_[data-resizable-direction]]:invisible">
649659
{sortedColumnsList.map((col) =>

libs/ui/table/src/lib/Table.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface TableProps
3131
| 'onSortChange'
3232
| 'onSelectionChange'
3333
| 'selectedKeys'
34+
| 'onRowAction'
3435
> {
3536
className?: string;
3637
}

0 commit comments

Comments
 (0)