bito-code-review[bot] commented on code in PR #38695:
URL: https://github.com/apache/superset/pull/38695#discussion_r3555888633


##########
superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/controlPanel.test.ts:
##########
@@ -0,0 +1,98 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { ControlPanelsContainerProps } from 
'@superset-ui/chart-controls/types';
+import controlPanel from '../../src/MixedTimeseries/controlPanel';

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Extract duplicated test utility function</b></div>
   <div id="fix">
   
   Note: Syntactic duplication identified in test files. The getControl helper 
function and getStandardizedControls mock appear in 7 controlPanel.test.ts 
files across MixedTimeseries and Timeseries subdirectories (lines 20-43 range). 
Suggest extracting to a shared test utility to improve maintainability.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #5e7a25</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts:
##########
@@ -84,6 +84,28 @@ export type EchartsMixedTimeseriesFormData = QueryFormData & 
{
   seriesTypeB: EchartsTimeseriesSeriesType;
   showValue: boolean;
   showValueB: boolean;
+  labelPosition?:
+    | 'auto'
+    | 'top'
+    | 'bottom'
+    | 'left'
+    | 'right'
+    | 'inside'
+    | 'insideTop'
+    | 'insideBottom'
+    | 'insideLeft'
+    | 'insideRight';
+  labelPositionB?:
+    | 'auto'
+    | 'top'
+    | 'bottom'
+    | 'left'
+    | 'right'
+    | 'inside'
+    | 'insideTop'
+    | 'insideBottom'
+    | 'insideLeft'
+    | 'insideRight';

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Type-UI mismatch for labelPosition</b></div>
   <div id="fix">
   
   The `labelPosition` union type defines 10 options including 'insideTop', 
'insideBottom', 'insideLeft', 'insideRight', but `controlPanel.tsx` line 
212-217 only exposes 6 choices ('auto', 'top', 'inside', 'bottom', 'left', 
'right'). Users cannot select the 'inside*' variants through UI despite them 
being valid in the type. Align the type definition with what the UI actually 
supports.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #5e7a25</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -697,6 +697,146 @@ describe('Does transformProps transform series 
correctly', () => {
     });
   });
 
+  test('should respect labelPosition configuration', () => {
+    const chartProps = createTestChartProps({
+      formData: {
+        ...formData,
+        labelPosition: 'insideBottom',
+      },
+      queriesData,
+    });
+
+    const transformedSeries = transformProps(chartProps).echartOptions
+      .series as any[];
+
+    transformedSeries.forEach(series => {
+      expect(series.label.position).toBe('insideBottom');
+      expect(series.label.overflow).toBeUndefined();
+    });
+  });
+
+  test('should default to top when labelPosition is auto and orientation is 
vertical', () => {
+    const chartProps = createTestChartProps({
+      formData: {
+        ...formData,
+        labelPosition: 'auto',
+        orientation: OrientationType.Vertical,
+      },
+      queriesData,
+    });
+
+    const transformedSeries = transformProps(chartProps).echartOptions
+      .series as any[];
+
+    transformedSeries.forEach(series => {
+      expect(series.label.position).toBe('top');
+      expect(series.label.overflow).toBeUndefined();
+    });
+  });
+
+  test('should default to right when labelPosition is auto and orientation is 
horizontal', () => {
+    const chartProps = createTestChartProps({
+      formData: {
+        ...formData,
+        labelPosition: 'auto',

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Consolidate duplicated test assertions</b></div>
   <div id="fix">
   
   Note: Syntactic duplication found in transformProps.test.ts. The series 
label assertions (checking position='right' and overflow=undefined) are 
duplicated at lines 741-756 and 760-775. Suggest consolidating into a shared 
test helper.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #5e7a25</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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]

Reply via email to