Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/composables/useHelpCenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { computed, onMounted } from 'vue'
import { useSettingStore } from '@/platform/settings/settingStore'
import { useTelemetry } from '@/platform/telemetry'
import { useReleaseStore } from '@/platform/updates/common/releaseStore'
import { useDialogService } from '@/services/dialogService'
import { useHelpCenterStore } from '@/stores/helpCenterStore'
import type { HelpCenterTriggerLocation } from '@/stores/helpCenterStore'
import { useConflictAcknowledgment } from '@/workbench/extensions/manager/composables/useConflictAcknowledgment'
import { useConflictDetection } from '@/workbench/extensions/manager/composables/useConflictDetection'
import { useNodeConflictDialog } from '@/workbench/extensions/manager/composables/useNodeConflictDialog'

export function useHelpCenter(
triggerFrom: HelpCenterTriggerLocation = 'sidebar'
Expand All @@ -21,7 +21,7 @@ export function useHelpCenter(
const { shouldShowRedDot: showReleaseRedDot } = storeToRefs(releaseStore)

const conflictDetection = useConflictDetection()
const { showNodeConflictDialog } = useDialogService()
const { show: showNodeConflictDialog } = useNodeConflictDialog()

// Use conflict acknowledgment state from composable - call only once
const { shouldShowRedDot: shouldShowConflictRedDot, markConflictsAsSeen } =
Expand Down
24 changes: 24 additions & 0 deletions src/composables/useMissingModelsDialog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { ComponentAttrs } from 'vue-component-type-helpers'

import MissingModelsWarning from '@/components/dialog/content/MissingModelsWarning.vue'
import { useDialogStore } from '@/stores/dialogStore'

const DIALOG_KEY = 'global-missing-models-warning'

export function useMissingModelsDialog() {
const dialogStore = useDialogStore()

function hide() {
dialogStore.closeDialog({ key: DIALOG_KEY })
}

function show(props: ComponentAttrs<typeof MissingModelsWarning>) {
dialogStore.showDialog({
key: DIALOG_KEY,
component: MissingModelsWarning,
props
})
}
Comment thread
viva-jinyi marked this conversation as resolved.

return { show, hide }
}
30 changes: 30 additions & 0 deletions src/composables/useMissingNodesDialog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { ComponentAttrs } from 'vue-component-type-helpers'

import MissingNodesContent from '@/components/dialog/content/MissingNodesContent.vue'
import MissingNodesFooter from '@/components/dialog/content/MissingNodesFooter.vue'
import MissingNodesHeader from '@/components/dialog/content/MissingNodesHeader.vue'
import { useDialogService } from '@/services/dialogService'
import { useDialogStore } from '@/stores/dialogStore'

const DIALOG_KEY = 'global-missing-nodes'

export function useMissingNodesDialog() {
const { showSmallLayoutDialog } = useDialogService()
const dialogStore = useDialogStore()

function hide() {
dialogStore.closeDialog({ key: DIALOG_KEY })
}

function show(props: ComponentAttrs<typeof MissingNodesContent>) {
showSmallLayoutDialog({
key: DIALOG_KEY,
headerComponent: MissingNodesHeader,
footerComponent: MissingNodesFooter,
component: MissingNodesContent,
props
})
}

return { show, hide }
}
4 changes: 3 additions & 1 deletion src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
} from '@/scripts/domWidget'
import { useDialogService } from '@/services/dialogService'
import { useBillingContext } from '@/composables/billing/useBillingContext'
import { useMissingModelsDialog } from '@/composables/useMissingModelsDialog'

Check failure on line 55 in src/scripts/app.ts

View workflow job for this annotation

GitHub Actions / scan

'useMissingModelsDialog' is declared but its value is never read.

Check failure on line 55 in src/scripts/app.ts

View workflow job for this annotation

GitHub Actions / collect

'useMissingModelsDialog' is declared but its value is never read.

Check failure on line 55 in src/scripts/app.ts

View workflow job for this annotation

GitHub Actions / setup

'useMissingModelsDialog' is declared but its value is never read.
import { useMissingNodesDialog } from '@/composables/useMissingNodesDialog'
import { useExtensionService } from '@/services/extensionService'
import { useLitegraphService } from '@/services/litegraphService'
import { useSubgraphService } from '@/services/subgraphService'
Expand Down Expand Up @@ -1068,7 +1070,7 @@

private showMissingNodesError(missingNodeTypes: MissingNodeType[]) {
if (useSettingStore().get('Comfy.Workflow.ShowMissingNodesWarning')) {
useDialogService().showLoadWorkflowWarning({ missingNodeTypes })
useMissingNodesDialog().show({ missingNodeTypes })
}
}

Expand Down
172 changes: 8 additions & 164 deletions src/services/dialogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,9 @@ import type {
ShowDialogOptions
} from '@/stores/dialogStore'

import type { ConflictDetectionResult } from '@/workbench/extensions/manager/types/conflictDetectionTypes'
import type { ComponentAttrs } from 'vue-component-type-helpers'

// Type-only imports for ComponentAttrs inference (no runtime cost)
import type MissingNodesContent from '@/components/dialog/content/MissingNodesContent.vue'
import type MissingModelsWarning from '@/components/dialog/content/MissingModelsWarning.vue'

// Lazy loaders for dialogs - components are loaded on first use
const lazyMissingNodesContent = () =>
import('@/components/dialog/content/MissingNodesContent.vue')
const lazyMissingNodesHeader = () =>
import('@/components/dialog/content/MissingNodesHeader.vue')
const lazyMissingNodesFooter = () =>
import('@/components/dialog/content/MissingNodesFooter.vue')
const lazyMissingModelsWarning = () =>
import('@/components/dialog/content/MissingModelsWarning.vue')
const lazyApiNodesSignInContent = () =>
import('@/components/dialog/content/ApiNodesSignInContent.vue')
const lazySignInContent = () =>
Expand All @@ -40,18 +27,6 @@ const lazyUpdatePasswordContent = () =>
import('@/components/dialog/content/UpdatePasswordContent.vue')
const lazyComfyOrgHeader = () =>
import('@/components/dialog/header/ComfyOrgHeader.vue')
const lazyImportFailedNodeContent = () =>
import('@/workbench/extensions/manager/components/manager/ImportFailedNodeContent.vue')
const lazyImportFailedNodeHeader = () =>
import('@/workbench/extensions/manager/components/manager/ImportFailedNodeHeader.vue')
const lazyImportFailedNodeFooter = () =>
import('@/workbench/extensions/manager/components/manager/ImportFailedNodeFooter.vue')
const lazyNodeConflictDialogContent = () =>
import('@/workbench/extensions/manager/components/manager/NodeConflictDialogContent.vue')
const lazyNodeConflictHeader = () =>
import('@/workbench/extensions/manager/components/manager/NodeConflictHeader.vue')
const lazyNodeConflictFooter = () =>
import('@/workbench/extensions/manager/components/manager/NodeConflictFooter.vue')

export type ConfirmationDialogType =
| 'default'
Expand All @@ -77,56 +52,6 @@ export interface ExecutionErrorDialogInput {
export const useDialogService = () => {
const dialogStore = useDialogStore()

async function showLoadWorkflowWarning(
props: ComponentAttrs<typeof MissingNodesContent>
) {
const [
{ default: MissingNodesContent },
{ default: MissingNodesHeader },
{ default: MissingNodesFooter }
] = await Promise.all([
lazyMissingNodesContent(),
lazyMissingNodesHeader(),
lazyMissingNodesFooter()
])

dialogStore.showDialog({
key: 'global-missing-nodes',
headerComponent: MissingNodesHeader,
footerComponent: MissingNodesFooter,
component: MissingNodesContent,
dialogComponentProps: {
closable: true,
pt: {
root: { class: 'bg-base-background border-border-default' },
header: { class: '!p-0 !m-0' },
content: { class: '!p-0 overflow-y-hidden' },
footer: { class: '!p-0' },
pcCloseButton: {
root: {
class: '!w-7 !h-7 !border-none !outline-none !p-2 !m-1.5'
}
}
}
},
props,
footerProps: {
missingNodeTypes: props.missingNodeTypes
}
})
}

async function showMissingModelsWarning(
props: ComponentAttrs<typeof MissingModelsWarning>
) {
const { default: MissingModelsWarning } = await lazyMissingModelsWarning()
dialogStore.showDialog({
key: 'global-missing-models-warning',
component: MissingModelsWarning,
props
})
}

function showExecutionErrorDialog(executionError: ExecutionErrorDialogInput) {
const props: ComponentAttrs<typeof ErrorDialogContent> = {
error: {
Expand Down Expand Up @@ -440,29 +365,15 @@ export const useDialogService = () => {
})
}

async function showImportFailedNodeDialog(
options: {
conflictedPackages?: ConflictDetectionResult[]
dialogComponentProps?: DialogComponentProps
} = {}
function showSmallLayoutDialog(
options: Omit<ShowDialogOptions, 'dialogComponentProps'> & {
dialogComponentProps?: Omit<DialogComponentProps, 'pt'>
}
) {
const [
{ default: ImportFailedNodeHeader },
{ default: ImportFailedNodeFooter },
{ default: ImportFailedNodeContent }
] = await Promise.all([
lazyImportFailedNodeHeader(),
lazyImportFailedNodeFooter(),
lazyImportFailedNodeContent()
])

const { dialogComponentProps, conflictedPackages } = options
const { dialogComponentProps: callerProps, ...rest } = options

return dialogStore.showDialog({
key: 'global-import-failed',
headerComponent: ImportFailedNodeHeader,
footerComponent: ImportFailedNodeFooter,
component: ImportFailedNodeContent,
...rest,
dialogComponentProps: {
closable: true,
pt: {
Expand All @@ -476,71 +387,7 @@ export const useDialogService = () => {
}
}
},
...dialogComponentProps
},
props: {
conflictedPackages: conflictedPackages ?? []
},
footerProps: {
conflictedPackages: conflictedPackages ?? []
}
})
}

async function showNodeConflictDialog(
options: {
showAfterWhatsNew?: boolean
conflictedPackages?: ConflictDetectionResult[]
dialogComponentProps?: DialogComponentProps
buttonText?: string
onButtonClick?: () => void
} = {}
) {
const [
{ default: NodeConflictHeader },
{ default: NodeConflictFooter },
{ default: NodeConflictDialogContent }
] = await Promise.all([
lazyNodeConflictHeader(),
lazyNodeConflictFooter(),
lazyNodeConflictDialogContent()
])

const {
dialogComponentProps,
buttonText,
onButtonClick,
showAfterWhatsNew,
conflictedPackages
} = options

return dialogStore.showDialog({
key: 'global-node-conflict',
headerComponent: NodeConflictHeader,
footerComponent: NodeConflictFooter,
component: NodeConflictDialogContent,
dialogComponentProps: {
closable: true,
pt: {
header: { class: '!p-0 !m-0' },
content: { class: '!p-0 overflow-y-hidden' },
footer: { class: '!p-0' },
pcCloseButton: {
root: {
class:
'!w-7 !h-7 !border-none !outline-none !p-2 !m-1.5 bg-dialog-surface text-white'
}
}
},
...dialogComponentProps
},
props: {
showAfterWhatsNew,
conflictedPackages
},
footerProps: {
buttonText,
onButtonClick
...callerProps
}
})
}
Expand Down Expand Up @@ -715,8 +562,6 @@ export const useDialogService = () => {
}

return {
showLoadWorkflowWarning,
showMissingModelsWarning,
showExecutionErrorDialog,
showApiNodesSignInDialog,
showSignInDialog,
Expand All @@ -728,8 +573,7 @@ export const useDialogService = () => {
showErrorDialog,
confirm,
showLayoutDialog,
showImportFailedNodeDialog,
showNodeConflictDialog,
showSmallLayoutDialog,
showDeleteWorkspaceDialog,
showCreateWorkspaceDialog,
showLeaveWorkspaceDialog,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ import ToggleSwitch from 'primevue/toggleswitch'
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'

import { useDialogService } from '@/services/dialogService'
import type { components } from '@/types/comfyRegistryTypes'
import { useConflictAcknowledgment } from '@/workbench/extensions/manager/composables/useConflictAcknowledgment'
import { useImportFailedDetection } from '@/workbench/extensions/manager/composables/useImportFailedDetection'
import { useComfyManagerStore } from '@/workbench/extensions/manager/stores/comfyManagerStore'
import { useNodeConflictDialog } from '@/workbench/extensions/manager/composables/useNodeConflictDialog'
import { useConflictDetectionStore } from '@/workbench/extensions/manager/stores/conflictDetectionStore'
import type { components as ManagerComponents } from '@/workbench/extensions/manager/types/generatedManagerTypes'

Expand All @@ -54,7 +54,7 @@ const { t } = useI18n()
const { isPackEnabled, enablePack, disablePack, installedPacks } =
useComfyManagerStore()
const { getConflictsForPackageByID } = useConflictDetectionStore()
const { showNodeConflictDialog } = useDialogService()
const { show: showNodeConflictDialog } = useNodeConflictDialog()
const { acknowledgmentState, markConflictsAsSeen } = useConflictAcknowledgment()
const { showImportFailedDialog } = useImportFailedDetection(nodePack.id || '')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import { useI18n } from 'vue-i18n'
import DotSpinner from '@/components/common/DotSpinner.vue'
import Button from '@/components/ui/button/Button.vue'
import type { ButtonVariants } from '@/components/ui/button/button.variants'
import { useDialogService } from '@/services/dialogService'
import type { components } from '@/types/comfyRegistryTypes'
import { useConflictDetection } from '@/workbench/extensions/manager/composables/useConflictDetection'
import { useNodeConflictDialog } from '@/workbench/extensions/manager/composables/useNodeConflictDialog'
import { useComfyManagerStore } from '@/workbench/extensions/manager/stores/comfyManagerStore'
import type {
ConflictDetail,
Expand All @@ -55,7 +55,7 @@ const {
}>()

const managerStore = useComfyManagerStore()
const { showNodeConflictDialog } = useDialogService()
const { show: showNodeConflictDialog } = useNodeConflictDialog()
const { t } = useI18n()

// Check if any of the packs are currently being installed
Expand Down
Loading
Loading