mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 15:24:09 +00:00
## Summary Add a dedicated **Errors tab** to the Right Side Panel that displays prompt-level, node validation, and runtime execution errors in a unified, searchable, grouped view — replacing the need to rely solely on modal dialogs for error inspection. ## Changes - **What**: - **New components** (`errors/` directory): - `TabErrors.vue` — Main error tab with search, grouping by class type, and canvas navigation (locate node / enter subgraph). - `ErrorNodeCard.vue` — Renders a single error card with node ID badge, title, action buttons, and error details. - `types.ts` — Shared type definitions (`ErrorItem`, `ErrorCardData`, `ErrorGroup`). - **`executionStore.ts`** — Added `PromptError` interface, `lastPromptError` ref and `hasAnyError` computed getter. Clears `lastPromptError` alongside existing error state on execution start and graph clear. - **`rightSidePanelStore.ts`** — Registered `'errors'` as a valid tab value. - **`app.ts`** — On prompt submission failure (`PromptExecutionError`), stores prompt-level errors (when no node errors exist) into `lastPromptError`. On both runtime execution error and prompt error, deselects all nodes and opens the errors tab automatically. - **`RightSidePanel.vue`** — Shows the `'errors'` tab (with ⚠ icon) when errors exist and no node is selected. Routes to `TabErrors` component. - **`TopMenuSection.vue`** — Highlights the action bar with a red border when any error exists, using `hasAnyError`. - **`SectionWidgets.vue`** — Detects per-node errors by matching execution IDs to graph node IDs. Shows an error icon (⚠) and "See Error" button that navigates to the errors tab. - **`en/main.json`** — Added i18n keys: `errors`, `noErrors`, `enterSubgraph`, `seeError`, `promptErrors.*`, and `errorHelp*`. - **Testing**: 6 unit tests (`TabErrors.test.ts`) covering prompt/node/runtime errors, search filtering, and clipboard copy. - **Storybook**: 7 stories (`ErrorNodeCard.stories.ts`) for badge visibility, subgraph buttons, multiple errors, runtime tracebacks, and prompt-only errors. - **Breaking**: None - **Dependencies**: None — uses only existing project dependencies (`vue-i18n`, `pinia`, `primevue`) ## Related Work > **Note**: Upstream PR #8603 (`New bottom button and badges`) introduced a separate `TabError.vue` (singular) that shows per-node errors when a specific node is selected. Our `TabErrors.vue` (plural) provides the **global error overview** — a different scope. The two tabs coexist: > - `'error'` (singular) → appears when a node with errors is selected → shows only that node's errors > - `'errors'` (plural) → appears when no node is selected and errors exist → shows all errors grouped by class type > > A future consolidation of these two tabs may be desirable after design review. ## Architecture ``` executionStore ├── lastPromptError: PromptError | null ← NEW (prompt-level errors without node IDs) ├── lastNodeErrors: Record<string, NodeError> (existing) ├── lastExecutionError: ExecutionError (existing) └── hasAnyError: ComputedRef<boolean> ← NEW (centralized error detection) TabErrors.vue (errors tab - global view) ├── errorGroups: ComputedRef<ErrorGroup[]> ← normalizes all 3 error sources ├── filteredGroups ← search-filtered view ├── locateNode() ← pan canvas to node ├── enterSubgraph() ← navigate into subgraph └── ErrorNodeCard.vue ← per-node card with copy/locate actions types.ts ├── ErrorItem { message, details?, isRuntimeError? } ├── ErrorCardData { id, title, nodeId?, errors[] } └── ErrorGroup { title, cards[], priority } ``` ## Review Focus 1. **Error normalization logic** (`TabErrors.vue` L75–150): Three different error sources (prompt, node validation, runtime) are normalized into a common `ErrorGroup → ErrorCardData → ErrorItem` hierarchy. Edge cases to verify: - Prompt errors with known vs unknown types (known types use localized descriptions) - Multiple errors on the same node (grouped into one card) - Runtime errors with long tracebacks (capped height with scroll) 2. **Canvas navigation** (`TabErrors.vue` L210–250): The `locateNode` and `enterSubgraph` functions navigate to potentially nested subgraphs. The double `requestAnimationFrame` is required due to LiteGraph's asynchronous subgraph switching — worth verifying this timing is sufficient. 3. **Store getter consolidation**: `hasAnyError` replaces duplicated logic in `TopMenuSection` and `RightSidePanel`. Confirm that the reactive dependency chain works correctly (it depends on 3 separate refs). 4. **Coexistence with upstream `TabError.vue`**: The singular `'error'` tab (upstream, PR #8603) and our plural `'errors'` tab serve different purposes but share similar naming. Consider whether a unified approach is preferred. ## Test Results ``` ✓ renders "no errors" state when store is empty ✓ renders prompt-level errors (Group title = error message) ✓ renders node validation errors grouped by class_type ✓ renders runtime execution errors from WebSocket ✓ filters errors based on search query ✓ calls copyToClipboard when copy button is clicked Test Files 1 passed (1) Tests 6 passed (6) ``` ## Screenshots (if applicable) <img width="1238" height="1914" alt="image" src="https://github.com/user-attachments/assets/ec39b872-cca1-4076-8795-8bc7c05dc665" /> <img width="669" height="1028" alt="image" src="https://github.com/user-attachments/assets/bdcaa82a-34b0-46a5-a08f-14950c5a479b" /> <img width="644" height="1005" alt="image" src="https://github.com/user-attachments/assets/ffef38c6-8f42-4c01-a0de-11709d54b638" /> <img width="672" height="505" alt="image" src="https://github.com/user-attachments/assets/5cff7f57-8d79-4808-a71e-9ad05bab6e17" /> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8807-Feat-errors-tab-panel-3046d73d36508127981ac670a70da467) by [Unito](https://www.unito.io)
317 lines
12 KiB
Vue
317 lines
12 KiB
Vue
<template>
|
|
<div
|
|
v-if="!workspaceStore.focusMode"
|
|
class="ml-1 flex flex-col gap-1 pt-1"
|
|
@mouseenter="isTopMenuHovered = true"
|
|
@mouseleave="isTopMenuHovered = false"
|
|
>
|
|
<div class="flex gap-x-0.5">
|
|
<div class="min-w-0 flex-1">
|
|
<SubgraphBreadcrumb />
|
|
</div>
|
|
|
|
<div class="mx-1 flex flex-col items-end gap-1">
|
|
<div class="flex items-center gap-2">
|
|
<div
|
|
v-if="managerState.shouldShowManagerButtons.value"
|
|
class="pointer-events-auto flex h-12 shrink-0 items-center rounded-lg border border-interface-stroke bg-comfy-menu-bg px-2 shadow-interface"
|
|
>
|
|
<Button
|
|
v-tooltip.bottom="customNodesManagerTooltipConfig"
|
|
variant="secondary"
|
|
:aria-label="t('menu.manageExtensions')"
|
|
class="relative"
|
|
@click="openCustomNodeManager"
|
|
>
|
|
<i class="icon-[comfy--extensions-blocks] size-4" />
|
|
<span class="not-md:hidden">
|
|
{{ t('menu.manageExtensions') }}
|
|
</span>
|
|
<span
|
|
v-if="shouldShowRedDot"
|
|
class="absolute top-0.5 right-1 size-2 rounded-full bg-red-500"
|
|
/>
|
|
</Button>
|
|
</div>
|
|
|
|
<div
|
|
ref="actionbarContainerRef"
|
|
:class="
|
|
cn(
|
|
'actionbar-container relative pointer-events-auto flex gap-2 h-12 items-center rounded-lg border bg-comfy-menu-bg px-2 shadow-interface',
|
|
hasAnyError
|
|
? 'border-destructive-background-hover'
|
|
: 'border-interface-stroke'
|
|
)
|
|
"
|
|
>
|
|
<ActionBarButtons />
|
|
<!-- Support for legacy topbar elements attached by custom scripts, hidden if no elements present -->
|
|
<div
|
|
ref="legacyCommandsContainerRef"
|
|
class="[&:not(:has(*>*:not(:empty)))]:hidden"
|
|
></div>
|
|
<ComfyActionbar
|
|
:top-menu-container="actionbarContainerRef"
|
|
:queue-overlay-expanded="isQueueOverlayExpanded"
|
|
@update:progress-target="updateProgressTarget"
|
|
/>
|
|
<Button
|
|
v-tooltip.bottom="queueHistoryTooltipConfig"
|
|
type="destructive"
|
|
size="md"
|
|
:aria-pressed="
|
|
isQueuePanelV2Enabled
|
|
? activeSidebarTabId === 'assets'
|
|
: isQueueProgressOverlayEnabled
|
|
? isQueueOverlayExpanded
|
|
: undefined
|
|
"
|
|
class="relative px-3"
|
|
data-testid="queue-overlay-toggle"
|
|
@click="toggleQueueOverlay"
|
|
@contextmenu.stop.prevent="showQueueContextMenu"
|
|
>
|
|
<span class="text-sm font-normal tabular-nums">
|
|
{{ activeJobsLabel }}
|
|
</span>
|
|
<StatusBadge
|
|
v-if="activeJobsCount > 0"
|
|
data-testid="active-jobs-indicator"
|
|
variant="dot"
|
|
class="pointer-events-none absolute -top-0.5 -right-0.5 animate-pulse"
|
|
/>
|
|
<span class="sr-only">
|
|
{{
|
|
isQueuePanelV2Enabled
|
|
? t('sideToolbar.queueProgressOverlay.viewJobHistory')
|
|
: t('sideToolbar.queueProgressOverlay.expandCollapsedQueue')
|
|
}}
|
|
</span>
|
|
</Button>
|
|
<ContextMenu
|
|
ref="queueContextMenu"
|
|
:model="queueContextMenuItems"
|
|
/>
|
|
<CurrentUserButton
|
|
v-if="isLoggedIn && !isIntegratedTabBar"
|
|
class="shrink-0"
|
|
/>
|
|
<LoginButton v-else-if="isDesktop && !isIntegratedTabBar" />
|
|
<Button
|
|
v-if="!isRightSidePanelOpen"
|
|
v-tooltip.bottom="rightSidePanelTooltipConfig"
|
|
type="secondary"
|
|
size="icon"
|
|
:aria-label="t('rightSidePanel.togglePanel')"
|
|
@click="rightSidePanelStore.togglePanel"
|
|
>
|
|
<i class="icon-[lucide--panel-right] size-4" />
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
<QueueProgressOverlay
|
|
v-if="isQueueProgressOverlayEnabled"
|
|
v-model:expanded="isQueueOverlayExpanded"
|
|
:menu-hovered="isTopMenuHovered"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex flex-col items-end gap-1">
|
|
<Teleport
|
|
v-if="inlineProgressSummaryTarget"
|
|
:to="inlineProgressSummaryTarget"
|
|
>
|
|
<div
|
|
class="pointer-events-none absolute left-0 right-0 top-full mt-1 flex justify-end pr-1"
|
|
>
|
|
<QueueInlineProgressSummary :hidden="isQueueOverlayExpanded" />
|
|
</div>
|
|
</Teleport>
|
|
<QueueInlineProgressSummary
|
|
v-else-if="shouldShowInlineProgressSummary && !isActionbarFloating"
|
|
class="pr-1"
|
|
:hidden="isQueueOverlayExpanded"
|
|
/>
|
|
<QueueNotificationBannerHost
|
|
v-if="shouldShowQueueNotificationBanners"
|
|
class="pr-1"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { useLocalStorage } from '@vueuse/core'
|
|
import { storeToRefs } from 'pinia'
|
|
import ContextMenu from 'primevue/contextmenu'
|
|
import type { MenuItem } from 'primevue/menuitem'
|
|
import { computed, onMounted, ref } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
import ComfyActionbar from '@/components/actionbar/ComfyActionbar.vue'
|
|
import SubgraphBreadcrumb from '@/components/breadcrumb/SubgraphBreadcrumb.vue'
|
|
import StatusBadge from '@/components/common/StatusBadge.vue'
|
|
import QueueInlineProgressSummary from '@/components/queue/QueueInlineProgressSummary.vue'
|
|
import QueueNotificationBannerHost from '@/components/queue/QueueNotificationBannerHost.vue'
|
|
import QueueProgressOverlay from '@/components/queue/QueueProgressOverlay.vue'
|
|
import ActionBarButtons from '@/components/topbar/ActionBarButtons.vue'
|
|
import CurrentUserButton from '@/components/topbar/CurrentUserButton.vue'
|
|
import LoginButton from '@/components/topbar/LoginButton.vue'
|
|
import Button from '@/components/ui/button/Button.vue'
|
|
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
|
|
import { useErrorHandling } from '@/composables/useErrorHandling'
|
|
import { buildTooltipConfig } from '@/composables/useTooltipConfig'
|
|
import { useSettingStore } from '@/platform/settings/settingStore'
|
|
import { app } from '@/scripts/app'
|
|
import { useCommandStore } from '@/stores/commandStore'
|
|
import { useExecutionStore } from '@/stores/executionStore'
|
|
import { useQueueStore, useQueueUIStore } from '@/stores/queueStore'
|
|
import { useRightSidePanelStore } from '@/stores/workspace/rightSidePanelStore'
|
|
import { useSidebarTabStore } from '@/stores/workspace/sidebarTabStore'
|
|
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
|
import { isDesktop } from '@/platform/distribution/types'
|
|
import { useConflictAcknowledgment } from '@/workbench/extensions/manager/composables/useConflictAcknowledgment'
|
|
import { useManagerState } from '@/workbench/extensions/manager/composables/useManagerState'
|
|
import { ManagerTab } from '@/workbench/extensions/manager/types/comfyManagerTypes'
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
|
|
const settingStore = useSettingStore()
|
|
const workspaceStore = useWorkspaceStore()
|
|
const rightSidePanelStore = useRightSidePanelStore()
|
|
const managerState = useManagerState()
|
|
const { isLoggedIn } = useCurrentUser()
|
|
const { t, n } = useI18n()
|
|
const { toastErrorHandler } = useErrorHandling()
|
|
const commandStore = useCommandStore()
|
|
const queueStore = useQueueStore()
|
|
const executionStore = useExecutionStore()
|
|
const queueUIStore = useQueueUIStore()
|
|
const sidebarTabStore = useSidebarTabStore()
|
|
const { activeJobsCount } = storeToRefs(queueStore)
|
|
const { isOverlayExpanded: isQueueOverlayExpanded } = storeToRefs(queueUIStore)
|
|
const { activeSidebarTabId } = storeToRefs(sidebarTabStore)
|
|
const { shouldShowRedDot: shouldShowConflictRedDot } =
|
|
useConflictAcknowledgment()
|
|
const isTopMenuHovered = ref(false)
|
|
const actionbarContainerRef = ref<HTMLElement>()
|
|
const isActionbarDocked = useLocalStorage('Comfy.MenuPosition.Docked', true)
|
|
const actionbarPosition = computed(() => settingStore.get('Comfy.UseNewMenu'))
|
|
const isActionbarEnabled = computed(
|
|
() => actionbarPosition.value !== 'Disabled'
|
|
)
|
|
const isActionbarFloating = computed(
|
|
() => isActionbarEnabled.value && !isActionbarDocked.value
|
|
)
|
|
const activeJobsLabel = computed(() => {
|
|
const count = activeJobsCount.value
|
|
return t(
|
|
'sideToolbar.queueProgressOverlay.activeJobsShort',
|
|
{ count: n(count) },
|
|
count
|
|
)
|
|
})
|
|
const isIntegratedTabBar = computed(
|
|
() => settingStore.get('Comfy.UI.TabBarLayout') === 'Integrated'
|
|
)
|
|
const isQueuePanelV2Enabled = computed(() =>
|
|
settingStore.get('Comfy.Queue.QPOV2')
|
|
)
|
|
const isQueueProgressOverlayEnabled = computed(
|
|
() => !isQueuePanelV2Enabled.value
|
|
)
|
|
const shouldShowInlineProgressSummary = computed(
|
|
() => isQueuePanelV2Enabled.value && isActionbarEnabled.value
|
|
)
|
|
const shouldShowQueueNotificationBanners = computed(
|
|
() => isActionbarEnabled.value
|
|
)
|
|
const progressTarget = ref<HTMLElement | null>(null)
|
|
function updateProgressTarget(target: HTMLElement | null) {
|
|
progressTarget.value = target
|
|
}
|
|
const inlineProgressSummaryTarget = computed(() => {
|
|
if (!shouldShowInlineProgressSummary.value || !isActionbarFloating.value) {
|
|
return null
|
|
}
|
|
return progressTarget.value
|
|
})
|
|
const queueHistoryTooltipConfig = computed(() =>
|
|
buildTooltipConfig(t('sideToolbar.queueProgressOverlay.viewJobHistory'))
|
|
)
|
|
const customNodesManagerTooltipConfig = computed(() =>
|
|
buildTooltipConfig(t('menu.manageExtensions'))
|
|
)
|
|
const queueContextMenu = ref<InstanceType<typeof ContextMenu> | null>(null)
|
|
const queueContextMenuItems = computed<MenuItem[]>(() => [
|
|
{
|
|
label: t('sideToolbar.queueProgressOverlay.clearQueueTooltip'),
|
|
icon: 'icon-[lucide--list-x] text-destructive-background',
|
|
class: '*:text-destructive-background',
|
|
disabled: queueStore.pendingTasks.length === 0,
|
|
command: () => {
|
|
void handleClearQueue()
|
|
}
|
|
}
|
|
])
|
|
|
|
const shouldShowRedDot = computed((): boolean => {
|
|
return shouldShowConflictRedDot.value
|
|
})
|
|
|
|
const { hasAnyError } = storeToRefs(executionStore)
|
|
|
|
// Right side panel toggle
|
|
const { isOpen: isRightSidePanelOpen } = storeToRefs(rightSidePanelStore)
|
|
const rightSidePanelTooltipConfig = computed(() =>
|
|
buildTooltipConfig(t('rightSidePanel.togglePanel'))
|
|
)
|
|
|
|
// Maintain support for legacy topbar elements attached by custom scripts
|
|
const legacyCommandsContainerRef = ref<HTMLElement>()
|
|
onMounted(() => {
|
|
if (legacyCommandsContainerRef.value) {
|
|
app.menu.element.style.width = 'fit-content'
|
|
legacyCommandsContainerRef.value.appendChild(app.menu.element)
|
|
}
|
|
})
|
|
|
|
const toggleQueueOverlay = () => {
|
|
if (isQueuePanelV2Enabled.value) {
|
|
sidebarTabStore.toggleSidebarTab('assets')
|
|
return
|
|
}
|
|
commandStore.execute('Comfy.Queue.ToggleOverlay')
|
|
}
|
|
|
|
const showQueueContextMenu = (event: MouseEvent) => {
|
|
queueContextMenu.value?.show(event)
|
|
}
|
|
|
|
const handleClearQueue = async () => {
|
|
const pendingPromptIds = queueStore.pendingTasks
|
|
.map((task) => task.promptId)
|
|
.filter((id): id is string => typeof id === 'string' && id.length > 0)
|
|
|
|
await commandStore.execute('Comfy.ClearPendingTasks')
|
|
executionStore.clearInitializationByPromptIds(pendingPromptIds)
|
|
}
|
|
|
|
const openCustomNodeManager = async () => {
|
|
try {
|
|
await managerState.openManager({
|
|
initialTab: ManagerTab.All,
|
|
showToastOnLegacyError: false
|
|
})
|
|
} catch (error) {
|
|
try {
|
|
toastErrorHandler(error)
|
|
} catch (toastError) {
|
|
console.error(error)
|
|
console.error(toastError)
|
|
}
|
|
}
|
|
}
|
|
</script>
|