Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(site): updateuseAgentLogs to make it more testable and add more tests#19126

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Parkreiner merged 62 commits intomainfrommes/logs-flake
Sep 17, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
62 commits
Select commitHold shift + click to select a range
d6e00c3
wip: commit progress on test update
ParkreinerMay 23, 2025
43d0ca8
refactor: update useAgentLogs tests as unit tests
ParkreinerMay 23, 2025
727bddd
docs: rewrite comment for clarity
ParkreinerMay 23, 2025
d46d144
fix: remove unnecessary type
ParkreinerMay 23, 2025
91a6fc1
fix: make sure logs have different timestamps
ParkreinerMay 23, 2025
ecbe7b0
fix: add different dates to reduce risk of false positives
ParkreinerMay 23, 2025
d13bcdc
Merge branch 'main' into mes/logs-flake
ParkreinerMay 23, 2025
0f21097
Merge branch 'main' into mes/logs-flake
ParkreinerAug 2, 2025
abd6553
refactor: decrease coupling
ParkreinerAug 2, 2025
bade97a
wip: commit progress on updating flake
ParkreinerAug 2, 2025
e11fefd
Merge branch 'mes/logs-flake' of https://github.com/coder/coder into …
ParkreinerAug 2, 2025
bc3d095
fix: get all tests passing
ParkreinerAug 2, 2025
550d09e
chore: add one more test case
ParkreinerAug 2, 2025
cc7e632
fix: update type mismatches
ParkreinerAug 2, 2025
79c7ffd
refactor: clean up some code
ParkreinerAug 2, 2025
43a0d3a
fix: make testing boundaries more formal
ParkreinerAug 2, 2025
982d3e1
fix: remove premature optimization
ParkreinerAug 2, 2025
41c5a12
fix: update setup
ParkreinerAug 4, 2025
42cb73b
fix: update state sync logic
ParkreinerAug 4, 2025
3a5f7bb
Merge branch 'main' into mes/logs-flake
ParkreinerAug 4, 2025
35a40df
fix: update wonky types
ParkreinerAug 4, 2025
306dbc7
Merge branch 'main' into mes/logs-flake
ParkreinerAug 4, 2025
f49e55a
Merge branch 'main' into mes/logs-flake
ParkreinerAug 7, 2025
c2fc772
fix: update tests
ParkreinerAug 7, 2025
2cabd85
fix: format
ParkreinerAug 7, 2025
855f3ca
Merge branch 'main' into mes/logs-flake
ParkreinerAug 9, 2025
453894b
fix: apply initial feedback
ParkreinerAug 9, 2025
c9f2b12
wip: commit refactoring progress
ParkreinerAug 9, 2025
80865fe
refactor: update assignment
ParkreinerAug 9, 2025
f930b29
wip: prepare to change indents
ParkreinerAug 9, 2025
a311ac9
fix: update keygen logic
ParkreinerAug 9, 2025
5657536
chore: add basic overflow message
ParkreinerAug 9, 2025
6547a2f
chore: swap to tailwind
ParkreinerAug 9, 2025
c818aec
wip: commit progress
ParkreinerAug 12, 2025
30bb008
Merge branch 'main' into mes/logs-flake
ParkreinerAug 15, 2025
dac3828
refactor: switch to spy setup
ParkreinerAug 15, 2025
7a013d3
fix: get scaffolding for new AgentLogs in place
ParkreinerAug 15, 2025
b71d051
fix: remove bad import
ParkreinerAug 15, 2025
092c4e5
fix: knip
ParkreinerAug 15, 2025
cdc1053
Merge branch 'main' into mes/logs-flake
ParkreinerSep 10, 2025
36ce507
refactor: clean up code
ParkreinerSep 10, 2025
0d4f353
fix: apply fixes
ParkreinerSep 10, 2025
205a177
refactor: clean up AgentLogs
ParkreinerSep 10, 2025
6b87fb0
fix: move overflow indicator to bottom
ParkreinerSep 10, 2025
18fe749
fix: adjust max height for logs
ParkreinerSep 10, 2025
0b0054e
fix: update layout for AgentLogs
ParkreinerSep 10, 2025
9dd217b
fix: add CVA to Intellisense
ParkreinerSep 10, 2025
ccc50d4
fix: add missing border variants
ParkreinerSep 10, 2025
3a5ec3e
fix: add missing styles
ParkreinerSep 10, 2025
8ecf774
fix: resolve fragment flag
ParkreinerSep 10, 2025
1321d15
fix: update type signatures
ParkreinerSep 10, 2025
364ca84
fix: revert border color changes
ParkreinerSep 10, 2025
4a74eb6
fix: add missing dark mode colors
ParkreinerSep 10, 2025
2bb2045
Merge branch 'main' into mes/logs-flake
ParkreinerSep 16, 2025
4e3e0b9
fix: revert code formatting
ParkreinerSep 16, 2025
84ef45c
fix: make latency less janky
ParkreinerSep 16, 2025
e8eed06
fix: remove unused import
ParkreinerSep 16, 2025
efc7d09
Merge branch 'main' into mes/logs-flake
ParkreinerSep 17, 2025
de445d7
fix: update default border styles
ParkreinerSep 17, 2025
248ebc7
fix: update default styles for badge
ParkreinerSep 17, 2025
b4f8041
fix: update sizing for proxy menu
ParkreinerSep 17, 2025
42cc91b
fix: update styling for open proxy menu
ParkreinerSep 17, 2025
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
1 change: 1 addition & 0 deletions.vscode/settings.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,6 +54,7 @@
}
},

"tailwindCSS.classFunctions": ["cva", "cn"],
"[css][html][markdown][yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
Expand Down
6 changes: 4 additions & 2 deletionssite/src/components/Alert/ErrorAlert.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,9 +4,11 @@ import type { FC } from "react";
import { Link } from "../Link/Link";
import { Alert, AlertDetail, type AlertProps } from "./Alert";

export const ErrorAlert: FC<
type ErrorAlertProps = Readonly<
Omit<AlertProps, "severity" | "children"> & { error: unknown }
> = ({ error, ...alertProps }) => {
>;

export const ErrorAlert: FC<ErrorAlertProps> = ({ error, ...alertProps }) => {
const message = getErrorMessage(error, "Something went wrong.");
const detail = getErrorDetail(error);
const status = getErrorStatus(error);
Expand Down
18 changes: 18 additions & 0 deletionssite/src/components/Badge/Badge.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,24 @@ export const Warning: Story = {
},
};

exportconstDestructive:Story={
args:{
variant:"destructive",
},
};

exportconstInfo:Story={
args:{
variant:"info",
},
};

exportconstGreen:Story={
args:{
variant:"green",
},
};
Comment on lines +24 to +40
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Some of our styling for theBadge component was jacked, and we just never caught it because we never made stories for the variants


exportconstSmallWithIcon:Story={
args:{
variant:"default",
Expand Down
6 changes: 3 additions & 3 deletionssite/src/components/Badge/Badge.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,8 +23,8 @@ const badgeVariants = cva(
destructive:
"border border-solid border-border-destructive bg-surface-red text-highlight-red shadow",
green:
"border border-solid border-surface-green bg-surface-green text-highlight-green shadow",
info: "border border-solid border-surface-sky bg-surface-sky text-highlight-sky shadow",
"border border-solid border-border-green bg-surface-green text-highlight-green shadow",
info: "border border-solid border-border-sky bg-surface-sky text-highlight-sky shadow",
},
size: {
xs: "text-2xs font-regular h-5 [&_svg]:hidden rounded px-1.5",
Expand All@@ -50,7 +50,7 @@ const badgeVariants = cva(
defaultVariants: {
variant: "default",
size: "md",
border: "solid",
border: "none",
hover: false,
},
},
Expand Down
17 changes: 17 additions & 0 deletionssite/src/components/Latency/Latency.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { screen, userEvent, within } from "storybook/test";
import { Latency } from "./Latency";

const meta: Meta<typeof Latency> = {
Expand DownExpand Up@@ -32,3 +33,19 @@ export const Loading: Story = {
isLoading: true,
},
};

export const NoLatency: Story = {
args: {
latency: undefined,
},

play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const tooltipTrigger = canvas.getByLabelText(/Latency not available/i);
await userEvent.hover(tooltipTrigger);

// Need to await getting the tooltip because the tooltip doesn't open
// immediately on hover
await screen.findByRole("tooltip", { name: /Latency not available/i });
},
};
31 changes: 17 additions & 14 deletionssite/src/components/Latency/Latency.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,54 @@
import { useTheme } from "@emotion/react";
import CircularProgress from "@mui/material/CircularProgress";
import Tooltip from "@mui/material/Tooltip";
import { visuallyHidden } from "@mui/utils";
import { Abbr } from "components/Abbr/Abbr";
import { CircleHelpIcon } from "lucide-react";
import type { FC } from "react";
import { cn } from "utils/cn";
import { getLatencyColor } from "utils/latency";

interface LatencyProps {
latency?: number;
isLoading?: boolean;
size?: number;
className?: string;
iconClassName?: string;
}

export const Latency: FC<LatencyProps> = ({
latency,
isLoading,
size = 14,
className,
iconClassName,
}) => {
const theme = useTheme();
// Always use the no latency color for loading.
const color = getLatencyColor(theme, isLoading ? undefined : latency);

if (isLoading) {
return (
<Tooltip title="Loading latency...">
<CircularProgress size={size} className="ml-auto" style={{ color }} />
<Tooltip title="Loading latency..." className={className}>
<CircularProgress
className={cn("!size-icon-xs", iconClassName)}
style={{ color }}
/>
</Tooltip>
);
}

if (!latency) {
const notAvailableText = "Latency not available";
return (
<Tooltip title={notAvailableText}>
<>
<span css={{ ...visuallyHidden }}>{notAvailableText}</span>

<CircleHelpIcon className="ml-auto size-icon-sm" style={{ color }} />
</>
<Tooltip title="Latency not available" className={className}>
<CircleHelpIcon
className={cn("!size-icon-sm", iconClassName)}
style={{ color }}
/>
</Tooltip>
);
}

return (
<div className="ml-autotext-sm" style={{ color }}>
<spancss={{ ...visuallyHidden }}>Latency: </span>
<div className={cn("text-sm", className)} style={{ color }}>
<spanclassName="sr-only">Latency: </span>
{latency.toFixed(0)}
<Abbr title="milliseconds">ms</Abbr>
</div>
Expand Down
3 changes: 1 addition & 2 deletionssite/src/hooks/useEmbeddedMetadata.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -229,13 +229,12 @@ export function makeUseEmbeddedMetadata(
manager.getMetadata,
);

// biome-ignore lint/correctness/useExhaustiveDependencies(manager.clearMetadataByKey): baked into containing hook
const stableMetadataResult = useMemo<UseEmbeddedMetadataResult>(() => {
return {
metadata,
clearMetadataByKey: manager.clearMetadataByKey,
};
}, [metadata]);
}, [manager,metadata]);

return stableMetadataResult;
};
Expand Down
4 changes: 4 additions & 0 deletionssite/src/index.css
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,6 +32,8 @@
--surface-purple: 251 91% 95%;
--border-default: 240 6% 90%;
--border-success: 142 76% 36%;
--border-sky: 203 90% 40%;
--border-green: 138 82% 82%;
--border-warning: 30.66, 97.16%, 72.35%;
--border-destructive: 0 84% 60%;
--border-hover: 240 5% 34%;
Expand DownExpand Up@@ -75,6 +77,8 @@
--border-success: 142 76% 36%;
--border-warning: 30.66, 97.16%, 72.35%;
--border-destructive: 0 91% 71%;
--border-sky: 194 90% 62%;
--border-green: 143 77% 87%;
--border-hover: 240, 5%, 34%;
--overlay-default: 240 10% 4% / 80%;
--highlight-purple: 252 95% 85%;
Expand Down
2 changes: 1 addition & 1 deletionsite/src/modules/dashboard/Navbar/MobileMenu.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -162,7 +162,7 @@ const ProxySettingsSub: FC<ProxySettingsSubProps> = ({ proxyContextValue }) => {
<img className="w-4 h-4" src={p.icon_url} alt={p.name} />
{p.display_name || p.name}
{latency ? (
<Latency latency={latency.latencyMS} />
<LatencyclassName="ml-auto"latency={latency.latencyMS} />
) : (
<CircleHelpIcon className="ml-auto" />
)}
Expand Down
2 changes: 1 addition & 1 deletionsite/src/modules/dashboard/Navbar/ProxyMenu.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -92,7 +92,6 @@ export const ProxyMenu: FC<ProxyMenuProps> = ({ proxyContextValue }) => {
<Latency
latency={latencies?.[selectedProxy.id]?.latencyMS}
isLoading={proxyLatencyLoading(selectedProxy)}
size={24}
/>
</>
) : (
Expand DownExpand Up@@ -191,6 +190,7 @@ export const ProxyMenu: FC<ProxyMenuProps> = ({ proxyContextValue }) => {
{proxy.display_name}

<Latency
className="ml-auto"
latency={latencies?.[proxy.id]?.latencyMS}
isLoading={proxyLatencyLoading(proxy)}
/>
Expand Down
10 changes: 8 additions & 2 deletionssite/src/modules/resources/AgentLogs/AgentLogs.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ const meta: Meta<typeof AgentLogs> = {
sources: MockSources,
logs: MockLogs,
height: MockLogs.length * AGENT_LOG_LINE_HEIGHT,
overflowed: false,
},
parameters: {
layout: "fullscreen",
Expand All@@ -19,6 +20,11 @@ const meta: Meta<typeof AgentLogs> = {
export default meta;
type Story = StoryObj<typeof AgentLogs>;

const Default: Story = {};
exportconst Default: Story = {};

export { Default as AgentLogs };
export const Overflowed: Story = {
args: {
className: "max-h-[420px]",
overflowed: true,
},
};
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp