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 { createEventBus } from '@n8n/utils/event-bus';
|
||||||
import { computed, onMounted, ref, useCssModule } from 'vue';
|
import { computed, onMounted, ref, useCssModule } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import type { INodeTypeDescription } from 'n8n-workflow';
|
||||||
|
|
||||||
const workflowsStore = useWorkflowsStore();
|
const workflowsStore = useWorkflowsStore();
|
||||||
const nodeTypesStore = useNodeTypesStore();
|
const nodeTypesStore = useNodeTypesStore();
|
||||||
|
@ -51,6 +52,23 @@ const { nodes: mappedNodes, connections: mappedConnections } = useCanvasMapping(
|
||||||
connections,
|
connections,
|
||||||
workflowObject,
|
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() {
|
async function loadData() {
|
||||||
workflowsStore.resetState();
|
workflowsStore.resetState();
|
||||||
resetWorkspace();
|
resetWorkspace();
|
||||||
|
@ -141,6 +159,7 @@ onMounted(loadData);
|
||||||
:class="{ [$style.canvas]: true }"
|
:class="{ [$style.canvas]: true }"
|
||||||
:nodes="mappedNodes"
|
:nodes="mappedNodes"
|
||||||
:connections="mappedConnections"
|
:connections="mappedConnections"
|
||||||
|
:node-type-descriptions="nodeTypeDescriptions"
|
||||||
:show-bug-reporting-button="false"
|
:show-bug-reporting-button="false"
|
||||||
:read-only="true"
|
:read-only="true"
|
||||||
:event-bus="eventBus"
|
:event-bus="eventBus"
|
||||||
|
|
|
@ -97,8 +97,8 @@ const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
id?: string;
|
id?: string;
|
||||||
nodes: CanvasNode[];
|
nodes: CanvasNode[];
|
||||||
nodeTypeDescriptions: Record<string, INodeTypeDescription>;
|
|
||||||
connections: CanvasConnection[];
|
connections: CanvasConnection[];
|
||||||
|
nodeTypeDescriptions?: Record<string, INodeTypeDescription>;
|
||||||
controlsPosition?: PanelPosition;
|
controlsPosition?: PanelPosition;
|
||||||
eventBus?: EventBus<CanvasEventBusEvents>;
|
eventBus?: EventBus<CanvasEventBusEvents>;
|
||||||
readOnly?: boolean;
|
readOnly?: boolean;
|
||||||
|
@ -110,6 +110,7 @@ const props = withDefaults(
|
||||||
id: 'canvas',
|
id: 'canvas',
|
||||||
nodes: () => [],
|
nodes: () => [],
|
||||||
connections: () => [],
|
connections: () => [],
|
||||||
|
nodeTypeDescriptions: () => ({}),
|
||||||
controlsPosition: PanelPosition.BottomLeft,
|
controlsPosition: PanelPosition.BottomLeft,
|
||||||
eventBus: () => createEventBus(),
|
eventBus: () => createEventBus(),
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
|
|
|
@ -99,8 +99,8 @@ onNodesInitialized(() => {
|
||||||
v-if="workflow"
|
v-if="workflow"
|
||||||
:id="id"
|
:id="id"
|
||||||
:nodes="mappedNodes"
|
:nodes="mappedNodes"
|
||||||
:node-type-descriptions="nodeTypeDescriptions"
|
|
||||||
:connections="mappedConnections"
|
:connections="mappedConnections"
|
||||||
|
:node-type-descriptions="nodeTypeDescriptions"
|
||||||
:event-bus="eventBus"
|
:event-bus="eventBus"
|
||||||
:read-only="readOnly"
|
:read-only="readOnly"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
|
|
Loading…
Reference in a new issue