[Refactor] Convert dialogService to composable (#2058)

This commit is contained in:
Chenlei Hu
2024-12-26 00:26:01 -05:00
committed by GitHub
parent 4e554503c0
commit f69e88bf41
8 changed files with 176 additions and 171 deletions

View File

@@ -1,9 +1,6 @@
import { app } from '@/scripts/app'
import { api } from '@/scripts/api'
import {
showSettingsDialog,
showTemplateWorkflowsDialog
} from '@/services/dialogService'
import { useDialogService } from '@/services/dialogService'
import { useWorkflowService } from '@/services/workflowService'
import type { ComfyCommand } from '@/stores/commandStore'
import { useTitleEditorStore } from '@/stores/graphStore'
@@ -23,6 +20,7 @@ import { useSearchBoxStore } from '@/stores/workspace/searchBoxStore'
export function useCoreCommands(): ComfyCommand[] {
const workflowService = useWorkflowService()
const dialogService = useDialogService()
const getTracker = () => useWorkflowStore()?.activeWorkflow?.changeTracker
const getSelectedNodes = (): LGraphNode[] => {
@@ -200,7 +198,9 @@ export function useCoreCommands(): ComfyCommand[] {
id: 'Comfy.BrowseTemplates',
icon: 'pi pi-folder-open',
label: 'Browse Templates',
function: showTemplateWorkflowsDialog
function: () => {
dialogService.showTemplateWorkflowsDialog()
}
},
{
id: 'Comfy.Canvas.ZoomIn',
@@ -302,7 +302,7 @@ export function useCoreCommands(): ComfyCommand[] {
label: 'Show Settings Dialog',
versionAdded: '1.3.7',
function: () => {
showSettingsDialog()
dialogService.showSettingsDialog()
}
},
{
@@ -509,7 +509,7 @@ export function useCoreCommands(): ComfyCommand[] {
menubarLabel: 'About ComfyUI',
versionAdded: '1.6.4',
function: () => {
showSettingsDialog('about')
dialogService.showSettingsDialog('about')
}
}
]