Skip to content

Commit f309826

Browse files
move legacy option to startup arg
1 parent 0632d14 commit f309826

File tree

4 files changed

+37
-54
lines changed

4 files changed

+37
-54
lines changed

src/composables/useCoreCommands.ts

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
import { t } from '@/i18n'
1313
import { api } from '@/scripts/api'
1414
import { app } from '@/scripts/app'
15+
import { useComfyManagerService } from '@/services/comfyManagerService'
1516
import { useDialogService } from '@/services/dialogService'
1617
import { useLitegraphService } from '@/services/litegraphService'
1718
import { useWorkflowService } from '@/services/workflowService'
@@ -604,8 +605,26 @@ export function useCoreCommands(): ComfyCommand[] {
604605
icon: 'pi pi-objects-column',
605606
label: 'Custom Nodes (Beta)',
606607
versionAdded: '1.12.10',
607-
function: () => {
608-
dialogService.showManagerDialog()
608+
function: async () => {
609+
const isLegacyManagerUI =
610+
await useComfyManagerService().isLegacyManagerUI()
611+
if (isLegacyManagerUI) {
612+
try {
613+
await useCommandStore().execute(
614+
'Comfy.Manager.Menu.ToggleVisibility' // This command is registered by legacy manager FE extension
615+
)
616+
} catch (error) {
617+
useToastStore().add({
618+
severity: 'error',
619+
summary: t('g.error'),
620+
detail: t('manager.legacyMenuNotAvailable'),
621+
life: 3000
622+
})
623+
dialogService.showManagerDialog()
624+
}
625+
} else {
626+
dialogService.showManagerDialog()
627+
}
609628
}
610629
},
611630
{
@@ -617,44 +636,6 @@ export function useCoreCommands(): ComfyCommand[] {
617636
dialogService.showManagerProgressDialog()
618637
}
619638
},
620-
{
621-
id: 'Comfy.Manager.CustomNodesManager.ShowLegacyCustomNodesMenu',
622-
icon: 'pi pi-bars',
623-
label: 'Custom Nodes (Legacy)',
624-
versionAdded: '1.16.4',
625-
function: async () => {
626-
try {
627-
await useCommandStore().execute(
628-
'Comfy.Manager.CustomNodesManager.ToggleVisibility'
629-
)
630-
} catch (error) {
631-
useToastStore().add({
632-
severity: 'error',
633-
summary: t('g.error'),
634-
detail: t('manager.legacyMenuNotAvailable'),
635-
life: 3000
636-
})
637-
}
638-
}
639-
},
640-
{
641-
id: 'Comfy.Manager.ShowLegacyManagerMenu',
642-
icon: 'mdi mdi-puzzle',
643-
label: 'Manager Menu (Legacy)',
644-
versionAdded: '1.16.4',
645-
function: async () => {
646-
try {
647-
await useCommandStore().execute('Comfy.Manager.Menu.ToggleVisibility')
648-
} catch (error) {
649-
useToastStore().add({
650-
severity: 'error',
651-
summary: t('g.error'),
652-
detail: t('manager.legacyMenuNotAvailable'),
653-
life: 3000
654-
})
655-
}
656-
}
657-
},
658639
{
659640
id: 'Comfy.Memory.UnloadModels',
660641
icon: 'mdi mdi-vacuum-outline',

src/constants/coreMenuCommands.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ export const CORE_MENU_COMMANDS = [
2121
],
2222
[['Edit'], ['Comfy.ClearWorkflow']],
2323
[['Edit'], ['Comfy.OpenClipspace']],
24-
[
25-
['Manager'],
26-
[
27-
'Comfy.Manager.CustomNodesManager.ShowCustomNodesMenu',
28-
'Comfy.Manager.ShowLegacyManagerMenu',
29-
'Comfy.Manager.CustomNodesManager.ShowLegacyCustomNodesMenu'
30-
]
31-
],
24+
[['Manager'], ['Comfy.Manager.CustomNodesManager.ShowCustomNodesMenu']],
3225
[
3326
['Help'],
3427
[

src/locales/en/main.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
},
114114
"manager": {
115115
"title": "Custom Nodes Manager",
116-
"legacyMenuNotAvailable": "Legacy manager menu is not available in this version of ComfyUI. Please use the new manager menu instead.",
116+
"legacyMenuNotAvailable": "Legacy manager menu is not available, defaulting to the new manager menu.",
117117
"failed": "Failed ({count})",
118118
"noNodesFound": "No nodes found",
119119
"noNodesFoundDescription": "The pack's nodes either could not be parsed, or the pack is a frontend extension only and doesn't have any nodes.",
@@ -644,9 +644,7 @@
644644
"ComfyUI Issues": "ComfyUI Issues",
645645
"Interrupt": "Interrupt",
646646
"Load Default Workflow": "Load Default Workflow",
647-
"Custom Nodes (Beta)": "Custom Nodes (Beta)",
648-
"Custom Nodes (Legacy)": "Custom Nodes (Legacy)",
649-
"Manager Menu (Legacy)": "Manager Menu (Legacy)",
647+
"Custom Nodes (Beta)": "Custom Nodes Manager",
650648
"Toggle Progress Dialog": "Toggle Progress Dialog",
651649
"Unload Models": "Unload Models",
652650
"Unload Models and Execution Cache": "Unload Models and Execution Cache",

src/services/comfyManagerService.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ enum ManagerRoute {
3232
GET_NODES = 'v2/customnode/getmappings',
3333
GET_PACKS = 'v2/customnode/getlist',
3434
IMPORT_FAIL_INFO = 'v2/customnode/import_fail_info',
35-
REBOOT = 'v2/manager/reboot'
35+
REBOOT = 'v2/manager/reboot',
36+
IS_LEGACY_MANAGER_UI = 'v2/manager/is_legacy_manager_ui'
3637
}
3738

3839
const managerApiClient = axios.create({
@@ -247,6 +248,15 @@ export const useComfyManagerService = () => {
247248
)
248249
}
249250

251+
const isLegacyManagerUI = async (signal?: AbortSignal) => {
252+
const errorContext = 'Checking if user set Manager to use the legacy UI'
253+
254+
return executeRequest<boolean>(
255+
() => managerApiClient.get(ManagerRoute.IS_LEGACY_MANAGER_UI, { signal }),
256+
{ errorContext }
257+
)
258+
}
259+
250260
return {
251261
// State
252262
isLoading,
@@ -268,6 +278,7 @@ export const useComfyManagerService = () => {
268278
updateAllPacks,
269279

270280
// System operations
271-
rebootComfyUI
281+
rebootComfyUI,
282+
isLegacyManagerUI
272283
}
273284
}

0 commit comments

Comments
 (0)