Skip to content

Commit 9ac99dd

Browse files
committed
make text smaller for +7 metrics nodes
1 parent e1168ba commit 9ac99dd

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

spark-ui/src/components/SqlFlow/MetricDisplay.tsx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,35 @@ interface MetricDisplayProps {
1717
}
1818

1919
const MetricDisplay: React.FC<MetricDisplayProps> = ({ metrics }) => {
20+
const handleWheel = (e: React.WheelEvent) => {
21+
// Always prevent React Flow from handling wheel events in this area
22+
e.stopPropagation();
23+
24+
// Let the browser handle the scrolling naturally
25+
// Don't prevent default - we want normal scroll behavior
26+
};
27+
28+
// Use compact styles when there are more than 7 metrics
29+
const isCompact = metrics.length > 7;
30+
const metricItemClass = isCompact ? styles.metricItemCompact : styles.metricItem;
31+
const metricNameClass = isCompact ? styles.metricNameCompact : styles.metricName;
32+
const metricValueClass = isCompact ? styles.metricValueCompact : styles.metricValue;
33+
2034
return (
21-
<Box className={styles.nodeContent}>
35+
<Box
36+
className={`${styles.nodeContent} nopan nodrag`}
37+
onWheel={handleWheel}
38+
sx={{
39+
display: 'flex',
40+
flexDirection: 'column',
41+
flex: 1,
42+
minHeight: 0, // Important for flex scrolling
43+
overflowY: 'auto !important',
44+
overflowX: 'hidden',
45+
height: '100%',
46+
maxHeight: '100%'
47+
}}
48+
>
2249
{metrics.map((metric, index) => (
2350
<ConditionalWrapper
2451
key={`${metric.name}-${index}`}
@@ -34,17 +61,17 @@ const MetricDisplay: React.FC<MetricDisplayProps> = ({ metrics }) => {
3461
}
3562
>
3663
<Box
37-
className={styles.metricItem}
64+
className={metricItemClass}
3865
sx={
3966
metric.showBlock
4067
? { justifyContent: "center", alignItems: "center", flexDirection: "column" }
4168
: { display: "flex", alignItems: "flex-start", flexDirection: "row" }
4269
}
4370
>
44-
<Typography className={styles.metricName} variant="body2">
71+
<Typography className={metricNameClass} variant="body2">
4572
{metric.name}:
4673
</Typography>
47-
<Typography className={styles.metricValue} variant="body2">
74+
<Typography className={metricValueClass} variant="body2">
4875
{metric.value}
4976
</Typography>
5077
</Box>

spark-ui/src/components/SqlFlow/node-style.module.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,36 @@
134134
line-height: 1.2;
135135
}
136136

137+
/* Compact metric styles for when there are more than 7 metrics */
138+
.metricItemCompact {
139+
margin-bottom: 2px;
140+
padding: 2px 4px;
141+
border-radius: 3px;
142+
background: rgba(63, 81, 181, 0.08);
143+
border-left: 1px solid #3f51b5;
144+
transition: background-color 0.2s ease;
145+
}
146+
147+
.metricItemCompact:hover {
148+
background: rgba(63, 81, 181, 0.12);
149+
}
150+
151+
.metricNameCompact {
152+
font-weight: 600 !important;
153+
color: #3f51b5 !important;
154+
font-size: 10px !important; /* Smaller font size */
155+
text-transform: capitalize;
156+
line-height: 1.1;
157+
}
158+
159+
.metricValueCompact {
160+
color: #424242 !important;
161+
font-size: 10px !important; /* Smaller font size */
162+
word-break: break-word;
163+
margin-left: 2px !important;
164+
line-height: 1.1;
165+
}
166+
137167
/* Footer section for icons and controls */
138168
.nodeFooter {
139169
padding: 6px 12px;

0 commit comments

Comments
 (0)