codeant-ai-for-open-source[bot] commented on code in PR #37403:
URL: https://github.com/apache/superset/pull/37403#discussion_r2745075636
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx:
##########
@@ -243,10 +243,12 @@ function createAxisControl(axis: 'x' | 'y'):
ControlSetRow[] {
name: 'truncateYAxis',
config: {
type: 'CheckboxControl',
- label: t('Truncate Axis'),
+ label: t('Truncate Y Axis'),
Review Comment:
**Suggestion:** Logic bug: the control's label is hardcoded to "Truncate Y
Axis" but this control is emitted for both X and Y axis sections
(createAxisControl is called with 'x' and 'y'), so the X Axis section may
display a misleading "Truncate Y Axis" label; make the label axis-aware by
choosing "Truncate X Axis" or "Truncate Y Axis" based on the `axis` parameter.
[logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ X Axis subsection shows wrong label text.
- ⚠️ Users may misconfigure axis truncation settings.
- ⚠️ Chart Options UI consistency degraded.
```
</details>
```suggestion
label: t(axis === 'x' ? 'Truncate X Axis' : 'Truncate Y Axis'),
```
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Open file
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
and locate the truncate control at lines shown in the PR: the label line at
246 (see "246
label: t('Truncate Y Axis'),"). The control is defined inside function
createAxisControl(axis: 'x' | 'y').
2. In the same file, find the control panel config where
createAxisControl('x') is invoked
(Chart Options → X Axis subsection). The X-axis subsection includes the
output of
createAxisControl('x') (the call is present in the config's controlSetRows).
3. Start the frontend dev server and open the Bar chart control panel,
choose the Chart
Options → X Axis subsection while the chart is set to a horizontal
orientation (visibility
condition: isHorizontal(controls) triggers the control). The control renders
with the
label text from line 246.
4. Observe the visible label reads "Truncate Y Axis" even though you're
inspecting the X
Axis subsection — this is caused by the hardcoded string at
controlPanel.tsx:246 inside
createAxisControl, and is reproducible whenever createAxisControl('x') is
rendered (e.g.,
horizontal bar orientation). The mismatch is a UX/label bug rather than a
runtime crash.
```
</details>
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
**Line:** 246:246
**Comment:**
*Logic Error: Logic bug: the control's label is hardcoded to "Truncate
Y Axis" but this control is emitted for both X and Y axis sections
(createAxisControl is called with 'x' and 'y'), so the X Axis section may
display a misleading "Truncate Y Axis" label; make the label axis-aware by
choosing "Truncate X Axis" or "Truncate Y Axis" based on the `axis` parameter.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]