bito-code-review[bot] commented on code in PR #35897:
URL: https://github.com/apache/superset/pull/35897#discussion_r2765600542
##########
superset-frontend/packages/superset-ui-chart-controls/src/types.ts:
##########
@@ -486,12 +486,16 @@ export type ConditionalFormattingConfig = {
toAllRow?: boolean;
toTextColor?: boolean;
useGradient?: boolean;
+ columnFormating?: string;
+ objectFormating?: string;
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Spelling Error in Field Names</b></div>
<div id="fix">
The new optional fields 'columnFormating' and 'objectFormating' appear to be
misspelled; standard English spelling is 'Formatting' with two 't's, which
matches the enum name 'ObjectFormattingEnum'. This inconsistency could confuse
developers and should be corrected for better readability.
</div>
</div>
<small><i>Code Review Run #9b57b7</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/src/explore/components/controls/ConditionalFormattingControl/constants.ts:
##########
@@ -0,0 +1,72 @@
+/**
+ * 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 { Comparator, ObjectFormattingEnum } from '@superset-ui/chart-controls';
+import { t } from '@apache-superset/core';
+
+export const operatorOptions = [
+ { value: Comparator.None, label: t('None') },
+ { value: Comparator.GreaterThan, label: '>' },
+ { value: Comparator.LessThan, label: '<' },
+ { value: Comparator.GreaterOrEqual, label: '≥' },
+ { value: Comparator.LessOrEqual, label: '≤' },
+ { value: Comparator.Equal, label: '=' },
+ { value: Comparator.NotEqual, label: '≠' },
+ { value: Comparator.Between, label: '< x <' },
+ { value: Comparator.BetweenOrEqual, label: '≤ x ≤' },
+ { value: Comparator.BetweenOrLeftEqual, label: '≤ x <' },
+ { value: Comparator.BetweenOrRightEqual, label: '< x ≤' },
+];
+
+export const stringOperatorOptions = [
+ { value: Comparator.None, label: t('None') },
+ { value: Comparator.Equal, label: '=' },
+ { value: Comparator.BeginsWith, label: t('begins with') },
+ { value: Comparator.EndsWith, label: t('ends with') },
+ { value: Comparator.Containing, label: t('containing') },
+ { value: Comparator.NotContaining, label: t('not containing') },
+];
+
+export const booleanOperatorOptions = [
+ { value: Comparator.IsNull, label: t('is null') },
+ { value: Comparator.IsTrue, label: t('is true') },
+ { value: Comparator.IsFalse, label: t('is false') },
+ { value: Comparator.IsNotNull, label: t('is not null') },
+];
+
+export const formatingOptions = [
+ {
+ value: ObjectFormattingEnum.BACKGROUND_COLOR,
+ label: 'background color',
+ },
+ {
+ value: ObjectFormattingEnum.TEXT_COLOR,
+ label: 'text color',
+ },
+ {
+ value: ObjectFormattingEnum.CELL_BAR,
+ label: 'cell bar',
+ },
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing translation wrappers</b></div>
<div id="fix">
The labels in formatingOptions ('background color', 'text color', 'cell
bar') are not wrapped with the translation function t(), unlike other option
arrays in this file. This violates the guideline to use t() for all user-facing
text labels, potentially preventing proper internationalization.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
- export const formatingOptions = [
- {
- value: ObjectFormattingEnum.BACKGROUND_COLOR,
- label: 'background color',
- },
- {
- value: ObjectFormattingEnum.TEXT_COLOR,
- label: 'text color',
- },
- {
- value: ObjectFormattingEnum.CELL_BAR,
- label: 'cell bar',
- },
- ];
+ export const formatingOptions = [
+ {
+ value: ObjectFormattingEnum.BACKGROUND_COLOR,
+ label: t('background color'),
+ },
+ {
+ value: ObjectFormattingEnum.TEXT_COLOR,
+ label: t('text color'),
+ },
+ {
- value: ObjectFormattingEnum.CELL_BAR,
- label: 'cell bar',
- },
+ value: ObjectFormattingEnum.CELL_BAR,
+ label: t('cell bar'),
+ },
+ ];
```
</div>
</details>
</div>
<small><i>Code Review Run #9b57b7</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-table/test/TableChart.test.tsx:
##########
@@ -17,6 +17,7 @@
* under the License.
*/
import '@testing-library/jest-dom';
+import { ObjectFormattingEnum } from '@superset-ui/chart-controls';
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incomplete API Migration</b></div>
<div id="fix">
The test updates use new enum-based properties for conditional formatting,
but the getColorFormatters function doesn't populate these properties in the
ColorFormatters, causing the formatting logic in TableChart.tsx to not apply.
Additionally, the property names 'columnFormating' and 'objectFormating' appear
misspelled and should be 'columnFormatting' and 'objectFormatting'. This will
result in test failures as the expected color changes won't occur.
</div>
</div>
<small><i>Code Review Run #9b57b7</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]