Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/components/dialog/content/MissingNodesFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<!-- OSS mode: Open Manager + Install All buttons -->
<div v-else-if="showManagerButtons" class="flex justify-end gap-1 py-2 px-4">
<Button variant="textonly" size="sm" @click="openManager">{{
<Button variant="textonly" @click="openManager">{{
$t('g.openManager')
}}</Button>
<PackInstallButton
Expand Down
4 changes: 4 additions & 0 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@
"warningTooltip": "This package may have compatibility issues with your current environment"
}
},
"importFailed": {
"title": "Import Failed",
"copyError": "Copy Error"
},
"issueReport": {
"helpFix": "Help Fix This"
},
Expand Down
41 changes: 41 additions & 0 deletions src/services/dialogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import ManagerProgressFooter from '@/workbench/extensions/manager/components/Man
import ManagerProgressHeader from '@/workbench/extensions/manager/components/ManagerProgressHeader.vue'
import ManagerDialogContent from '@/workbench/extensions/manager/components/manager/ManagerDialogContent.vue'
import ManagerHeader from '@/workbench/extensions/manager/components/manager/ManagerHeader.vue'
import ImportFailedNodeContent from '@/workbench/extensions/manager/components/manager/ImportFailedNodeContent.vue'
import ImportFailedNodeFooter from '@/workbench/extensions/manager/components/manager/ImportFailedNodeFooter.vue'
import ImportFailedNodeHeader from '@/workbench/extensions/manager/components/manager/ImportFailedNodeHeader.vue'
import NodeConflictDialogContent from '@/workbench/extensions/manager/components/manager/NodeConflictDialogContent.vue'
import NodeConflictFooter from '@/workbench/extensions/manager/components/manager/NodeConflictFooter.vue'
import NodeConflictHeader from '@/workbench/extensions/manager/components/manager/NodeConflictHeader.vue'
Expand Down Expand Up @@ -482,6 +485,43 @@ export const useDialogService = () => {
})
}

function showImportFailedNodeDialog(
options: {
conflictedPackages?: ConflictDetectionResult[]
dialogComponentProps?: DialogComponentProps
} = {}
) {
const { dialogComponentProps, conflictedPackages } = options

return dialogStore.showDialog({
key: 'global-import-failed',
headerComponent: ImportFailedNodeHeader,
footerComponent: ImportFailedNodeFooter,
component: ImportFailedNodeContent,
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'
}
}
},
...dialogComponentProps
},
props: {
conflictedPackages: conflictedPackages ?? []
},
footerProps: {
conflictedPackages: conflictedPackages ?? []
}
})
}

