Skip to content

Commit

Permalink
Rename setting
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Sep 3, 2024
1 parent a5e73b6 commit f714c3a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 29 deletions.
5 changes: 1 addition & 4 deletions browser_tests/interaction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ test.describe('Node Interaction', () => {
})

test('Can disconnect/connect edge', async ({ comfyPage }) => {
await comfyPage.setSetting(
'Comfy.NodeSearchBoxImpl.LinkReleaseAction',
'no action'
)
await comfyPage.setSetting('Comfy.LinkRelease.Action', 'no action')
await comfyPage.disconnectEdge()
await expect(comfyPage.canvas).toHaveScreenshot(
'disconnected-edge-with-menu.png'
Expand Down
20 changes: 4 additions & 16 deletions browser_tests/nodeSearchBox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ import { comfyPageFixture as test } from './ComfyPage'

test.describe('Node search box', () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.setSetting(
'Comfy.NodeSearchBoxImpl.LinkReleaseAction',
'search box'
)
await comfyPage.setSetting(
'Comfy.NodeSearchBoxImpl.LinkReleaseActionShift',
'search box'
)
await comfyPage.setSetting('Comfy.LinkRelease.Action', 'search box')
await comfyPage.setSetting('Comfy.LinkRelease.ActionShift', 'search box')
await comfyPage.setSetting('Comfy.NodeSearchBoxImpl', 'default')
})

Expand Down Expand Up @@ -79,14 +73,8 @@ test.describe('Node search box', () => {

test.describe('Release context menu', () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.setSetting(
'Comfy.NodeSearchBoxImpl.LinkReleaseAction',
'context menu'
)
await comfyPage.setSetting(
'Comfy.NodeSearchBoxImpl.LinkReleaseActionShift',
'search box'
)
await comfyPage.setSetting('Comfy.LinkRelease.Action', 'context menu')
await comfyPage.setSetting('Comfy.LinkRelease.ActionShift', 'search box')
await comfyPage.setSetting('Comfy.NodeSearchBoxImpl', 'default')
})

Expand Down
4 changes: 2 additions & 2 deletions src/components/searchbox/NodeSearchBoxPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ const canvasEventHandler = (e: LiteGraphCanvasEvent) => {
}
const linkReleaseAction = computed(() => {
return settingStore.get('Comfy.NodeSearchBoxImpl.LinkReleaseAction')
return settingStore.get('Comfy.LinkRelease.Action')
})
const linkReleaseActionShift = computed(() => {
return settingStore.get('Comfy.NodeSearchBoxImpl.LinkReleaseActionShift')
return settingStore.get('Comfy.LinkRelease.ActionShift')
})
const handleCanvasEmptyRelease = (e: LiteGraphCanvasEvent) => {
Expand Down
6 changes: 2 additions & 4 deletions src/stores/settingStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,15 @@ export const useSettingStore = defineStore('setting', {
})

app.ui.settings.addSetting({
id: 'Comfy.NodeSearchBoxImpl.LinkReleaseAction',
category: ['Comfy', 'Node Search Box', 'LinkReleaseAction'],
id: 'Comfy.LinkRelease.Action',
name: 'Action on link release (No modifier)',
type: 'combo',
options: Object.values(LinkReleaseTriggerAction),
defaultValue: LinkReleaseTriggerAction.CONTEXT_MENU
})

app.ui.settings.addSetting({
id: 'Comfy.NodeSearchBoxImpl.LinkReleaseActionShift',
category: ['Comfy', 'Node Search Box', 'LinkReleaseActionShift'],
id: 'Comfy.LinkRelease.ActionShift',
name: 'Action on link release (Shift)',
type: 'combo',
options: Object.values(LinkReleaseTriggerAction),
Expand Down
5 changes: 2 additions & 3 deletions src/types/apiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,8 @@ const zSettings = z.record(z.any()).and(
'hold shift',
'NOT hold shift'
]),
'Comfy.NodeSearchBoxImpl.LinkReleaseAction': zLinkReleaseTriggerAction,
'Comfy.NodeSearchBoxImpl.LinkReleaseActionShift':
zLinkReleaseTriggerAction,
'Comfy.LinkRelease.Action': zLinkReleaseTriggerAction,
'Comfy.LinkRelease.ActionShift': zLinkReleaseTriggerAction,
'Comfy.NodeSearchBoxImpl.NodePreview': z.boolean(),
'Comfy.NodeSearchBoxImpl': z.enum(['default', 'simple']),
'Comfy.NodeSearchBoxImpl.ShowCategory': z.boolean(),
Expand Down

0 comments on commit f714c3a

Please sign in to comment.