Skip to content

Commit b6db7a7

Browse files
authored
Refactor structuredLog structure and layout (#51567)
1 parent ebfc0de commit b6db7a7

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

airflow-core/src/airflow/ui/src/components/renderStructuredLog.tsx

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,6 @@ export const renderStructuredLog = ({
127127
return "";
128128
}
129129

130-
elements.push(
131-
<RouterLink
132-
id={index.toString()}
133-
key={`line_${index}`}
134-
style={{
135-
display: "inline-block",
136-
marginRight: "10px",
137-
paddingRight: "5px",
138-
textAlign: "right",
139-
userSelect: "none",
140-
WebkitUserSelect: "none",
141-
width: "3em",
142-
}}
143-
to={`${logLink}#${index}`}
144-
>
145-
{index}
146-
</RouterLink>,
147-
);
148-
149130
if (Boolean(timestamp)) {
150131
elements.push("[", <Time datetime={timestamp} key={0} />, "] ");
151132
}
@@ -179,20 +160,20 @@ export const renderStructuredLog = ({
179160
));
180161

181162
return (
182-
<details key={error.exc_type} open={true} style={{ marginLeft: "20em" }}>
183-
<summary data-testid={`summary-${error.exc_type}`}>
163+
<chakra.details key={error.exc_type} ml="20em" open={true}>
164+
<chakra.summary data-testid={`summary-${error.exc_type}`}>
184165
<chakra.span color="fg.info" cursor="pointer">
185166
{error.exc_type}: {error.exc_value}
186167
</chakra.span>
187-
</summary>
168+
</chakra.summary>
188169
{errorLines}
189-
</details>
170+
</chakra.details>
190171
);
191172
});
192173
}
193174

194175
elements.push(
195-
<chakra.span className="event" key={2} style={{ whiteSpace: "pre-wrap" }}>
176+
<chakra.span className="event" key={2} whiteSpace="pre-wrap">
196177
{addLinks(event)}
197178
</chakra.span>,
198179
);
@@ -209,14 +190,33 @@ export const renderStructuredLog = ({
209190
}
210191

211192
elements.push(
212-
<chakra.span className="event" key={3} style={{ whiteSpace: "pre-wrap" }}>
193+
<chakra.span className="event" key={3} whiteSpace="pre-wrap">
213194
{details}
214195
</chakra.span>,
215196
);
216197

217198
return (
218-
<chakra.div key={index} lineHeight={1.5}>
219-
{elements}
199+
<chakra.div display="flex" key={index} lineHeight={1.5}>
200+
<RouterLink
201+
id={index.toString()}
202+
key={`line_${index}`}
203+
style={{
204+
display: "inline-block",
205+
flexShrink: 0,
206+
marginRight: "10px",
207+
paddingRight: "5px",
208+
textAlign: "right",
209+
userSelect: "none",
210+
WebkitUserSelect: "none",
211+
width: "3em",
212+
}}
213+
to={`${logLink}#${index}`}
214+
>
215+
{index}
216+
</RouterLink>
217+
<chakra.span overflow="auto" whiteSpace="pre-wrap" width="100%">
218+
{elements}
219+
</chakra.span>
220220
</chakra.div>
221221
);
222222
};

0 commit comments

Comments
 (0)