Skip to content

Conversation

@SBIN2010
Copy link
Contributor

This PR is a continuation #34762 of
to expand the possibilities of conditional formatting

SUMMARY

Add flag toCellBar - apply formatting to cell bars

Cell bar formatting is applied when "Show cell bars" is enabled.

Implements the proposal mentioned in #32250

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Снимок экрана от 2025-10-30 00-39-35

TESTING INSTRUCTIONS

run test src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.test.tsx

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API
SBIN2010 and others added 30 commits October 22, 2024 23:07
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Oct 29, 2025

Code Review Agent Run #f31e6c

Actionable Suggestions - 0
Review Details
  • Files reviewed - 7 · Commit Range: 19151d1..5627662
    • superset-frontend/packages/superset-ui-chart-controls/src/types.ts
    • superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts
    • superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
    • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
    • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.test.tsx
    • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx
    • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/types.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added change:frontend Requires changing the frontend viz:charts:table Related to the Table chart labels Oct 29, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Design Inconsistent Property Naming Pattern ▹ view
Performance Missing memoization for columnTypeNumeric computation ▹ view ✅ Fix detected
Functionality Inefficient conditional property assignment ▹ view ✅ Fix detected
Functionality Inconsistent showCellBars condition between formatter and renderer ▹ view
Files scanned
File Path Reviewed
superset-frontend/src/explore/components/controls/ConditionalFormattingControl/types.ts
superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts
superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx
superset-frontend/packages/superset-ui-chart-controls/src/types.ts
superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines 59 to 63
export type ConditionalFormattingFlag = {
toAllRowCheck?: boolean;
toColorTextCheck?: boolean;
toCellBarCheck?: boolean;
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent Property Naming Pattern category Design

Tell me more
What is the issue?

The naming convention between ConditionalFormattingConfig and ConditionalFormattingFlag is inconsistent. The Config uses 'toAllRow', 'toTextColor', while the Flag uses 'toAllRowCheck', 'toColorTextCheck'.

Why this matters

Inconsistent naming patterns increase cognitive load and make the codebase harder to maintain. It also violates the principle of least surprise.

Suggested change ∙ Feature Preview

Align the naming patterns either by using the 'Check' suffix consistently or removing it entirely. Example:

export type ConditionalFormattingFlag = {
  toAllRow?: boolean;
  toTextColor?: boolean;
  toCellBar?: boolean;
};
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConditionalFormattingFlag are the types of values ​​that are passed from controlPanel.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for clarifying. Is there a specific reason for using different naming conventions between ConditionalFormattingConfig and ConditionalFormattingFlag? If not, would aligning them improve consistency?

@bito-code-review
Copy link
Contributor

Interaction Diagram by Bito
sequenceDiagram
participant User as User<br/>
participant UI as FormattingPopoverContent<br/>🔄 Updated | ●●● High
participant Panel as ControlPanel<br/>🔄 Updated | ●●○ Medium
participant Formatter as getColorFormatters<br/>🔄 Updated | ●●○ Medium
participant Chart as TableChart<br/>🔄 Updated | ●●● High
participant Types as Type Definitions<br/>🔄 Updated | ●●○ Medium
User->>UI: Configure conditional formatting
UI->>UI: Set toCellBar checkbox state
UI->>Panel: Submit formatting config with toCellBar
Panel->>Types: Use ConditionalFormattingConfig type
Panel->>Formatter: Pass config to getColorFormatters
Formatter->>Formatter: Create ColorFormatters with toCellBar property
Formatter-->>Chart: Return formatters array
Chart->>Chart: Apply toCellBar formatter to cell background
Chart-->>User: Render table with conditional cell bar colors
Loading

Critical path: User->FormattingPopoverContent->ControlPanel->getColorFormatters->TableChart

Note: The diff adds toCellBar conditional formatting feature. User configures it via UI, flows through control panel and formatter utility, then applies conditional colors to cell bar backgrounds in TableChart rendering. Upstream UI controls and downstream cell styling are updated to support this new formatting option.

@rusackas rusackas requested review from Copilot and rusackas October 30, 2025 17:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for conditional formatting with cell bars in table charts. The feature allows users to apply conditional color formatting specifically to cell bars (background bars that indicate values) for numeric columns, independent of text color and background color formatting.

  • Adds toCellBar boolean flag to conditional formatting configuration types
  • Implements UI controls for the new cell bar formatting option with mutual exclusivity from text/background formatting
  • Updates table rendering logic to apply conditional colors to cell bars

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
types.ts (explore/controls) Added toCellBar property to ConditionalFormattingConfig and ConditionalFormattingFlag types
FormattingPopoverContent.tsx Added cell bar checkbox UI with logic to disable conflicting options
FormattingPopoverContent.test.tsx Updated tests to verify cell bar option appears for numeric columns only
controlPanel.tsx Added initialization logic for toCellBar flag in control panel configuration
TableChart.tsx Implemented cell bar color application from conditional formatting
getColorFormatters.ts Added toCellBar to color formatter configuration
types.ts (chart-controls) Added toCellBar property to shared types
});

test('displays the toAllRow and toTextColor flags based on the selected numeric type operator', () => {
test('displays the toAllRow, toTextColor and toCellBar flags based on the selected numeric type operator', () => {
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space in 'toTextColor and'. Should be 'toTextColor and'.

Suggested change
test('displays the toAllRow, toTextColor and toCellBar flags based on the selected numeric type operator', () => {
test('displays the toAllRow, toTextColor and toCellBar flags based on the selected numeric type operator', () => {
Copilot uses AI. Check for mistakes.
});

test('Not displays the toAllRow and toTextColor flags', () => {
test('Not displays the toAllRow, toTextColor and toCellBar flags', () => {
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammatically incorrect test name. Should be 'Does not display' instead of 'Not displays'. Also has extra spaces before 'and' and after 'toCellBar'.

Suggested change
test('Not displays the toAllRow, toTextColor and toCellBar flags', () => {
test('Does not display the toAllRow, toTextColor and toCellBar flags', () => {
Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend packages plugins size/M viz:charts:table Related to the Table chart

1 participant