Skip to content

Commit 222908b

Browse files
committed
denormalize runtime and version, display on run details
1 parent 5438748 commit 222908b

File tree

6 files changed

+48
-25
lines changed

6 files changed

+48
-25
lines changed

apps/webapp/app/components/RuntimeIcon.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { SimpleTooltip } from "~/components/primitives/Tooltip";
22
import { BunLogoIcon } from "~/assets/icons/BunLogoIcon";
33
import { NodejsLogoIcon } from "~/assets/icons/NodejsLogoIcon";
4-
import { parseRuntime, formatRuntimeWithVersion } from "~/utils/runtime";
4+
import { parseRuntime, formatRuntimeWithVersion, type NormalizedRuntime } from "~/utils/runtime";
55

66
interface RuntimeIconProps {
77
runtime?: string | null;
@@ -10,6 +10,17 @@ interface RuntimeIconProps {
1010
withLabel?: boolean;
1111
}
1212

13+
const getIcon = (runtime: NormalizedRuntime, className: string) => {
14+
switch (runtime) {
15+
case "bun":
16+
return <BunLogoIcon className={className} />;
17+
case "node":
18+
return <NodejsLogoIcon className={className} />;
19+
default:
20+
return <span className="text-text-dimmed"></span>;
21+
}
22+
};
23+
1324
export function RuntimeIcon({
1425
runtime,
1526
runtimeVersion,
@@ -25,18 +36,7 @@ export function RuntimeIcon({
2536
displayName: "Node.js",
2637
};
2738

28-
const getIcon = () => {
29-
switch (effectiveRuntime.runtime) {
30-
case "bun":
31-
return <BunLogoIcon className={className} />;
32-
case "node":
33-
return <NodejsLogoIcon className={className} />;
34-
default:
35-
return <span className="text-text-dimmed"></span>;
36-
}
37-
};
38-
39-
const icon = getIcon();
39+
const icon = getIcon(effectiveRuntime.runtime, className);
4040
const formattedText = formatRuntimeWithVersion(effectiveRuntime.originalRuntime, runtimeVersion);
4141

4242
if (withLabel) {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ export class SpanPresenter extends BasePresenter {
142142
select: {
143143
version: true,
144144
sdkVersion: true,
145+
runtime: true,
146+
runtimeVersion: true,
145147
},
146148
},
147149
engine: true,
@@ -326,6 +328,8 @@ export class SpanPresenter extends BasePresenter {
326328
taskIdentifier: run.taskIdentifier,
327329
version: run.lockedToVersion?.version,
328330
sdkVersion: run.lockedToVersion?.sdkVersion,
331+
runtime: run.lockedToVersion?.runtime,
332+
runtimeVersion: run.lockedToVersion?.runtimeVersion,
329333
isTest: run.isTest,
330334
environmentId: run.runtimeEnvironment.id,
331335
idempotencyKey: run.idempotencyKey,

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
import { TabButton, TabContainer } from "~/components/primitives/Tabs";
3737
import { TextLink } from "~/components/primitives/TextLink";
3838
import { InfoIconTooltip, SimpleTooltip } from "~/components/primitives/Tooltip";
39+
import { RuntimeIcon } from "~/components/RuntimeIcon";
3940
import { RunTimeline, RunTimelineEvent, SpanTimeline } from "~/components/run/RunTimeline";
4041
import { PacketDisplay } from "~/components/runs/v3/PacketDisplay";
4142
import { RunIcon } from "~/components/runs/v3/RunIcon";
@@ -575,6 +576,16 @@ function RunBody({
575576
)}
576577
</Property.Value>
577578
</Property.Item>
579+
<Property.Item>
580+
<Property.Label>Runtime</Property.Label>
581+
<Property.Value>
582+
<RuntimeIcon
583+
runtime={run.runtime}
584+
runtimeVersion={run.runtimeVersion}
585+
withLabel
586+
/>
587+
</Property.Value>
588+
</Property.Item>
578589
<Property.Item>
579590
<Property.Label>Test run</Property.Label>
580591
<Property.Value>

apps/webapp/app/v3/services/createBackgroundWorker.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ export class CreateBackgroundWorkerService extends BaseService {
8181
contentHash: body.metadata.contentHash,
8282
cliVersion: body.metadata.cliPackageVersion,
8383
sdkVersion: body.metadata.packageVersion,
84+
runtime: body.metadata.runtime,
85+
runtimeVersion: body.metadata.runtimeVersion,
8486
supportsLazyAttempts: body.supportsLazyAttempts,
8587
engine: body.engine,
8688
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- AlterTable
2+
ALTER TABLE "BackgroundWorker" ADD COLUMN "runtime" TEXT,
3+
ADD COLUMN "runtimeVersion" TEXT;

internal-packages/database/prisma/schema.prisma

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,9 @@ model BackgroundWorker {
420420
version String
421421
metadata Json
422422
423+
runtime String?
424+
runtimeVersion String?
425+
423426
createdAt DateTime @default(now())
424427
updatedAt DateTime @updatedAt
425428
@@ -719,24 +722,24 @@ model TaskRun {
719722
model TaskRunTemplate {
720723
id String @id @default(cuid())
721724
722-
taskSlug String
725+
taskSlug String
723726
triggerSource TaskTriggerSource
724727
725728
label String
726729
727-
payload String?
728-
payloadType String @default("application/json")
729-
metadata String?
730-
metadataType String @default("application/json")
731-
queue String?
732-
concurrencyKey String?
733-
ttlSeconds Int?
734-
maxAttempts Int?
730+
payload String?
731+
payloadType String @default("application/json")
732+
metadata String?
733+
metadataType String @default("application/json")
734+
queue String?
735+
concurrencyKey String?
736+
ttlSeconds Int?
737+
maxAttempts Int?
735738
maxDurationSeconds Int?
736-
tags String[]
737-
machinePreset String?
739+
tags String[]
740+
machinePreset String?
738741
739-
projectId String
742+
projectId String
740743
organizationId String
741744
742745
createdAt DateTime @default(now())

0 commit comments

Comments
 (0)