Skip to content

Commit 56bf9cf

Browse files
fix(site): Handle carriage on logs output (#7172)
1 parent b44e6e6 commit 56bf9cf

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

site/src/components/Logs/Logs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const LogLine: FC<{
6666
lineNumbers: Boolean(number),
6767
})
6868
const output = useMemo(() => {
69-
return convert.toHtml(line.output)
69+
return convert.toHtml(line.output.split(/\r/g).pop() as string)
7070
}, [line.output])
7171

7272
return (

site/src/components/Resources/AgentRow.stories.tsx

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ import { AgentRow, AgentRowProps } from "./AgentRow"
2020
export default {
2121
title: "components/AgentRow",
2222
component: AgentRow,
23+
args: {
24+
storybookStartupLogs: [
25+
"\x1b[91mCloning Git repository...",
26+
"\x1b[2;37;41mStarting Docker Daemon...",
27+
"\x1b[1;95mAdding some 🧙magic🧙...",
28+
"Starting VS Code...",
29+
"\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 1475 0 1475 0 0 4231 0 --:--:-- --:--:-- --:--:-- 4238",
30+
].map((line, index) => ({
31+
id: index,
32+
level: "info",
33+
output: line,
34+
time: "",
35+
})),
36+
},
2337
}
2438

2539
const Template: Story<AgentRowProps> = (args) => <AgentRow {...args} />
@@ -107,18 +121,6 @@ export const Starting = Template.bind({})
107121
Starting.args = {
108122
...Example.args,
109123
agent: MockWorkspaceAgentStarting,
110-
111-
storybookStartupLogs: [
112-
"\x1b[91mCloning Git repository...",
113-
"\x1b[2;37;41mStarting Docker Daemon...",
114-
"\x1b[1;95mAdding some 🧙magic🧙...",
115-
"Starting VS Code...",
116-
].map((line, index) => ({
117-
id: index,
118-
level: "info",
119-
output: line,
120-
time: "",
121-
})),
122124
}
123125

124126
export const Started = Template.bind({})
@@ -128,18 +130,6 @@ Started.args = {
128130
...MockWorkspaceAgentReady,
129131
startup_logs_length: 1,
130132
},
131-
132-
storybookStartupLogs: [
133-
"Cloning Git repository...",
134-
"Starting Docker Daemon...",
135-
"Adding some 🧙magic🧙...",
136-
"Starting VS Code...",
137-
].map((line, index) => ({
138-
id: index,
139-
level: "info",
140-
output: line,
141-
time: "",
142-
})),
143133
}
144134

145135
export const StartedNoMetadata = Template.bind({})

0 commit comments

Comments
 (0)