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

Commit6f0ba5b

Browse files
chore(site): add AgentLogs storybook (#12601)
1 parent25b605f commit6f0ba5b

File tree

7 files changed

+1178
-16
lines changed

7 files changed

+1178
-16
lines changed

‎site/src/modules/resources/AgentLogLine.tsxrenamed to‎site/src/modules/resources/AgentLogs/AgentLogLine.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ import AnsiToHTML from "ansi-to-html";
33
import{typeFC,typeReactNode,useMemo}from"react";
44
import{typeLine,LogLine,LogLinePrefix}from"components/Logs/LogLine";
55

6+
// Logs are stored as the Line interface to make rendering
7+
// much more efficient. Instead of mapping objects each time, we're
8+
// able to just pass the array of logs to the component.
9+
exportinterfaceLineWithIDextendsLine{
10+
id:number;
11+
}
12+
13+
// Approximate height of a log line. Used to control virtualized list height.
14+
exportconstAGENT_LOG_LINE_HEIGHT=20;
15+
616
constconvert=newAnsiToHTML();
717

818
interfaceAgentLogLineProps{
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
importtype{Meta,StoryObj}from"@storybook/react";
2+
import{AGENT_LOG_LINE_HEIGHT}from"./AgentLogLine";
3+
import{AgentLogs}from"./AgentLogs";
4+
import{MockLogs,MockSources}from"./mocks";
5+
6+
constmeta:Meta<typeofAgentLogs>={
7+
title:"modules/resources/AgentLogs",
8+
component:AgentLogs,
9+
args:{
10+
sources:MockSources,
11+
logs:MockLogs,
12+
height:MockLogs.length*AGENT_LOG_LINE_HEIGHT,
13+
},
14+
parameters:{
15+
layout:"fullscreen",
16+
},
17+
};
18+
19+
exportdefaultmeta;
20+
typeStory=StoryObj<typeofAgentLogs>;
21+
22+
constDefault:Story={};
23+
24+
export{DefaultasAgentLogs};

‎site/src/modules/resources/AgentLogs.tsxrenamed to‎site/src/modules/resources/AgentLogs/AgentLogs.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ import {
1010
import{FixedSizeListasList}from"react-window";
1111
import*asAPIfrom"api/api";
1212
importtype{WorkspaceAgentLogSource}from"api/typesGenerated";
13-
import{AgentLogLine}from"./AgentLogLine";
14-
import{AGENT_LOG_LINE_HEIGHT,typeLineWithID}from"./AgentRow";
13+
import{
14+
AGENT_LOG_LINE_HEIGHT,
15+
AgentLogLine,
16+
typeLineWithID,
17+
}from"./AgentLogLine";
1518

1619
typeAgentLogsProps=Omit<
1720
ComponentProps<typeofList>,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp