Line data Source code
1 : import type { MissingNodeType } from '@/platform/workflowErrors/nodeReplacement/types'
2 : import { useExecutionErrorStore } from '@/stores/executionErrorStore'
3 :
4 : type MissingNodesNotice = (nodeTypes: readonly MissingNodeType[]) => void
5 :
6 2356 : const showErrorOverlay: MissingNodesNotice = () =>
7 : useExecutionErrorStore().showErrorOverlay()
8 :
9 2356 : let notice: MissingNodesNotice = showErrorOverlay
10 :
11 : /** Tells the user that a workflow just opened needs nodes this editor lacks: the error overlay, unless a surface set its own notice. */
12 43 : export function showMissingNodesNotice(
13 : nodeTypes: readonly MissingNodeType[]
14 : ): void {
15 43 : notice(nodeTypes)
16 : }
17 :
18 : /** Replaces the notice `showMissingNodesNotice` gives; the returned function puts the error overlay back. */
19 0 : export function setMissingNodesNotice(next: MissingNodesNotice): () => void {
20 0 : notice = next
21 0 : return () => {
22 0 : if (notice === next) notice = showErrorOverlay
23 : }
24 : }
|