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

fix: Formatting Rule Doesn't use default set by user #1547

Merged
merged 6 commits into from
Oct 4, 2023

Conversation

Zhou-Ziheng
Copy link
Contributor

@Zhou-Ziheng Zhou-Ziheng commented Sep 25, 2023

  • Default Formatting Rule should change depending on the defaults set by the user
  • Changing columnType should fill the input with the default string
    * Pressing enter on empty formatting string input fields should fill the input with the default string
    * Updated eslint config to handle lines ending in CRLF correctly

@Zhou-Ziheng Zhou-Ziheng self-assigned this Sep 25, 2023
@Zhou-Ziheng Zhou-Ziheng requested a review from mofojed September 25, 2023 18:14
Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

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

Some questions for Don, and make sure we don't screw up line endings.

Comment on lines 19 to 21
{
endOfLine: 'auto',
},
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't be changing the endOfLine default, we want to keep it to lf instead of crlf. Might need to configure something on Windows so that line endings are handled correctly in git.

@@ -617,7 +617,7 @@ export class FormattingSectionContent extends PureComponent<
checked={truncateNumbersWithPound ?? null}
onChange={this.handleTruncateNumbersWithPoundChange}
>
Truncate numbers with #
Show truncated numbers as ###
Copy link
Member

Choose a reason for hiding this comment

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

A contextual help bubble could be useful here... I think the phrase "Mask truncated numbers with ###" may be better as well, @dsmmcken any opinion?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am fine with this suggestion. Using the word show is more consistent wit the other labels, like "Show T seperator", and I like the multiple hashtags in the label. It's a bit long now is my only complaint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what about Show truncation as ###

Copy link
Contributor

Choose a reason for hiding this comment

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

It only applies to numbers though

defaultFormatString ?? IntegerColumnFormatter.DEFAULT_FORMAT_STRING
}
onKeyDown={e => {
if (e.key === 'Enter' && value === '') {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I like this - it's kind of hidden functionality that is difficult for the user to find. Granted, I don't know a better way to start with the default/edit it, other than copying pasting from above.
@dsmmcken Do you have any ideas for creating a new rule based off the default but edited slightly?

Copy link
Contributor

Choose a reason for hiding this comment

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

We could just set it to the initial value instead of a placeholder.

@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (d796f83) 46.42% compared to head (c039d56) 46.38%.
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1547      +/-   ##
==========================================
- Coverage   46.42%   46.38%   -0.05%     
==========================================
  Files         558      564       +6     
  Lines       35714    35810      +96     
  Branches     8916     8969      +53     
==========================================
+ Hits        16582    16612      +30     
- Misses      19082    19146      +64     
- Partials       50       52       +2     
Flag Coverage Δ
unit 46.38% <91.30%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...e-studio/src/settings/FormattingSectionContent.tsx 62.69% <ø> (ø)
...udio/src/settings/ColumnSpecificSectionContent.tsx 97.31% <91.30%> (-0.85%) ⬇️

... and 35 files with indirect coverage changes

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

Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

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

Looks good overall. Just a very minor cleanup.

@@ -221,7 +212,7 @@ export class ColumnSpecificSectionContent extends PureComponent<
let resetKeys = {};
if (key === 'columnType') {
resetKeys = {
format: '',
format: this.makeDefaultFormatterItemByType(value as string),
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if there's a way using function overloading and/or generics to correct this so you don't need to cast it: https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads

Figuring that out isn't really necessary for this though.

Comment on lines 432 to 434
const onTypeChange = (e: ChangeEvent<HTMLSelectElement>): void => {
this.handleFormatRuleChange(i, 'columnType', e.target.value);
};
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why you added these here - handleFormatRuleChange doesn't return anything, so you can keep the shorthand. Or update the onNameChange and onNameBlur declarations to match for consistency.

@Zhou-Ziheng Zhou-Ziheng requested a review from mofojed October 4, 2023 03:02
@mofojed
Copy link
Member

mofojed commented Oct 4, 2023

@Zhou-Ziheng good work. We need to port the same fix over to Enterprise as well (Settings menu isn't shared currently - that would be another task that would be sweet).

@Zhou-Ziheng Zhou-Ziheng merged commit ce51229 into deephaven:main Oct 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants