Skip to content

Improved run page and replaying #1240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
553ec4e
PropertyTable component changed to use sub components
matt-aitken Jul 26, 2024
ab7380d
Separate run span component
matt-aitken Jul 26, 2024
9770e9a
Early WIP on tabs that use search query
matt-aitken Jul 26, 2024
dfbae8d
Shortcut key tabs for the span panel
matt-aitken Jul 26, 2024
96e3986
The span timeline is working
matt-aitken Jul 26, 2024
806ad6d
When runs get expired, update the OTEL event with an error
matt-aitken Jul 26, 2024
58435db
Improved the expired error message
matt-aitken Jul 26, 2024
e606f02
Reveal env vars when editing
matt-aitken Jul 27, 2024
77551f2
Tightened things up a bit
matt-aitken Jul 27, 2024
587309d
Added detail tab properties
matt-aitken Jul 27, 2024
5c04652
Progress dashed line
matt-aitken Jul 28, 2024
b3a01ab
Move the env label next to the Run number title
matt-aitken Jul 28, 2024
60a22b4
Top level cancel/replay buttons
matt-aitken Jul 28, 2024
f2a6f78
Replay with a different payload and environment
matt-aitken Jul 28, 2024
c59062b
Fix for non json payloads
matt-aitken Jul 28, 2024
46935b2
Hide the clear/copy buttons
matt-aitken Jul 28, 2024
61bbb3f
UI improvements with large payloads
matt-aitken Jul 28, 2024
01226ef
Close the panels when you replay/cancel
matt-aitken Jul 28, 2024
00800de
Added the new timeline to spans
matt-aitken Jul 28, 2024
9fdab74
Use the u-turn left icon for replay
matt-aitken Jul 29, 2024
1f05c04
Added an index for spanId on TaskRun
matt-aitken Jul 29, 2024
52fcbad
Remove replay/cancel buttons the span view
matt-aitken Jul 29, 2024
ca87f50
Replay shortcut works inside the code editor
matt-aitken Jul 29, 2024
fe1d273
Split the log/span inspector between Overview and Detail as well
matt-aitken Jul 29, 2024
1e68a32
More improvements to the inspector
matt-aitken Jul 29, 2024
deb04ea
Context and output improvements
matt-aitken Jul 29, 2024
13c5759
Focus on run working
matt-aitken Jul 29, 2024
534656a
Added version to run.ctx
matt-aitken Jul 29, 2024
174e395
Added some padding to the detail view
matt-aitken Jul 29, 2024
d6df075
Added context tab with shortcut
matt-aitken Jul 30, 2024
5e26173
Only load the replay data when the dialog is open
matt-aitken Jul 30, 2024
60a1190
Replaying uses the tags from the original run
matt-aitken Jul 30, 2024
8a3b4e0
Links are now text links
matt-aitken Jul 30, 2024
f7813c1
Removed version links for now because we don’t have dropdown filters …
matt-aitken Jul 30, 2024
622f212
Tabs are now outside of the scrollview
matt-aitken Jul 30, 2024
427054f
The inspector is now 30% of the width by default
matt-aitken Jul 30, 2024
55a44c0
Allow replaying and editing SuperJSON payloads
matt-aitken Jul 31, 2024
6714a3c
Deleted unused CodeGroup file
matt-aitken Jul 31, 2024
c523b35
Increase the tags limit to 5, do the limiting on the server
matt-aitken Jul 31, 2024
0cec52a
The admin tooltip now always shows basic org, project and user info
matt-aitken Jul 31, 2024
00544ce
Fix for schedule inspector disabled state layout
matt-aitken Jul 31, 2024
3fcbca4
Remove new unused span metadata and context
matt-aitken Jul 31, 2024
55b2770
Removed unused import
matt-aitken Jul 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fast-melons-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@trigger.dev/core": patch
---

Added version to ctx.run
50 changes: 46 additions & 4 deletions apps/webapp/app/components/admin/debugTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import * as Property from "~/components/primitives/PropertyTable";
import { ShieldCheckIcon } from "@heroicons/react/20/solid";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "~/components/primitives/Tooltip";
import { useIsImpersonating } from "~/hooks/useOrganizations";
import { useHasAdminAccess } from "~/hooks/useUser";
import {
useIsImpersonating,
useOptionalOrganization,
useOrganization,
} from "~/hooks/useOrganizations";
import { useOptionalProject, useProject } from "~/hooks/useProject";
import { useHasAdminAccess, useUser } from "~/hooks/useUser";

export function AdminDebugTooltip({ children }: { children: React.ReactNode }) {
const hasAdminAccess = useHasAdminAccess();
Expand All @@ -22,10 +28,46 @@ export function AdminDebugTooltip({ children }: { children: React.ReactNode }) {
<TooltipTrigger>
<ShieldCheckIcon className="size-5" />
</TooltipTrigger>
<TooltipContent className="flex max-h-[90vh] items-center gap-1 overflow-y-auto">
{children}
<TooltipContent className="max-h-[90vh] overflow-y-auto">
<Content>{children}</Content>
</TooltipContent>
</Tooltip>
</TooltipProvider>
);
}

function Content({ children }: { children: React.ReactNode }) {
const organization = useOptionalOrganization();
const project = useOptionalProject();
const user = useUser();

return (
<div className="flex flex-col gap-2 divide-y divide-slate-700">
<Property.Table>
<Property.Item>
<Property.Label>User ID</Property.Label>
<Property.Value>{user.id}</Property.Value>
</Property.Item>
{organization && (
<Property.Item>
<Property.Label>Org ID</Property.Label>
<Property.Value>{organization.id}</Property.Value>
</Property.Item>
)}
{project && (
<>
<Property.Item>
<Property.Label>Project ID</Property.Label>
<Property.Value>{project.id}</Property.Value>
</Property.Item>
<Property.Item>
<Property.Label>Project ref</Property.Label>
<Property.Value>{project.ref}</Property.Value>
</Property.Item>
</>
)}
</Property.Table>
<div className="pt-2">{children}</div>
</div>
);
}
14 changes: 5 additions & 9 deletions apps/webapp/app/components/code/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,12 @@ export const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(
onMouseEnter={() => setMouseOver(true)}
onMouseLeave={() => setMouseOver(false)}
className={cn(
"absolute right-3 z-50 transition-colors duration-100 hover:cursor-pointer",
showChrome ? "top-10" : "top-3",
"absolute right-3 z-50 transition-colors duration-100 hover:cursor-pointer",
showChrome ? "top-10" : "top-2.5",
copied ? "text-emerald-500" : "text-charcoal-500 hover:text-charcoal-300"
)}
>
{copied ? (
<ClipboardCheck className="h-5 w-5" />
) : (
<Clipboard className="h-5 w-5" />
)}
{copied ? <ClipboardCheck className="size-4" /> : <Clipboard className="size-4" />}
</TooltipTrigger>
<TooltipContent side="left" className="text-xs">
{copied ? "Copied" : "Copy"}
Expand Down Expand Up @@ -391,8 +387,8 @@ function Chrome({ title }: { title?: string }) {

export function TitleRow({ title }: { title: string }) {
return (
<div className="flex items-center justify-between px-4">
<Paragraph variant="base/bright" className="w-full border-b border-grid-dimmed py-2.5">
<div className="flex items-center justify-between px-3">
<Paragraph variant="small/bright" className="w-full border-b border-grid-dimmed py-2">
{title}
</Paragraph>
</div>
Expand Down
76 changes: 44 additions & 32 deletions apps/webapp/app/components/code/JSONEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,39 +107,51 @@ export function JSONEditor(opts: JSONEditorProps) {
}, 1500);
}, [view]);

const showButtons = showClearButton || showCopyButton;

return (
<div className={cn(opts.className, "grid grid-rows-[2.5rem_1fr]")}>
<div className="mx-3 flex items-center justify-end gap-2 border-b border-grid-dimmed">
{showClearButton && (
<Button
type="button"
variant="minimal/small"
TrailingIcon={TrashIcon}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
clear();
}}
>
Clear
</Button>
)}
{showCopyButton && (
<Button
type="button"
variant="minimal/small"
TrailingIcon={copied ? CheckIcon : ClipboardIcon}
trailingIconClassName={copied ? "text-green-500 group-hover:text-green-500" : undefined}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
copy();
}}
>
Copy
</Button>
)}
</div>
<div
className={cn(
opts.className,
"grid",
showButtons ? "grid-rows-[2.5rem_1fr]" : "grid-rows-[1fr]"
)}
>
{showButtons && (
<div className="mx-3 flex items-center justify-end gap-2 border-b border-grid-dimmed">
{showClearButton && (
<Button
type="button"
variant="minimal/small"
TrailingIcon={TrashIcon}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
clear();
}}
>
Clear
</Button>
)}
{showCopyButton && (
<Button
type="button"
variant="minimal/small"
TrailingIcon={copied ? CheckIcon : ClipboardIcon}
trailingIconClassName={
copied ? "text-green-500 group-hover:text-green-500" : undefined
}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
copy();
}}
>
Copy
</Button>
)}
</div>
)}
<div
className="w-full overflow-auto"
ref={editor}
Expand Down
3 changes: 2 additions & 1 deletion apps/webapp/app/components/primitives/PageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { LoadingBarDivider } from "./LoadingBarDivider";
import { NamedIcon } from "./NamedIcon";
import { Paragraph } from "./Paragraph";
import { Tabs, TabsProps } from "./Tabs";
import { ReactNode } from "react";

type WithChildren = {
children: React.ReactNode;
Expand All @@ -34,7 +35,7 @@ export function NavBar({ children }: WithChildren) {
}

type PageTitleProps = {
title: string;
title: ReactNode;
backButton?: {
to: string;
text: string;
Expand Down
53 changes: 22 additions & 31 deletions apps/webapp/app/components/primitives/PropertyTable.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
import { ReactNode } from "react";
import { type ReactNode } from "react";
import { Paragraph } from "./Paragraph";
import { cn } from "~/utils/cn";

export function PropertyTable({
children,
className,
}: {
type ChildrenClassName = {
children: ReactNode;
className?: string;
}) {
return (
<div className={cn("grid grid-cols-[auto,1fr] items-center gap-x-4 gap-y-2", className)}>
{children}
</div>
);
};

function PropertyTable({ children, className }: { children: ReactNode; className?: string }) {
return <div className={cn("flex flex-col gap-y-3", className)}>{children}</div>;
}

export type PropertyProps = {
label: ReactNode;
labelClassName?: string;
children: ReactNode;
};
function PropertyItem({ children, className }: ChildrenClassName) {
return <div className={cn("flex flex-col gap-0 text-sm", className)}>{children}</div>;
}

export function Property({ label, labelClassName, children }: PropertyProps) {
return (
<>
<div className={labelClassName}>
{typeof label === "string" ? <Paragraph variant="small">{label}</Paragraph> : label}
</div>
<div>
{typeof children === "string" ? (
<Paragraph variant="small/bright">{children}</Paragraph>
) : (
children
)}
</div>
</>
);
function PropertyLabel({ children, className }: ChildrenClassName) {
return <div className={cn("font-medium text-text-bright", className)}>{children}</div>;
}

function PropertyValue({ children, className }: ChildrenClassName) {
return <div className={cn("text-text-dimmed", className)}>{children}</div>;
}

export {
PropertyTable as Table,
PropertyItem as Item,
PropertyLabel as Label,
PropertyValue as Value,
};
Loading
Loading