feat:(model-manager) add sorting capabilities for models#9024
feat:(model-manager) add sorting capabilities for models#9024skunkworxdark wants to merge 13 commits intoinvoke-ai:mainfrom
Conversation
dded the ability to sort models in the Model Manager by various attributes including Name, Base, Type, Format, Size, Date Added, and Date Modified. Supports both ascending and descending order. - Backend: Added `order_by` and `direction` query parameters to the ``/api/v1/models`/` listing endpoint. Implemented case-insensitive sorting in the SQLite model records service. - Frontend: Introduced `<ModelSortControl />` UI, updated Redux slices to manage sort state, removed client-side entity adapter sorting to respect server-side ordering, and added i18n localization keys. - Tests: Added test coverage for SQL-based sorting on size and name.
dded the ability to sort models in the Model Manager by various attributes including Name, Base, Type, Format, Size, Date Added, and Date Modified. Supports both ascending and descending order. - Backend: Added `order_by` and `direction` query parameters to the ``/api/v1/models`/` listing endpoint. Implemented case-insensitive sorting in the SQLite model records service. - Frontend: Introduced `<ModelSortControl />` UI, updated Redux slices to manage sort state, removed client-side entity adapter sorting to respect server-side ordering, and added i18n localization keys. - Tests: Added test coverage for SQL-based sorting on size and name.
…/InvokeAI into model-manager-sort
|
@joshistoast, what do you think of this?
|
|
Yeah that looks much better @skunkworxdark. Small nitpick on the UI, maybe preserve the checkmark space on the left of non-selected item labels. |
|
Another important UX improvement would be for the drop-down menu to stay open (if not already), only closing when clicked outside or on the Filtering button. |
|
@joshistoast indentation sorted. I think this is what you requested?
@ufuksarp, I am not exactly sure what you mean or what the point of your request would be. Can you expand on what you mean, or better still, provide an example of another menu in Invoke that behaves the way you are requesting? |
…ed menu - Replaced separate `ModelSortControl` and `ModelTypeFilter` components with a single, unified "Filtering" dropdown menu. - Organised filtering options into categorised submenus in the following order: Direction, Sort By, and Model Type. - Enhanced submenu labels to display the currently active selection inline for quick reference. - Improved visual alignment within menus by using hidden checkmarks on unselected items, ensuring consistent indentation across all options. - Resolved styling and linting issues (unused variables, JSX bind warnings) within the new component.
|
@skunkworxdark Ah, I thought the model selection was a multi-select with the checkmarks and all just seeing the images. My bad. Testing the PR now locally, all seems fine. |
The model type filter selection hasn't been changed; it has only been rolled into a single dropdown menu along with the sort by and direction options to keep the header section clean. |






Summary
This PR introduces robust sorting capabilities to the Model Manager, allowing users to organize their installed models by several attributes in both ascending and descending order. This improves usability for users with large model libraries.
Related Issues / Discussions
#5885
Changes Made
Backend (``invokeai/app
/& `tests/`):ModelRecordOrderByenum to includeSize,DateAdded,DateModified, andPath.order_byanddirectionquery parameter tolist_modelsandsearch_by_attrinmodel_records_base.pyandmodel_manager.py.model_records_sql.py, notably usingCOLLATE NOCASEfor string attributes (Name, Base) andjson_extractto sort byfile_sizenested inside the config JSON.Defaultsort implementation to ensure the selected sort direction is correctly applied to all fallback columns (type,base, andname), rather than just the final column (format).test_model_records_sql.pyto ensure proper ascending and descending functionality across different attributes.Frontend (``invokeai/frontend/web
/):modelManagerV2Sliceto trackorderByandsortDirectionglobally.useGetModelConfigsQuery. Removed the client-sidesortComparerfrommodelConfigsAdapterso the UI properly respects the server-provided order.<ModelSortControl />component to theModelListNavigationpanel.QA Instructions
Name,Base,Size,Date Added, etc.) and toggle between Ascending/Descending.Defaultand toggle the direction to verify that the list properly reverses the fallback groupings (Type, then Base, then Name).Merge Plan
Standard merge. No Special instructions.
Checklist
What's Newcopy (if doing a release after this PR)