Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split DataGrid component into two components #698

Merged
merged 2 commits into from
Nov 16, 2023

Conversation

c-bata
Copy link
Member

@c-bata c-bata commented Nov 15, 2023

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code.
This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

  • I agree this patch may be ported to Goptuna by other Goptuna contributors.

Reference Issues/PRs

Follow-up #696

What does this implement/fix? Explain your changes.

This PR splits DataGrid component into two components, DataGrid and DataGridHeaderColumn, making it easier to introduce #696.

@c-bata c-bata marked this pull request as draft November 15, 2023 09:49
@c-bata c-bata changed the title Split DataGridHeaderColumn component Split DataGrid component into two components Nov 15, 2023
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fba9cf1) 62.88% compared to head (dcabe98) 62.88%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #698   +/-   ##
=======================================
  Coverage   62.88%   62.88%           
=======================================
  Files          35       35           
  Lines        2250     2250           
=======================================
  Hits         1415     1415           
  Misses        835      835           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@c-bata c-bata marked this pull request as ready for review November 16, 2023 01:42
@c-bata
Copy link
Member Author

c-bata commented Nov 16, 2023

@nabenabe0928 Could you review this PR?

Comment on lines +226 to +230
if (orderBy === null) {
onOrderByChange("asc")
} else {
onOrderByChange(orderBy === "desc" ? "asc" : "desc")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It could be simpler with this:

Suggested change
if (orderBy === null) {
onOrderByChange("asc")
} else {
onOrderByChange(orderBy === "desc" ? "asc" : "desc")
}
onOrderByChange(orderBy === "asc" ? "desc" : "asc"

<DataGridHeaderColumn<T>
key={column.label}
column={column}
orderBy={orderBy === columnIdx ? order : null}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we rename the orderBy in Line 54 to something like orderByColumnId as the name orderBy duplicates for two different roles?

@@ -239,6 +187,76 @@ function DataGrid<T>(props: {
)
}

function DataGridHeaderColumn<T>(props: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this name be better as this component is a header, but not column? (please correct me if I am wrong)

Suggested change
function DataGridHeaderColumn<T>(props: {
function DataGridColumnHeader<T>(props: {

@nabenabe0928 nabenabe0928 removed their assignment Nov 16, 2023
@c-bata c-bata merged commit 4741130 into optuna:main Nov 16, 2023
11 checks passed
@c-bata c-bata deleted the split-datagrid-components branch November 16, 2023 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants