mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 04:31:58 +00:00
make vue node settings appear higher in the settings dialog (#6820)
makes setting groups/categories be sorted by highest internal setting field `sortOrder` and adds high `sortOrder` values to the Vue Nodes (Nodes 2.0) settings. <img width="2282" height="1872" alt="Selection_2371" src="https://github.com/user-attachments/assets/71e7e76b-4637-42b5-9f0c-2617622cda23" />
This commit is contained in:
@@ -107,10 +107,17 @@ const {
|
||||
|
||||
const authActions = useFirebaseAuthActions()
|
||||
|
||||
// Get max sortOrder from settings in a group
|
||||
const getGroupSortOrder = (group: SettingTreeNode): number =>
|
||||
Math.max(0, ...flattenTree<SettingParams>(group).map((s) => s.sortOrder ?? 0))
|
||||
|
||||
// Sort groups for a category
|
||||
const sortedGroups = (category: SettingTreeNode): ISettingGroup[] => {
|
||||
return [...(category.children ?? [])]
|
||||
.sort((a, b) => a.label.localeCompare(b.label))
|
||||
.sort((a, b) => {
|
||||
const orderDiff = getGroupSortOrder(b) - getGroupSortOrder(a)
|
||||
return orderDiff !== 0 ? orderDiff : a.label.localeCompare(b.label)
|
||||
})
|
||||
.map((group) => ({
|
||||
label: group.label,
|
||||
settings: flattenTree<SettingParams>(group).sort((a, b) => {
|
||||
|
||||
Reference in New Issue
Block a user