function showNodeConflictDialog(
options: {
showAfterWhatsNew?: boolean
Expand Down Expand Up @@ -561,6 +601,7 @@ export const useDialogService = () => {
toggleManagerDialog,
toggleManagerProgressDialog,
showLayoutDialog,
showImportFailedNodeDialog,
showNodeConflictDialog
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<template>
<div class="flex w-[490px] flex-col border-t-1 border-border-default">
<div class="flex h-full w-full flex-col gap-4 p-4">
<!-- Error Details -->
<div v-if="importFailedPackages.length > 0" class="flex flex-col gap-3">
<div
v-for="pkg in importFailedPackages"
:key="pkg.packageId"
class="flex flex-col gap-2 max-h-60 overflow-x-hidden overflow-y-auto scrollbar-custom"
role="region"
:aria-label="`Error traceback for ${pkg.packageId}`"
tabindex="0"
>
<!-- Error Message -->
<div
v-if="pkg.traceback || pkg.errorMessage"
class="text-xs p-4 rounded-md bg-secondary-background font-mono"
>
{{ pkg.traceback || pkg.errorMessage }}
</div>
</div>
</div>
</div>
</div>
</template>

<script setup lang="ts">
import { computed } from 'vue'

import type { ConflictDetectionResult } from '@/workbench/extensions/manager/types/conflictDetectionTypes'

const { conflictedPackages } = defineProps<{
conflictedPackages: ConflictDetectionResult[]
}>()

interface ImportFailedPackage {
packageId: string
packageName: string
errorMessage: string
traceback: string
}

const importFailedPackages = computed((): ImportFailedPackage[] => {
return conflictedPackages
.filter((pkg) =>
pkg.conflicts.some((conflict) => conflict.type === 'import_failed')
)
.map((pkg) => {
const importFailedConflict = pkg.conflicts.find(
(conflict) => conflict.type === 'import_failed'
)
if (!importFailedConflict) {
return {
packageId: pkg.package_id,
packageName: pkg.package_name,
errorMessage: 'Unknown import error',
traceback: ''
}
}

return {
packageId: pkg.package_id,
packageName: pkg.package_name,
errorMessage:
importFailedConflict.current_value || 'Unknown import error',
traceback: importFailedConflict.required_value || ''
}
})
})
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template>
<div class="flex w-full items-center justify-between px-3 pb-4">
<div class="flex w-full items-start justify-end gap-2 pr-1">
<Button variant="secondary" @click="handleCopyError">
{{ $t('importFailed.copyError') }}
</Button>
</div>
</div>
</template>

<script setup lang="ts">
import { computed } from 'vue'

import Button from '@/components/ui/button/Button.vue'
import { useCopyToClipboard } from '@/composables/useCopyToClipboard'
import type { ConflictDetectionResult } from '@/workbench/extensions/manager/types/conflictDetectionTypes'

const { conflictedPackages = [] } = defineProps<{
conflictedPackages?: ConflictDetectionResult[]
}>()

const { copyToClipboard } = useCopyToClipboard()

const formatErrorText = computed(() => {
const errorParts: string[] = []

conflictedPackages.forEach((pkg) => {
const importFailedConflict = pkg.conflicts.find(
(conflict) => conflict.type === 'import_failed'
)

if (importFailedConflict?.required_value) {
errorParts.push(importFailedConflict.required_value)
}
})

return errorParts.join('\n\n')
})

const handleCopyError = () => {
copyToClipboard(formatErrorText.value)
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<div class="flex w-full items-center justify-between p-4">
<div class="flex items-center gap-2">
<i class="icon-[lucide--triangle-alert] text-gold-600"></i>
<p class="m-0 text-sm">
{{ $t('importFailed.title') }}
</p>
</div>
</div>
</template>

<script setup lang="ts"></script>
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ describe('NodeConflictDialogContent', () => {
await conflictsHeader.trigger('click')

// Should be expanded now
const conflictItems = wrapper.findAll('.conflict-list-item')
const conflictItems = wrapper.findAll('[aria-label*="Conflict:"]')
expect(conflictItems.length).toBeGreaterThan(0)
})

Expand Down Expand Up @@ -324,7 +324,7 @@ describe('NodeConflictDialogContent', () => {
await conflictsHeader.trigger('click')

// Should display conflict messages (excluding import_failed)
const conflictItems = wrapper.findAll('.conflict-list-item')
const conflictItems = wrapper.findAll('[aria-label*="Conflict:"]')
expect(conflictItems).toHaveLength(3) // 2 from Package1 + 1 from Package2
})

Expand All @@ -338,7 +338,9 @@ describe('NodeConflictDialogContent', () => {
await importFailedHeader.trigger('click')

// Should display only import failed package
const importFailedItems = wrapper.findAll('.conflict-list-item')
const importFailedItems = wrapper.findAll(
'[aria-label*="Import failed package:"]'
)
expect(importFailedItems).toHaveLength(1)
expect(importFailedItems[0].text()).toContain('Test Package 3')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
<div
v-for="(packageName, i) in importFailedConflicts"
:key="i"
class="conflict-list-item flex h-6 shrink-0 items-center justify-between px-4"
:aria-label="`Import failed package: ${packageName}`"
class="flex min-h-6 shrink-0 hover:bg-node-component-surface-hovered items-center justify-between px-4 py-1"
>
<span class="text-xs text-muted">
{{ packageName }}
Expand Down Expand Up @@ -98,7 +99,8 @@
<div
v-for="(conflict, i) in allConflictDetails"
:key="i"
class="conflict-list-item flex h-6 shrink-0 items-center justify-between px-4"
:aria-label="`Conflict: ${getConflictMessage(conflict, t)}`"
class="flex min-h-6 shrink-0 hover:bg-node-component-surface-hovered items-center justify-between px-4 py-1"
>
<span class="text-xs text-muted">{{
getConflictMessage(conflict, t)
Expand Down Expand Up @@ -146,7 +148,7 @@
<div
v-for="conflictResult in conflictData"
:key="conflictResult.package_id"
class="conflict-list-item flex h-6 shrink-0 items-center justify-between px-4"
class="flex min-h-6 shrink-0 hover:bg-node-component-surface-hovered items-center justify-between px-4 py-1"
>
<span class="text-xs text-muted">
{{ conflictResult.package_name }}
Expand Down Expand Up @@ -236,8 +238,3 @@ const toggleExtensionsPanel = () => {
importFailedExpanded.value = false
}
</script>
<style scoped>
.conflict-list-item:hover {
background-color: rgb(0 122 255 / 0.2);
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="flex h-12 w-full items-center justify-between pl-6">
<div class="flex items-center gap-2">
<!-- Warning Icon -->
<i class="pi pi-exclamation-triangle text-lg"></i>
<i class="icon-[lucide--triangle-alert] text-gold-600"></i>
<!-- Title -->
<p class="text-base font-bold">
{{ $t('manager.conflicts.title') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import { useComfyManagerStore } from '@/workbench/extensions/manager/stores/comf
import { useConflictDetectionStore } from '@/workbench/extensions/manager/stores/conflictDetectionStore'
import type { components as ManagerComponents } from '@/workbench/extensions/manager/types/generatedManagerTypes'

import { useImportFailedDetection } from '../../../composables/useImportFailedDetection'

const TOGGLE_DEBOUNCE_MS = 256

const { nodePack } = defineProps<{
Expand All @@ -53,6 +55,7 @@ const { isPackEnabled, enablePack, disablePack, installedPacks } =
const { getConflictsForPackageByID } = useConflictDetectionStore()
const { showNodeConflictDialog } = useDialogService()
const { acknowledgmentState, markConflictsAsSeen } = useConflictAcknowledgment()
const { showImportFailedDialog } = useImportFailedDetection(nodePack.id || '')

const isLoading = ref(false)

Expand Down Expand Up @@ -81,23 +84,36 @@ const canToggleDirectly = computed(() => {
const showConflictModal = (skipModalDismissed: boolean) => {
let modal_dismissed = acknowledgmentState.value.modal_dismissed
if (skipModalDismissed) modal_dismissed = false

if (packageConflict.value && !modal_dismissed) {
showNodeConflictDialog({
conflictedPackages: [packageConflict.value],
buttonText: !isEnabled.value
? t('manager.conflicts.enableAnyway')
: t('manager.conflicts.understood'),
onButtonClick: async () => {
if (!isEnabled.value) {
await handleEnable()
}
},
dialogComponentProps: {
onClose: () => {
markConflictsAsSeen()
// Check if there's an import failed conflict first
const hasImportFailed = packageConflict.value.conflicts.some(
(conflict) => conflict.type === 'import_failed'
)
if (hasImportFailed) {
// Show import failed dialog instead of general conflict dialog
showImportFailedDialog(() => {
markConflictsAsSeen()
})
} else {
// Show general conflict dialog for other types of conflicts
showNodeConflictDialog({
conflictedPackages: [packageConflict.value],
buttonText: !isEnabled.value
? t('manager.conflicts.enableAnyway')
: t('manager.conflicts.understood'),
onButtonClick: async () => {
if (!isEnabled.value) {
await handleEnable()
}
},
dialogComponentProps: {
onClose: () => {
markConflictsAsSeen()
}
}
}
})
})
}
}
}

Expand Down
Loading