mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix: Update remaining Canvas usages
This commit is contained in:
parent
f667c3ec48
commit
9401214700
|
@ -11,6 +11,7 @@ import { N8nTooltip } from '@n8n/design-system';
|
|||
import { createEventBus } from '@n8n/utils/event-bus';
|
||||
import { computed, onMounted, ref, useCssModule } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import type { INodeTypeDescription } from 'n8n-workflow';
|
||||
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const nodeTypesStore = useNodeTypesStore();
|
||||
|
@ -51,6 +52,23 @@ const { nodes: mappedNodes, connections: mappedConnections } = useCanvasMapping(
|
|||
connections,
|
||||
workflowObject,
|
||||
});
|
||||
|
||||
const nodeTypeDescriptions = computed(() => {
|
||||
return nodes.value.reduce<Record<string, INodeTypeDescription>>((acc, node) => {
|
||||
const key = `${node.type}@${node.typeVersion}`;
|
||||
if (acc[key]) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
const nodeTypeDescription = nodeTypesStore.getNodeType(node.type, node.typeVersion);
|
||||
if (nodeTypeDescription) {
|
||||
acc[key] = nodeTypeDescription;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
});
|
||||
|
||||
async function loadData() {
|
||||
workflowsStore.resetState();
|
||||
resetWorkspace();
|
||||
|
@ -141,6 +159,7 @@ onMounted(loadData);
|
|||
:class="{ [$style.canvas]: true }"
|
||||
:nodes="mappedNodes"
|
||||
:connections="mappedConnections"
|
||||
:node-type-descriptions="nodeTypeDescriptions"
|
||||
:show-bug-reporting-button="false"
|
||||
:read-only="true"
|
||||
:event-bus="eventBus"
|
||||
|
|
|
@ -97,8 +97,8 @@ const props = withDefaults(
|
|||
defineProps<{
|
||||
id?: string;
|
||||
nodes: CanvasNode[];
|
||||
nodeTypeDescriptions: Record<string, INodeTypeDescription>;
|
||||
connections: CanvasConnection[];
|
||||
nodeTypeDescriptions?: Record<string, INodeTypeDescription>;
|
||||
controlsPosition?: PanelPosition;
|
||||
eventBus?: EventBus<CanvasEventBusEvents>;
|
||||
readOnly?: boolean;
|
||||
|
@ -110,6 +110,7 @@ const props = withDefaults(
|
|||
id: 'canvas',
|
||||
nodes: () => [],
|
||||
connections: () => [],
|
||||
nodeTypeDescriptions: () => ({}),
|
||||
controlsPosition: PanelPosition.BottomLeft,
|
||||
eventBus: () => createEventBus(),
|
||||
readOnly: false,
|
||||
|
|
|
@ -99,8 +99,8 @@ onNodesInitialized(() => {
|
|||
v-if="workflow"
|
||||
:id="id"
|
||||
:nodes="mappedNodes"
|
||||
:node-type-descriptions="nodeTypeDescriptions"
|
||||
:connections="mappedConnections"
|
||||
:node-type-descriptions="nodeTypeDescriptions"
|
||||
:event-bus="eventBus"
|
||||
:read-only="readOnly"
|
||||
v-bind="$attrs"
|
||||
|
|
Loading…
Reference in a new issue