Skip to content

Commit 2bd66a7

Browse files
committed
Deal with old batches: “Legacy batch”
1 parent 0603c97 commit 2bd66a7

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

apps/webapp/app/presenters/v3/BatchListPresenter.server.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export class BatchListPresenter extends BasePresenter {
9696
createdAt: Date;
9797
updatedAt: Date;
9898
runCount: BigInt;
99+
batchVersion: string;
99100
}[]
100101
>`
101102
SELECT
@@ -105,7 +106,8 @@ export class BatchListPresenter extends BasePresenter {
105106
b.status,
106107
b."createdAt",
107108
b."updatedAt",
108-
b."runCount"
109+
b."runCount",
110+
b."batchVersion"
109111
FROM
110112
${sqlDatabaseSchema}."BatchTaskRun" b
111113
WHERE
@@ -123,7 +125,9 @@ WHERE
123125
${friendlyId ? Prisma.sql`AND b."friendlyId" = ${friendlyId}` : Prisma.empty}
124126
${
125127
statuses && statuses.length > 0
126-
? Prisma.sql`AND b.status = ANY(ARRAY[${Prisma.join(statuses)}]::"BatchTaskRunStatus"[])`
128+
? Prisma.sql`AND b.status = ANY(ARRAY[${Prisma.join(
129+
statuses
130+
)}]::"BatchTaskRunStatus"[]) AND b.version <> 'v1'`
127131
: Prisma.empty
128132
}
129133
${
@@ -191,6 +195,7 @@ WHERE
191195
status: batch.status,
192196
environment: displayableEnvironment(environment, userId),
193197
runCount: Number(batch.runCount),
198+
batchVersion: batch.batchVersion,
194199
};
195200
}),
196201
pagination: {

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam.batches/route.tsx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { CheckCircleIcon, ClockIcon, RectangleGroupIcon } from "@heroicons/react/20/solid";
1+
import {
2+
CheckCircleIcon,
3+
ClockIcon,
4+
ExclamationCircleIcon,
5+
RectangleGroupIcon,
6+
} from "@heroicons/react/20/solid";
27
import { ArrowUpCircleIcon } from "@heroicons/react/24/outline";
38
import { BookOpenIcon } from "@heroicons/react/24/solid";
49
import { Outlet, useLocation, useNavigation, useParams } from "@remix-run/react";
@@ -208,11 +213,24 @@ function BatchesTable({ batches, hasFilters, filters }: BatchList) {
208213
/>
209214
</TableCell>
210215
<TableCell to={path}>
211-
<SimpleTooltip
212-
content={descriptionForBatchStatus(batch.status)}
213-
disableHoverableContent
214-
button={<BatchStatusCombo status={batch.status} />}
215-
/>
216+
{batch.batchVersion === "v1" ? (
217+
<SimpleTooltip
218+
content="Upgrade to the latest SDK for batch statuses to appear."
219+
disableHoverableContent
220+
button={
221+
<span className="flex items-center gap-1">
222+
<ExclamationCircleIcon className="size-4 text-slate-500" />
223+
<span>Legacy batch</span>
224+
</span>
225+
}
226+
/>
227+
) : (
228+
<SimpleTooltip
229+
content={descriptionForBatchStatus(batch.status)}
230+
disableHoverableContent
231+
button={<BatchStatusCombo status={batch.status} />}
232+
/>
233+
)}
216234
</TableCell>
217235
<TableCell to={path}>{batch.runCount}</TableCell>
218236
<TableCell to={path} className="w-[1%]" actionClassName="pr-0 tabular-nums">

0 commit comments

Comments
 (0)