move legacy option to startup arg

This commit is contained in:
bymyself
2025-04-14 10:19:52 -07:00
committed by Jin Yi
parent fc9964031b
commit b200115b5b
4 changed files with 29 additions and 12 deletions

View File

@@ -15,10 +15,11 @@ import { t } from '@/i18n'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
import { addFluxKontextGroupNode } from '@/scripts/fluxKontextEditNode'
import { useComfyManagerService } from '@/services/comfyManagerService'
import { useDialogService } from '@/services/dialogService'
import { useLitegraphService } from '@/services/litegraphService'
import { useWorkflowService } from '@/services/workflowService'
import { useCommandStore } from '@/stores/commandStore'
import { type ComfyCommand, useCommandStore } from '@/stores/commandStore'
import { useExecutionStore } from '@/stores/executionStore'
import { useCanvasStore, useTitleEditorStore } from '@/stores/graphStore'
import { useQueueSettingsStore, useQueueStore } from '@/stores/queueStore'
@@ -664,8 +665,26 @@ export function useCoreCommands(): ComfyCommand[] {
icon: 'pi pi-puzzle',
label: 'Toggle the Custom Nodes Manager',
versionAdded: '1.12.10',
function: () => {
dialogService.toggleManagerDialog()
function: async () => {
const isLegacyManagerUI =
await useComfyManagerService().isLegacyManagerUI()
if (isLegacyManagerUI) {
try {
await useCommandStore().execute(
'Comfy.Manager.Menu.ToggleVisibility' // This command is registered by legacy manager FE extension
)
} catch (error) {
useToastStore().add({
severity: 'error',
summary: t('g.error'),
detail: t('manager.legacyMenuNotAvailable'),
life: 3000
})
dialogService.toggleManagerDialog()
}
} else {
dialogService.toggleManagerDialog()
}
}
},
{

View File

@@ -11,19 +11,17 @@ export const CORE_MENU_COMMANDS = [
]
],
[['Edit'], ['Comfy.Undo', 'Comfy.Redo']],
[['Edit'], ['Comfy.RefreshNodeDefinitions']],
[['Edit'], ['Comfy.ClearWorkflow']],
[['Edit'], ['Comfy.OpenClipspace']],
[
['Manager'],
['Edit'],
[
'Comfy.Manager.ShowLegacyManagerMenu',
'Comfy.Manager.CustomNodesManager.ShowLegacyCustomNodesMenu',
'Comfy.Manager.CustomNodesManager.ShowCustomNodesMenu',
'Comfy.RefreshNodeDefinitions',
'Comfy.Memory.UnloadModels',
'Comfy.Memory.UnloadModelsAndExecutionCache'
]
],
[['Edit'], ['Comfy.ClearWorkflow']],
[['Edit'], ['Comfy.OpenClipspace']],
[['Manager'], ['Comfy.Manager.CustomNodesManager.ShowCustomNodesMenu']],
[
['Help'],
[

View File

@@ -138,7 +138,7 @@
},
"manager": {
"title": "Custom Nodes Manager",
"legacyMenuNotAvailable": "Legacy manager menu is not available in this version of ComfyUI. Please use the new manager menu instead.",
"legacyMenuNotAvailable": "Legacy manager menu is not available, defaulting to the new manager menu.",
"failed": "Failed ({count})",
"noNodesFound": "No nodes found",
"noNodesFoundDescription": "The pack's nodes either could not be parsed, or the pack is a frontend extension only and doesn't have any nodes.",

View File

@@ -251,7 +251,7 @@ export const useComfyManagerService = () => {
const isLegacyManagerUI = async (signal?: AbortSignal) => {
const errorContext = 'Checking if user set Manager to use the legacy UI'
return executeRequest<{ is_legacy_manager_ui: boolean }>(
return executeRequest<boolean>(
() => managerApiClient.get(ManagerRoute.IS_LEGACY_MANAGER_UI, { signal }),
{ errorContext }
)