-
Notifications
You must be signed in to change notification settings - Fork 0
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
JNG-6031 fix missing enum filter translations #494
JNG-6031 fix missing enum filter translations #494
Conversation
noherczeg
commented
Nov 26, 2024
•
edited by github-actions
bot
Loading
edited by github-actions
bot
|
WalkthroughThe changes in this pull request involve updates across multiple files related to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FilterDialog
participant FilterInput
participant ViewMatterTableTableComponent
User->>FilterDialog: Open Filter
FilterDialog->>FilterInput: Render Filters
FilterInput->>FilterInput: Access enumValues
FilterInput-->>User: Display Filter Options
User->>ViewMatterTableTableComponent: Apply Filter
ViewMatterTableTableComponent->>ViewMatterTableTableComponent: Update Table Data
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (3)
judo-ui-react/src/main/resources/actor/src/components/dialog/FilterDialog.tsx.hbs (1)
Line range hint
89-106
: Consider implementing the commented-out time picker using MUI's TimePicker component.For consistency with other date/time related filters that use proper picker components, consider implementing the time filter using MUI's TimePicker component instead of TextField.
Here's a suggested implementation:
- // case FilterType.time: - // return ( - // <TextField - // className={valueId} - // label={filter.filterOption.label ?? filter.filterOption.attributeName} - // value={filter.filterBy.value} - // onChange={(event) => setFilterValue(filter, event.target.value)} - // InputProps=\{{ - // startAdornment: ( - // <InputAdornment position="start"> - // <MdiIcon path="clock-outline" /> - // </InputAdornment> - // ), - // }} - // /> - // ); + case FilterType.time: + return ( + <TimePicker + className={valueId} + label={filter.filterOption.label ?? filter.filterOption.attributeName} + value={filter.filterBy.value ?? null} + ampm={false} + views={['hours', 'minutes', 'seconds']} + onChange={(newValue) => setFilterValue(filter, newValue)} + slotProps={ { + textField: { + InputProps: { + startAdornment: ( + <InputAdornment position="start"> + <MdiIcon path="clock-outline" /> + </InputAdornment> + ), + }, + }, + } } + /> + );judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/containers/View/Matter/Table/components/ViewMatterTableTableComponent/index.tsx.snapshot (2)
174-183
: Use appropriate cell editor type for numeric fieldThe
cellEditorType
for the numericmass
field is set to'text'
, which may not provide the optimal input for numeric values. Consider using'number'
to ensure the input is appropriate for numeric data.Apply this diff to change the
cellEditorType
:return <CellEditInput {...props} error={error} cellEditorType={'text'} />; + return <CellEditInput {...props} error={error} cellEditorType={'number'} />;
152-159
: Ensure appropriate cell editor for single-select fieldFor the
type
column of type'singleSelect'
, thecellEditorType
is set to'text'
. To provide a proper editor component for single-select fields, consider using'select'
or a custom editor that supports single selection.Apply this diff to update the
cellEditorType
:return <CellEditInput {...props} error={error} cellEditorType={'text'} />; + return <CellEditInput {...props} error={error} cellEditorType={'select'} />;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
judo-ui-react-itest/ActionGroupTest/action_group_test__god/pom.xml
(1 hunks)judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/containers/View/Matter/Table/components/ViewMatterTableTableComponent/index.tsx.snapshot
(1 hunks)judo-ui-react/src/main/resources/actor/src/components-api/dialog/FilterDialog.ts.hbs
(1 hunks)judo-ui-react/src/main/resources/actor/src/components/dialog/FilterDialog.tsx.hbs
(1 hunks)judo-ui-react/src/main/resources/actor/src/fragments/table/filter-option.fragment.hbs
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- judo-ui-react-itest/ActionGroupTest/action_group_test__god/pom.xml
🔇 Additional comments (6)
judo-ui-react/src/main/resources/actor/src/fragments/table/filter-option.fragment.hbs (2)
9-9
: LGTM! Good separation of concerns between value and display text.
The new structure properly separates the enum's internal value from its display text, enabling proper internationalization while maintaining the original enum value for data operations.
9-9
: Verify translation key structure across the application.
The translation key follows the pattern enumerations.<type>.<member>
. Let's verify this convention is consistent across the codebase.
✅ Verification successful
Translation key structure follows consistent pattern across the codebase
The verification shows that the translation key pattern enumerations.<type>.<member>
is consistently used across the codebase:
- Template files (
filter-option.fragment.hbs
,column.fragment.hbs
) use the pattern correctly - Translation generation in
UiI18NHelper.java
follows the same structure - Test snapshots demonstrate consistent usage with concrete examples (e.g.,
enumerations.MatterType.dark
)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for consistency in enum translation key patterns
# Expected: All enum translations should follow the 'enumerations.<type>.<member>' pattern
# Search for translation keys in i18n files
echo "Checking translation files for enum keys:"
fd -e json -e yaml -e yml . | xargs rg '"enumerations\.' -A 1
# Search for enum translation usage in code
echo -e "\nChecking translation usage in code:"
rg "t\(['\"]enumerations\." -A 1
Length of output: 3121
judo-ui-react/src/main/resources/actor/src/components-api/dialog/FilterDialog.ts.hbs (2)
5-8
: LGTM! Well-structured interface for enum translations.
The new FilterEnumValue
interface provides a clean separation between the actual enum value and its display label, enabling proper translation support.
15-15
: LGTM! Verify enum value usage across components.
The type change from Array<string>
to Array<FilterEnumValue>
is appropriate for supporting translations.
Let's verify that all components using enum values have been updated to handle the new structure:
✅ Verification successful
All components have been updated to handle the new FilterEnumValue structure
The code analysis shows that all components using enumValues
are already handling the new FilterEnumValue
structure correctly:
FilterDialog.tsx.hbs
renders enum values usingitem.value
anditem.label
filter-option.fragment.hbs
generates the correct structure withvalue
andlabel
propertiesContextMenu.tsx.hbs
passes through theenumValues
without direct manipulation- No other components directly access the internal structure of enum values
The type change from Array<string>
to Array<FilterEnumValue>
is safe to proceed with.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Find all files that might be using enumValues to ensure they're updated
# to handle the new FilterEnumValue structure
# Search for direct enumValues usage
echo "Files potentially using enumValues:"
rg -l "enumValues" --type=typescript --type=javascript
# Search for FilterOption usage as they might indirectly use enumValues
echo -e "\nFiles using FilterOption:"
rg -l "FilterOption" --type=typescript --type=javascript
# Look for potential MenuItem rendering of enum values
echo -e "\nFiles potentially rendering enum values in MenuItems:"
rg -l "MenuItem.*enum" --type=typescript --type=javascript
Length of output: 548
Script:
#!/bin/bash
# Let's try without specifying file types since typescript might not be recognized
# Search for direct enumValues usage
echo "Files potentially using enumValues:"
rg -l "enumValues"
# Search for FilterOption usage
echo -e "\nFiles using FilterOption:"
rg -l "FilterOption"
# Look for potential MenuItem rendering of enum values
echo -e "\nFiles potentially rendering enum values in MenuItems:"
rg -l "MenuItem.*enum"
# Also search for the new type FilterEnumValue
echo -e "\nFiles using FilterEnumValue:"
rg -l "FilterEnumValue"
Length of output: 4714
Script:
#!/bin/bash
# Let's examine the implementation of FilterDialog and related components to see how enumValues are used
echo "Checking FilterDialog implementation:"
rg -A 10 "enumValues" "judo-ui-react/src/main/resources/actor/src/components/dialog/FilterDialog.tsx.hbs"
echo -e "\nChecking filter-option fragment:"
rg -A 10 "enumValues" "judo-ui-react/src/main/resources/actor/src/fragments/table/filter-option.fragment.hbs"
echo -e "\nChecking ContextMenu implementation:"
rg -A 10 "enumValues" "judo-ui-react/src/main/resources/actor/src/components/table/ContextMenu.tsx.hbs"
echo -e "\nChecking filter helper implementation:"
rg -A 10 "FilterOption" "judo-ui-react/src/main/resources/actor/src/utilities/filter-helper.ts.hbs"
Length of output: 4555
judo-ui-react/src/main/resources/actor/src/components/dialog/FilterDialog.tsx.hbs (1)
156-157
: LGTM! Proper separation of enum value and label.
The changes correctly implement the separation of enum values and their display labels, fixing the translation issue for enum filters.
Let's verify the proper usage of the new FilterEnumValue interface across the codebase:
judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/containers/View/Matter/Table/components/ViewMatterTableTableComponent/index.tsx.snapshot (1)
127-130
: Review handling of validation errors on unsuccessful edits
When an error occurs during applyRowEdit
and it is not a validation error (status code other than 400), the validation errors for the row are being deleted. This might inadvertently remove existing validation errors. Please confirm whether this behavior is intended.