-
Notifications
You must be signed in to change notification settings - Fork 715
fix: table columns reordering issue #4423
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
Conversation
WalkthroughThe changes introduce a new utility function, Changes
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- web/src/composables/useLogs.ts (4 hunks)
- web/src/plugins/logs/IndexList.vue (2 hunks)
- web/src/plugins/logs/SearchResult.vue (3 hunks)
- web/src/plugins/logs/TenstackTable.vue (2 hunks)
Additional comments not posted (7)
web/src/plugins/logs/TenstackTable.vue (2)
59-59: LGTM!The change simplifies the event handling by removing the unused event parameter, as the
handleDragEndfunction no longer requires the event object.
618-627: LGTM!The change streamlines the logic and alters the behavior of how the column order is managed after a drag event, focusing on ensuring the
timestamp_columnis always the first element. The change is valid and improves the code readability.web/src/plugins/logs/SearchResult.vue (2)
334-335: LGTM!The change encapsulates the field management logic by retrieving the current selection of fields using the
reorderSelectedFieldsmethod before any modifications are made. This potentially improves readability and maintainability by separating the concerns of field reordering and state management.
339-343: LGTM!The change alters the control flow such that the selected fields are now stored in a local variable, which is updated based on user actions. After the modification, the updated list of selected fields is then assigned back to
searchObj.data.stream.selectedFields. This change encapsulates the field management logic and improves the clarity of the code.web/src/plugins/logs/IndexList.vue (2)
702-702: LGTM!The change introduces a new function
reorderSelectedFieldswhich modifies how selected fields are managed within the component. This change enhances the component's functionality by introducing a more structured approach to handling selected fields.
788-797: LGTM!The change encapsulates the field management logic by first retrieving the current selection of fields, storing them in a local variable, updating the local variable based on user actions, and then assigning the updated list back to
searchObj.data.stream.selectedFields. This change improves the readability and maintainability of the code by separating the concerns of field reordering and state management.web/src/composables/useLogs.ts (1)
Line range hint
4018-4084: Approved: New utility functions for reordering selected fields based on grid column order.The introduced utility functions,
reorderArrayByReferenceandreorderSelectedFields, enhance the management of selected fields based on the current grid column order.
reorderArrayByReferencesorts the first array based on the order of elements in the second array, moving elements not found in the second array to the end.
reorderSelectedFieldsreorders the selected fields by:
- Creating a copy of the currently selected fields.
- Retrieving the column order for the selected stream.
- Removing the timestamp column from the column order if not selected.
- Calling
reorderArrayByReferenceto reorder the selected fields according to the column order.The code is well-structured, follows best practices, and no major issues or potential bugs were identified.
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- web/src/composables/useLogs.ts (4 hunks)
Additional comments not posted (2)
web/src/composables/useLogs.ts (2)
4018-4029: LGTM!The new utility function
reorderArrayByReferencelooks good. It correctly reordersarr1based on the order of elements inarr2, moving elements not found inarr2to the end.
4031-4048: LGTM!The new function
reorderSelectedFieldslooks good. It correctly reorders the selected fields based on the grid column order. It handles the case where the timestamp column may not be included and uses thereorderArrayByReferenceutility function to perform the reordering.
fix #4424 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new utility for reordering selected fields based on grid column order, enhancing user experience when managing data fields. - Improved drag-and-drop functionality for table columns, ensuring the timestamp column is prioritized in the order. - **Bug Fixes** - Enhanced error handling by streamlining logging processes. - **Documentation** - Updated component methods to clarify the use of new field management logic. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
fix #4424
Summary by CodeRabbit
New Features
Bug Fixes
Documentation