mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
set v2 search as default
update settings descriptions hide essentials category if no essentials nodes
This commit is contained in:
@@ -24,13 +24,6 @@ export class ComfyNodeSearchBoxV2 {
|
||||
}
|
||||
|
||||
async reload(comfyPage: ComfyPage) {
|
||||
// Temporary until we have a different flag for the new search box
|
||||
await comfyPage.page.goto(comfyPage.url + '?nodeRedesign=true')
|
||||
await comfyPage.canvas.waitFor({ state: 'visible' })
|
||||
await comfyPage.page.waitForFunction(
|
||||
() => window.app && window.app.extensionManager
|
||||
)
|
||||
await comfyPage.page.locator('.p-blockui-mask').waitFor({ state: 'hidden' })
|
||||
await comfyPage.nextFrame()
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'default')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ test.describe('Load workflow warning', { tag: '@ui' }, () => {
|
||||
})
|
||||
|
||||
test('Does not report warning on undo/redo', async ({ comfyPage }) => {
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'default')
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'v1 (legacy)')
|
||||
|
||||
await comfyPage.workflow.loadWorkflow('missing/missing_nodes')
|
||||
await comfyPage.page
|
||||
|
||||
@@ -18,7 +18,10 @@ test.describe('Node search box', { tag: '@node' }, () => {
|
||||
'Comfy.LinkRelease.ActionShift',
|
||||
'search box'
|
||||
)
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'default')
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.NodeSearchBoxImpl',
|
||||
'v1 (legacy)'
|
||||
)
|
||||
})
|
||||
|
||||
test(`Can trigger on empty canvas double click`, async ({ comfyPage }) => {
|
||||
@@ -45,7 +48,10 @@ test.describe('Node search box', { tag: '@node' }, () => {
|
||||
await comfyPage.setup({ clearStorage: true })
|
||||
// Simulate new user with 1.24.1+ installed version
|
||||
await comfyPage.settings.setSetting('Comfy.InstalledVersion', '1.24.1')
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'default')
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.NodeSearchBoxImpl',
|
||||
'v1 (legacy)'
|
||||
)
|
||||
// Don't set LinkRelease settings explicitly to test versioned defaults
|
||||
|
||||
await comfyPage.canvasOps.disconnectEdge()
|
||||
@@ -285,7 +291,10 @@ test.describe('Release context menu', { tag: '@node' }, () => {
|
||||
'Comfy.LinkRelease.ActionShift',
|
||||
'search box'
|
||||
)
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'default')
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.NodeSearchBoxImpl',
|
||||
'v1 (legacy)'
|
||||
)
|
||||
})
|
||||
|
||||
test(
|
||||
@@ -329,7 +338,10 @@ test.describe('Release context menu', { tag: '@node' }, () => {
|
||||
await comfyPage.setup({ clearStorage: true })
|
||||
// Simulate existing user with pre-1.24.1 version
|
||||
await comfyPage.settings.setSetting('Comfy.InstalledVersion', '1.23.0')
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'default')
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.NodeSearchBoxImpl',
|
||||
'v1 (legacy)'
|
||||
)
|
||||
// Don't set LinkRelease settings explicitly to test versioned defaults
|
||||
|
||||
await comfyPage.canvasOps.disconnectEdge()
|
||||
@@ -350,7 +362,10 @@ test.describe('Release context menu', { tag: '@node' }, () => {
|
||||
'Comfy.LinkRelease.Action',
|
||||
'context menu'
|
||||
)
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'default')
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.NodeSearchBoxImpl',
|
||||
'v1 (legacy)'
|
||||
)
|
||||
|
||||
await comfyPage.canvasOps.disconnectEdge()
|
||||
// Context menu should appear due to explicit setting, not search box
|
||||
|
||||
@@ -54,7 +54,10 @@ async function searchAndExpectResult(
|
||||
test.describe('Subgraph Search Aliases', { tag: ['@subgraph'] }, () => {
|
||||
test.beforeEach(async ({ comfyPage }) => {
|
||||
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'default')
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.NodeSearchBoxImpl',
|
||||
'v1 (legacy)'
|
||||
)
|
||||
})
|
||||
|
||||
test('Can set search aliases on subgraph and find via search', async ({
|
||||
|
||||
@@ -928,7 +928,10 @@ test.describe('Vue Node Link Interaction', { tag: '@screenshot' }, () => {
|
||||
'Comfy.LinkRelease.ActionShift',
|
||||
'context menu'
|
||||
)
|
||||
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'default')
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.NodeSearchBoxImpl',
|
||||
'v1 (legacy)'
|
||||
)
|
||||
|
||||
const samplerNode = (
|
||||
await comfyPage.nodeOps.getNodeRefsByType('KSampler')
|
||||
|
||||
@@ -46,6 +46,14 @@ describe('NodeSearchCategorySidebar', () => {
|
||||
|
||||
describe('preset categories', () => {
|
||||
it('should render all preset categories', async () => {
|
||||
useNodeDefStore().updateNodeDefs([
|
||||
createMockNodeDef({
|
||||
name: 'EssentialNode',
|
||||
essentials_category: 'basic'
|
||||
})
|
||||
])
|
||||
await nextTick()
|
||||
|
||||
const wrapper = await createWrapper()
|
||||
|
||||
expect(wrapper.text()).toContain('Most relevant')
|
||||
|
||||
@@ -55,6 +55,7 @@ import NodeSearchCategoryTreeNode, {
|
||||
import type { CategoryNode } from '@/components/searchbox/v2/NodeSearchCategoryTreeNode.vue'
|
||||
import { nodeOrganizationService } from '@/services/nodeOrganizationService'
|
||||
import { useNodeDefStore } from '@/stores/nodeDefStore'
|
||||
import { NodeSourceType } from '@/types/nodeSource'
|
||||
import type { TreeNode } from '@/types/treeExplorerTypes'
|
||||
import { cn } from '@/utils/tailwindUtil'
|
||||
|
||||
@@ -70,10 +71,20 @@ const topCategories = computed(() => [
|
||||
{ id: 'favorites', label: t('g.favorites') }
|
||||
])
|
||||
|
||||
const sourceCategories = computed(() => [
|
||||
{ id: 'essentials', label: t('g.essentials') },
|
||||
{ id: 'custom', label: t('g.custom') }
|
||||
])
|
||||
const hasEssentialNodes = computed(() =>
|
||||
nodeDefStore.visibleNodeDefs.some(
|
||||
(n) => n.nodeSource.type === NodeSourceType.Essentials
|
||||
)
|
||||
)
|
||||
|
||||
const sourceCategories = computed(() => {
|
||||
const categories = []
|
||||
if (hasEssentialNodes.value) {
|
||||
categories.push({ id: 'essentials', label: t('g.essentials') })
|
||||
}
|
||||
categories.push({ id: 'custom', label: t('g.custom') })
|
||||
return categories
|
||||
})
|
||||
|
||||
const categoryTree = computed<CategoryNode[]>(() => {
|
||||
const tree = nodeOrganizationService.organizeNodes(
|
||||
|
||||
@@ -163,6 +163,20 @@ describe('NodeSearchContent', () => {
|
||||
expect(items[0].text()).toContain('Custom Node')
|
||||
})
|
||||
|
||||
it('should hide Essentials category when no essential nodes exist', async () => {
|
||||
useNodeDefStore().updateNodeDefs([
|
||||
createMockNodeDef({
|
||||
name: 'RegularNode',
|
||||
display_name: 'Regular Node'
|
||||
})
|
||||
])
|
||||
|
||||
const wrapper = await createWrapper()
|
||||
expect(wrapper.find('[data-testid="category-essentials"]').exists()).toBe(
|
||||
false
|
||||
)
|
||||
})
|
||||
|
||||
it('should show only essential nodes when Essentials is selected', async () => {
|
||||
useNodeDefStore().updateNodeDefs([
|
||||
createMockNodeDef({
|
||||
|
||||
@@ -35,7 +35,7 @@ export const CORE_SETTINGS: SettingParams[] = [
|
||||
experimental: true,
|
||||
name: 'Node search box implementation',
|
||||
type: 'combo',
|
||||
options: ['default', 'litegraph (legacy)'],
|
||||
options: ['default', 'v1 (legacy)', 'litegraph (legacy)'],
|
||||
defaultValue: 'default'
|
||||
},
|
||||
{
|
||||
@@ -72,7 +72,7 @@ export const CORE_SETTINGS: SettingParams[] = [
|
||||
id: 'Comfy.NodeSearchBoxImpl.ShowCategory',
|
||||
category: ['Comfy', 'Node Search Box', 'ShowCategory'],
|
||||
name: 'Show node category in search results',
|
||||
tooltip: 'Only applies to the default implementation',
|
||||
tooltip: 'Only applies to v1 (legacy)',
|
||||
type: 'boolean',
|
||||
defaultValue: true
|
||||
},
|
||||
@@ -80,7 +80,7 @@ export const CORE_SETTINGS: SettingParams[] = [
|
||||
id: 'Comfy.NodeSearchBoxImpl.ShowIdName',
|
||||
category: ['Comfy', 'Node Search Box', 'ShowIdName'],
|
||||
name: 'Show node id name in search results',
|
||||
tooltip: 'Only applies to the default implementation',
|
||||
tooltip: 'Does not apply to litegraph (legacy)',
|
||||
type: 'boolean',
|
||||
defaultValue: false
|
||||
},
|
||||
@@ -88,7 +88,7 @@ export const CORE_SETTINGS: SettingParams[] = [
|
||||
id: 'Comfy.NodeSearchBoxImpl.ShowNodeFrequency',
|
||||
category: ['Comfy', 'Node Search Box', 'ShowNodeFrequency'],
|
||||
name: 'Show node frequency in search results',
|
||||
tooltip: 'Only applies to the default implementation',
|
||||
tooltip: 'Only applies to v1 (legacy)',
|
||||
type: 'boolean',
|
||||
defaultValue: false
|
||||
},
|
||||
|
||||
@@ -327,7 +327,11 @@ const zSettings = z.object({
|
||||
'Comfy.ModelLibrary.AutoLoadAll': z.boolean(),
|
||||
'Comfy.ModelLibrary.NameFormat': z.enum(['filename', 'title']),
|
||||
'Comfy.NodeSearchBoxImpl.NodePreview': z.boolean(),
|
||||
'Comfy.NodeSearchBoxImpl': z.enum(['default', 'simple']),
|
||||
'Comfy.NodeSearchBoxImpl': z.enum([
|
||||
'default',
|
||||
'v1 (legacy)',
|
||||
'litegraph (legacy)'
|
||||
]),
|
||||
'Comfy.NodeSearchBoxImpl.ShowCategory': z.boolean(),
|
||||
'Comfy.NodeSearchBoxImpl.ShowIdName': z.boolean(),
|
||||
'Comfy.NodeSearchBoxImpl.ShowNodeFrequency': z.boolean(),
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('useSearchBoxStore', () => {
|
||||
|
||||
describe('when user has legacy search box enabled', () => {
|
||||
beforeEach(() => {
|
||||
vi.mocked(mockSettingStore.get).mockReturnValue('legacy')
|
||||
vi.mocked(mockSettingStore.get).mockReturnValue('litegraph (legacy)')
|
||||
})
|
||||
|
||||
it('should show new search box is disabled', () => {
|
||||
@@ -104,7 +104,7 @@ describe('useSearchBoxStore', () => {
|
||||
|
||||
describe('when user configures popover reference', () => {
|
||||
beforeEach(() => {
|
||||
vi.mocked(mockSettingStore.get).mockReturnValue('legacy')
|
||||
vi.mocked(mockSettingStore.get).mockReturnValue('litegraph (legacy)')
|
||||
})
|
||||
|
||||
it('should enable legacy search when popover is set', () => {
|
||||
|
||||
@@ -10,14 +10,12 @@ export const useSearchBoxStore = defineStore('searchBox', () => {
|
||||
const settingStore = useSettingStore()
|
||||
const { x, y } = useMouse()
|
||||
|
||||
// Feature flag for the new search box V2 with category sidebar
|
||||
const useSearchBoxV2 = ref(
|
||||
typeof window !== 'undefined' &&
|
||||
new URLSearchParams(window.location.search).get('nodeRedesign') === 'true'
|
||||
const useSearchBoxV2 = computed(
|
||||
() => settingStore.get('Comfy.NodeSearchBoxImpl') === 'default'
|
||||
)
|
||||
|
||||
const newSearchBoxEnabled = computed(
|
||||
() => settingStore.get('Comfy.NodeSearchBoxImpl') === 'default'
|
||||
() => settingStore.get('Comfy.NodeSearchBoxImpl') !== 'litegraph (legacy)'
|
||||
)
|
||||
|
||||
const popoverRef = shallowRef<InstanceType<
|
||||
|
||||
Reference in New Issue
Block a user