-
Notifications
You must be signed in to change notification settings - Fork 0
Improve filtering #29
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
This update enhances the styling and structure of various components for better maintainability and consistency across the application. - 🔧 Updated `TableStyle` and `EditorStyle` to use interfaces for better abstraction in `styles.go`. - 🖥️ Refactored input components in `InputWrapper.go` and `TextAreaWrapper.go` to utilize new style methods. - 📦 Introduced new constants for table dimensions in `constants.go`. - 📝 Improved header rendering in `header.go` to use centralized styles. - 🔄 Adjusted category adapter and tab styles to implement new interfaces for better flexibility. - 📂 Updated multiple files including `category_styles.go`, `category_tabs.go`, and `style.go` to reflect these changes.
This update enhances the key mapping structure and improves the help system for better usability. - 🛠️ Updated `KeyMaps` structure in `makers.go` and `model.go` for consistency. - 🔧 Introduced `ChangeModeMsg` to manage mode changes in `help.go`. - 📦 Refactored help bindings logic in `help.go` to streamline key bindings based on current mode. - 🖥️ Improved `Model` initialization in `model.go` to include new key maps and help model. - 📂 Files affected: `makers.go`, `model.go`, `help.go`, `structure/model.go`
Improved the help model with additional height management and refined logging in LoggerService for better error handling. - 📦 Updated help model in `internal/models/top/help/help.go`: - Added `height` property to manage help display dimensions. - Refined `updateHelpBindings` to improve key binding updates. - 🔧 Enhanced logging in `internal/services/LoggerService.go`: - Added panic recovery in `EnhancedLogTeaMsg` for safer logging. - Introduced `safeDump` method to handle nil pointers and prevent crashes. - 📦 Introduced new resize message structure in `pkg/tui/teaCmds.go`: - Added `ResizeMsg` type and `GetResizeCmd` function for better window size management.
This update introduces a new Filter Score feature to enhance command filtering and sorting capabilities. - 🆕 Added FilterScore field to Command model in `internal/services/models/command.go` - 🔧 Updated matchFilter function to return a score in `internal/models/command/filter.go` - 📊 Integrated Filter Score into sorting logic in `internal/models/command/sort_helpers.go` - 📦 Included Filter Score in the command list display in `internal/models/command/command_list.go` - 🔄 Adjusted column management to accommodate new Filter Score in `internal/models/command/command_list.go` - 📝 Updated fields definition to include Filter Score in `internal/models/structure/fields.go` - 📋 Modified category tabs to support Filter Score in `internal/models/top/tabs/category_adapter.go`
Here's the code health analysis summary for commits Analysis Summary
|
6af6f38
to
f9a0e61
Compare
f9a0e61
to
04c9a38
Compare
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.
Pull Request Overview
This PR adds a filter-scoring mechanism to commands and integrates it into sorting and display, along with refactoring style interfaces.
- Introduces
FilterScore
inCommand
and updates database/service layer to initialize it - Enhances
matchFilter
to return both match boolean and score, and surfaces score in the UI table - Refactors styling components to use interface-based implementations for tabs and tables
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pkg/components/tabs/category_styles.go | Replaced concrete styles implementation with interface |
internal/services/models/command.go | Added FilterScore field to Command |
internal/services/LoggerService.go | Enhanced logging with panic recovery and safe dumping |
internal/services/DbService.go | Initialized FilterScore when scanning commands |
internal/models/top/tabs/category_adapter.go | Updated sort state to include FieldFilterScore |
internal/models/top/model.go | Refactored model to use new structure and help updates |
internal/models/top/makers.go | Propagated new keyMaps interface to makers |
internal/models/top/help/help.go | Rewrote help component to react to mode and size changes |
internal/models/top/header/header.go | Simplified header rendering using style object |
internal/models/styles/styles.go | Added interface-based style factories for tables and tabs |
internal/models/styles/constants.go | Defined table header/filter height constants |
internal/models/structure/model.go | Introduced Mode , ChangeModeMsg , and shared keyMaps |
internal/models/structure/fields.go | Added FieldFilterScore constant |
internal/models/command/sort_helpers.go | Extended compareBySortField to handle FieldFilterScore |
internal/models/command/inputs/TextAreaWrapper.go | Injected style interface into text area wrapper |
internal/models/command/inputs/InputWrapper.go | Injected style interface into input wrapper |
internal/models/command/filter.go | Updated matchFilter signature to return score |
internal/models/command/editor.go | Passed new style interfaces into input constructors |
internal/models/command/command_list.go | Conditionally displays and widths filter score column |
.golangci.yml | Excluded lipgloss from linter rules |
Comments suppressed due to low confidence (4)
internal/models/command/filter.go:11
- The doc comment no longer matches the signature; update it to mention that the function returns both a match boolean and a score.
// matchFilter returns true if the item with the given ID matches the filter
internal/models/command/filter.go:13
- This new filter scoring logic is critical and needs unit tests to cover cases for exact match, substring match, fuzzy match, and score boundaries.
func matchFilter(filterValue string, cmd *dbmodels.Command) (matched bool, score int) {
internal/services/LoggerService.go:90
- The code uses fmt.Sprintf but the fmt package is not imported. Please add
import "fmt"
at the top.
"value", fmt.Sprintf("%+v", msg))
internal/models/command/filter.go:13
- The function now calls strconv.Atoi and strconv.Itoa but the strconv package is not imported. Please add
import "strconv"
.
func matchFilter(filterValue string, cmd *dbmodels.Command) (matched bool, score int) {
Refactor the Filter Score field for consistency and improved sorting. - Renamed "Filter Score" to "Score" in fields.go for clarity. - Updated sorting logic in category_adapter.go to sort by Score and ID. - Enhanced sorting state to include descending order for Score and ascending for ID. These changes aim to streamline the user experience and improve the clarity of the displayed data.
04c9a38
to
84238b5
Compare
|
/fix #22