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
32 changes: 26 additions & 6 deletions src/components/ui/select/SelectItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ import type { HTMLAttributes } from 'vue'

import { cn } from '@comfyorg/tailwind-utils'

const { class: className, ...restProps } = defineProps<
SelectItemProps & { class?: HTMLAttributes['class'] }
const {
class: className,
textClass,
reserveIndicator = false,
...restProps
} = defineProps<
SelectItemProps & {
class?: HTMLAttributes['class']
/** Classes for the item's text, which holds the slot. */
textClass?: HTMLAttributes['class']
/** Keeps the check's column on unchecked items too, so text that ends at the right lines up. */
reserveIndicator?: boolean
}
>()
</script>

Expand All @@ -26,12 +37,21 @@ const { class: className, ...restProps } = defineProps<
)
"
>
<SelectItemText class="truncate">
<SelectItemText :class="cn('truncate', textClass)">
<slot />
</SelectItemText>

<SelectItemIndicator class="flex shrink-0 items-center justify-center">
<i class="icon-[lucide--check] text-foreground" aria-hidden="true" />
</SelectItemIndicator>
<span
:class="
cn(
'flex shrink-0 items-center justify-center',
reserveIndicator ? 'w-4' : 'empty:hidden'
)
"
>
<SelectItemIndicator class="flex items-center justify-center">
<i class="icon-[lucide--check] text-foreground" aria-hidden="true" />
</SelectItemIndicator>
</span>
</SelectItem>
</template>
11 changes: 9 additions & 2 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4130,8 +4130,15 @@
"missingPacks": "{count} missing node pack | {count} missing node packs",
"missingNodes": "{count} missing node | {count} missing nodes",
"missingModels": "{count} missing model | {count} missing models",
"andMore": "{names}, and {count} more"
},
"andMore": "{names}, and {count} more",
"titleNoneRunIt": "Create a deployment to run this workflow on Comfy Cloud",
"noneRunIt": "No deployment in this workspace has all of these nodes.",
"switchBody": "Comfy Cloud is missing these. Switch to a deployment that has them and keep working from there.",
"switch": "Switch"
},
"runsThisWorkflow": "Runs this workflow",
"missingNodes": "Missing {count} node | Missing {count} nodes",
"notChecked": "Not checked",
"releaseChanged": "This deployment now runs a different Release. Reload to get its nodes.",
"deploymentChanged": "This browser now runs on {deployment}. Reload to get its nodes.",
"reload": "Reload",
Expand Down
4 changes: 2 additions & 2 deletions src/platform/workflow/core/services/workflowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import { useMissingNodesErrorStore } from '@/platform/workflowErrors/nodeReplacement/missingNodesErrorStore'
import { useMissingModelStore } from '@/platform/workflowErrors/missingModel/missingModelStore'
import { useMissingMediaStore } from '@/platform/workflowErrors/missingMedia/missingMediaStore'
import { noticeMissingNodes } from '@/platform/workspace/noticeMissingNodes'
import { showMissingNodesNotice } from '@/platform/workflowErrors/nodeReplacement/missingNodesNotice'

Check warning on line 46 in src/platform/workflow/core/services/workflowService.ts

View workflow job for this annotation

GitHub Actions / fallow / fallow

Boundary violation

Import from zone 'workflow-management/application' to zone 'node-replacement/application/outer-1' is not allowed. src/platform/workflow/core/services/workflowService.ts -> src/platform/workflowErrors/nodeReplacement/missingNodesNotice.ts Route the import through an allowed zone or restructure the dependency.
import { useWorkspaceStore } from '@/stores/workspaceStore'
import {
appendJsonExt,
Expand Down Expand Up @@ -1039,7 +1039,7 @@
missingNodesErrorStore.surfaceMissingNodes(missingNodeTypes ?? []) &&
!options?.silent
) {
void noticeMissingNodes()
showMissingNodesNotice(missingNodeTypes ?? [])
}
if (missingModelCandidates?.length) {
useMissingModelStore().setMissingModels(missingModelCandidates)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { describe, expect, it, vi } from 'vitest'

import {
setMissingNodesNotice,
showMissingNodesNotice
} from '@/platform/workflowErrors/nodeReplacement/missingNodesNotice'
import type { MissingNodeType } from '@/platform/workflowErrors/nodeReplacement/types'
import { useExecutionErrorStore } from '@/stores/executionErrorStore'

Check warning on line 8 in src/platform/workflowErrors/nodeReplacement/missingNodesNotice.test.ts

View workflow job for this annotation

GitHub Actions / fallow / fallow

Boundary violation

Import from zone 'node-replacement/application/outer-1' to zone 'execution/application' is not allowed. src/platform/workflowErrors/nodeReplacement/missingNodesNotice.test.ts -> src/stores/executionErrorStore.ts Route the import through an allowed zone or restructure the dependency.

const NODES: MissingNodeType[] = [{ type: 'BiRefNet', isReplaceable: false }]

describe(showMissingNodesNotice, () => {
it('shows the notice a surface set in place of the error overlay, until the surface takes it back', () => {
const notice = vi.fn()
const restore = setMissingNodesNotice(notice)
showMissingNodesNotice(NODES)

expect(notice).toHaveBeenCalledWith(NODES)
expect(useExecutionErrorStore().isErrorOverlayOpen).toBe(false)

restore()
showMissingNodesNotice(NODES)

expect(notice).toHaveBeenCalledOnce()
expect(useExecutionErrorStore().isErrorOverlayOpen).toBe(true)
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { MissingNodeType } from '@/platform/workflowErrors/nodeReplacement/types'
import { useExecutionErrorStore } from '@/stores/executionErrorStore'

Check warning on line 2 in src/platform/workflowErrors/nodeReplacement/missingNodesNotice.ts

View workflow job for this annotation

GitHub Actions / fallow / fallow

Boundary violation

Import from zone 'node-replacement/application/outer-1' to zone 'execution/application' is not allowed. src/platform/workflowErrors/nodeReplacement/missingNodesNotice.ts -> src/stores/executionErrorStore.ts Route the import through an allowed zone or restructure the dependency.

type MissingNodesNotice = (nodeTypes: readonly MissingNodeType[]) => void

const showErrorOverlay: MissingNodesNotice = () =>
useExecutionErrorStore().showErrorOverlay()

let notice: MissingNodesNotice = showErrorOverlay

/** Tells the user that a workflow just opened needs nodes this editor lacks: the error overlay, unless a surface set its own notice. */
export function showMissingNodesNotice(
nodeTypes: readonly MissingNodeType[]
): void {
notice(nodeTypes)
}

/** Replaces the notice `showMissingNodesNotice` gives; the returned function puts the error overlay back. */
export function setMissingNodesNotice(next: MissingNodesNotice): () => void {
notice = next
return () => {
if (notice === next) notice = showErrorOverlay
}
}
Loading
Loading