Skip to content

Commit c0b6c41

Browse files
authored
Disable payload editing for run replays with large payloads (#2268)
* Use sexy scrollbars for templates and recent runs popover content @nick this is for you!!1 * Fix TabButton component disabled state * Disable payload tab when replaying runs with large payloads
1 parent 35c7a1e commit c0b6c41

File tree

5 files changed

+42
-14
lines changed

5 files changed

+42
-14
lines changed

apps/webapp/app/components/primitives/Tabs.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ export function TabButton({
9494

9595
return (
9696
<button
97-
className={cn("group flex flex-col items-center pt-1 focus-custom", props.className)}
97+
className={cn(
98+
"group flex flex-col items-center pt-1 focus-custom",
99+
props.className,
100+
props.disabled && "pointer-events-none opacity-50"
101+
)}
98102
type="button"
99103
ref={ref}
100104
{...props}

apps/webapp/app/components/runs/v3/PacketDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function PacketDisplay({
1616
case "application/store": {
1717
return (
1818
<div className="flex flex-col">
19-
<Paragraph variant="base/bright" className="w-full border-b border-grid-dimmed py-2.5">
19+
<Paragraph variant="base/bright" className="w-full py-2.5 text-sm">
2020
{title}
2121
</Paragraph>
2222
<LinkButton LeadingIcon={CloudArrowDownIcon} to={data} variant="tertiary/medium" download>

apps/webapp/app/components/runs/v3/ReplayRunDialog.tsx

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import { RectangleStackIcon } from "@heroicons/react/20/solid";
3434
import { Badge } from "~/components/primitives/Badge";
3535
import { RunTagInput } from "./RunTagInput";
3636
import { MachinePresetName } from "@trigger.dev/core/v3";
37+
import { InfoIconTooltip } from "~/components/primitives/Tooltip";
38+
import { divide } from "effect/Duration";
3739

3840
type ReplayRunDialogProps = {
3941
runFriendlyId: string;
@@ -165,7 +167,7 @@ function ReplayForm({
165167
replayData.payloadType === "application/json" ||
166168
replayData.payloadType === "application/super+json";
167169

168-
const [tab, setTab] = useState<"payload" | "metadata">("payload");
170+
const [tab, setTab] = useState<"payload" | "metadata">(editablePayload ? "payload" : "metadata");
169171

170172
const { defaultTaskQueue } = replayData;
171173

@@ -257,15 +259,30 @@ function ReplayForm({
257259
additionalActions={
258260
<TabContainer className="flex grow items-baseline justify-between self-end border-none">
259261
<div className="flex gap-5">
260-
<TabButton
261-
isActive={tab === "payload"}
262-
layoutId="replay-editor"
263-
onClick={() => {
264-
setTab("payload");
265-
}}
266-
>
267-
Payload
268-
</TabButton>
262+
<div className="flex items-center gap-1.5">
263+
<TabButton
264+
disabled={!editablePayload}
265+
isActive={tab === "payload"}
266+
layoutId="replay-editor"
267+
onClick={() => {
268+
setTab("payload");
269+
}}
270+
>
271+
Payload
272+
</TabButton>
273+
{!editablePayload && (
274+
<InfoIconTooltip
275+
content={
276+
<span className="text-sm">
277+
Payload is not editable for runs with{" "}
278+
<TextLink to={docsPath("triggering#large-payloads")}>
279+
large payloads.
280+
</TextLink>
281+
</span>
282+
}
283+
/>
284+
)}
285+
</div>
269286
<TabButton
270287
isActive={tab === "metadata"}
271288
layoutId="replay-editor"

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test.tasks.$taskParam/route.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ function RecentRunsPopover<T extends StandardRun | ScheduledRun>({
13171317
</Button>
13181318
</PopoverTrigger>
13191319
<PopoverContent className="min-w-[294px] p-0" align="end" sideOffset={6}>
1320-
<div className="max-h-80 overflow-y-auto">
1320+
<div className="max-h-80 overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
13211321
<div className="p-1">
13221322
{runs.map((run) => (
13231323
<button
@@ -1398,7 +1398,7 @@ function RunTemplatesPopover({
13981398
</Button>
13991399
</PopoverTrigger>
14001400
<PopoverContent className="min-w-[279px] p-0" align="end" sideOffset={6}>
1401-
<div className="max-h-80 overflow-y-auto">
1401+
<div className="max-h-80 overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
14021402
<div className="p-1">
14031403
{templates.map((template) => (
14041404
<div

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ export class ReplayTaskRunService extends BaseService {
122122
existingTaskRun: TaskRun,
123123
stringifiedPayloadOverride: string | undefined
124124
) {
125+
if (existingTaskRun.payloadType === "application/store") {
126+
return conditionallyImportPacket({
127+
data: existingTaskRun.payload,
128+
dataType: existingTaskRun.payloadType,
129+
});
130+
}
131+
125132
if (stringifiedPayloadOverride && existingTaskRun.payloadType === "application/super+json") {
126133
const newPayload = await replaceSuperJsonPayload(
127134
existingTaskRun.payload,

0 commit comments

Comments
 (0)