Skip to content

ui: convert core class components to functional components#162114

Merged
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
jasonlmfong:jf/console-core-func
Feb 10, 2026
Merged

ui: convert core class components to functional components#162114
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
jasonlmfong:jf/console-core-func

Conversation

@jasonlmfong
Copy link
Copy Markdown
Member

@jasonlmfong jasonlmfong commented Jan 30, 2026

This change converts the following class components into their functional style equivalent:

  • sortedtable
  • outsideEventHandler
  • columnsSelector
  • dropdown
  • queryFilter
  • search

The conversion was done by iteratively using a claude skill with no additional human
intervention needed.
Existing Enzyme + Chai tests were converted into pure react-testing-library tests.
Additional tests were also created by claude for the following components:

  • columnsSelector
  • dropdown
  • search

The following pages import the modified components and were manually verified:

  • sql-activity
  • insights
  • databases
  • jobs
  • schedules
  • statement details
  • events

Epic: CRDB-58145
Release Note: None

@jasonlmfong jasonlmfong requested a review from a team as a code owner January 30, 2026 22:29
@jasonlmfong jasonlmfong requested review from kyle-a-wong and removed request for a team January 30, 2026 22:29
@blathers-crl
Copy link
Copy Markdown

blathers-crl Bot commented Jan 30, 2026

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@jasonlmfong jasonlmfong force-pushed the jf/console-core-func branch 2 times, most recently from 7aff7a7 to d63fed7 Compare February 2, 2026 20:11
Copy link
Copy Markdown
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

@dhartunian reviewed all commit messages and made 3 comments.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jasonlmfong and @kyle-a-wong).


-- commits line 11 at r1:
This commit message needs a bit more context. You're converting class components to functional syntax.

Mention if any specific component had challenges or needed special treatment.
Mention what the test coverage situation is.

How did you verify that this was successful? Even if it's some screenshots of each of these in the existing app, that would be adequate.


pkg/ui/workspaces/cluster-ui/src/queryFilter/filter.tsx line 449 at r1 (raw file):

        placeholder="All"
        field="app"
        onChange={handleMultiSelectChange}

can you talk about why this onChange appears and is propagated everywhere?


pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx line 187 at r1 (raw file):

};

export function SortedTable<T>({

SortedTable is a key component so making sure it doesn't break anything is important.

@jasonlmfong jasonlmfong force-pushed the jf/console-core-func branch 2 times, most recently from 7b04053 to 72529c0 Compare February 3, 2026 19:35
Copy link
Copy Markdown
Member Author

@jasonlmfong jasonlmfong left a comment

Choose a reason for hiding this comment

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

@jasonlmfong made 3 comments.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian and @kyle-a-wong).


-- commits line 11 at r1:

Previously, dhartunian (David Hartunian) wrote…

This commit message needs a bit more context. You're converting class components to functional syntax.

Mention if any specific component had challenges or needed special treatment.
Mention what the test coverage situation is.

How did you verify that this was successful? Even if it's some screenshots of each of these in the existing app, that would be adequate.

ack, added more details,


pkg/ui/workspaces/cluster-ui/src/queryFilter/filter.tsx line 449 at r1 (raw file):

Previously, dhartunian (David Hartunian) wrote…

can you talk about why this onChange appears and is propagated everywhere?

we replaced the parent.setState({}) in the MultiSelectCheckbox, and now use the setFilters function to set the state


pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx line 187 at r1 (raw file):

Previously, dhartunian (David Hartunian) wrote…

SortedTable is a key component so making sure it doesn't break anything is important.

I tested these with both manual navigations and locally running cypress tests, functionalities seem to be unaffected
image.png
image copy 1.png

@jasonlmfong jasonlmfong force-pushed the jf/console-core-func branch 2 times, most recently from 4270584 to 8fdc420 Compare February 5, 2026 21:15
This change converts the following class components into their functional style equivalent:
 - sortedtable
 - outsideEventHandler
 - columnsSelector
 - dropdown
 - queryFilter
 - search

The conversion was done by iteratively using a claude skill with no additional human
intervention needed.
Existing Enzyme + Chai tests were converted into pure react-testing-library tests.
Additional tests were also created by claude for the following components:
 - columnsSelector
 - dropdown
 - search

The following pages import the modified components and were manually verified:
 - sql-activity
 - insights
 - databases
 - jobs
 - schedules
 - statement details
 - events

Epic: CRDB-58145
Release Note: None
Copy link
Copy Markdown
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

:lgtm: tough to really get into the detail on each component here so we might need to do a bug bash later.

@dhartunian reviewed 5 files and all commit messages, made 1 comment, and resolved 2 discussions.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @kyle-a-wong).

@jasonlmfong
Copy link
Copy Markdown
Member Author

TFTR!

@jasonlmfong
Copy link
Copy Markdown
Member Author

/trunk merge

@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented Feb 10, 2026

😎 Merged successfully - details.

@trunk-io trunk-io Bot merged commit c868bf8 into cockroachdb:master Feb 10, 2026
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants