mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-12 16:10:30 +02:00
clean up unnecessary workflow(Object) prop
This commit is contained in:
parent
89ae52fced
commit
16249ea2fb
|
|
@ -6,7 +6,6 @@ import RunInfo from '@/features/ndv/runData/components/RunInfo.vue';
|
|||
import { useWorkflowsStore } from '@/app/stores/workflows.store';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { injectNDVStore } from '@/features/ndv/shared/ndv.store';
|
||||
import type { WorkflowObjectAccessors } from '@/app/types/workflow';
|
||||
import { useNodeTypesStore } from '@/app/stores/nodeTypes.store';
|
||||
import RunDataAi from '@/features/ndv/runData/components/ai/RunDataAi.vue';
|
||||
import { useNodeType } from '@/app/composables/useNodeType';
|
||||
|
|
@ -29,6 +28,7 @@ import { N8nIcon, N8nRadioButtons, N8nSpinner, N8nText } from '@n8n/design-syste
|
|||
import { injectWorkflowState } from '@/app/composables/useWorkflowState';
|
||||
import { useUIStore } from '@/app/stores/ui.store';
|
||||
import { WORKFLOW_SETTINGS_MODAL_KEY } from '@/app/constants';
|
||||
import { injectWorkflowDocumentStore } from '@/app/stores/workflowDocument.store';
|
||||
// Types
|
||||
|
||||
type RunDataRef = InstanceType<typeof RunData>;
|
||||
|
|
@ -43,7 +43,6 @@ type OutputTypeKey = keyof typeof OUTPUT_TYPE;
|
|||
type OutputType = (typeof OUTPUT_TYPE)[OutputTypeKey];
|
||||
|
||||
type Props = {
|
||||
workflowObject: WorkflowObjectAccessors;
|
||||
runIndex: number;
|
||||
isReadOnly?: boolean;
|
||||
linkedRuns?: boolean;
|
||||
|
|
@ -83,6 +82,7 @@ const ndvStore = injectNDVStore();
|
|||
const nodeTypesStore = useNodeTypesStore();
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const workflowState = injectWorkflowState();
|
||||
const workflowDocumentStore = injectWorkflowDocumentStore();
|
||||
const telemetry = useTelemetry();
|
||||
const i18n = useI18n();
|
||||
const { activeNode } = storeToRefs(ndvStore);
|
||||
|
|
@ -111,6 +111,10 @@ const collapsingColumnName = ref<string | null>(null);
|
|||
|
||||
// Computed
|
||||
|
||||
const workflowObject = computed(() =>
|
||||
workflowDocumentStore.value.getWorkflowObjectAccessorSnapshot(),
|
||||
);
|
||||
|
||||
const node = computed(() => {
|
||||
return ndvStore.activeNode ?? undefined;
|
||||
});
|
||||
|
|
@ -127,7 +131,10 @@ const hasAiMetadata = computed(() => {
|
|||
}
|
||||
|
||||
if (node.value) {
|
||||
const connectedSubNodes = props.workflowObject.getParentNodes(node.value.name, 'ALL_NON_MAIN');
|
||||
const connectedSubNodes = workflowDocumentStore.value.getParentNodes(
|
||||
node.value.name,
|
||||
'ALL_NON_MAIN',
|
||||
);
|
||||
const resultData = connectedSubNodes.map(workflowsStore.getWorkflowResultDataByNodeName);
|
||||
|
||||
return resultData && Array.isArray(resultData) && resultData.length > 0;
|
||||
|
|
@ -218,7 +225,7 @@ const allToolsWereUnusedNotice = computed(() => {
|
|||
// as it likely ends up unactionable noise to the user
|
||||
if (pinnedData.hasData.value) return undefined;
|
||||
|
||||
const toolsAvailable = props.workflowObject.getParentNodes(
|
||||
const toolsAvailable = workflowDocumentStore.value.getParentNodes(
|
||||
node.value.name,
|
||||
NodeConnectionTypes.AiTool,
|
||||
1,
|
||||
|
|
|
|||
|
|
@ -1435,7 +1435,6 @@ onUpdated(async () => {
|
|||
|
||||
<ExperimentalEmbeddedNdvMapper
|
||||
v-if="wrapper && isMapperAvailable && node && expressionLocalResolveCtx?.inputNode"
|
||||
:workflow="workflowDocumentStore.getWorkflowObjectAccessorSnapshot()"
|
||||
:node="node"
|
||||
:input-node-name="expressionLocalResolveCtx.inputNode.name"
|
||||
:reference="wrapper"
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ const workflowRunData = computed(() => {
|
|||
|
||||
const parentNodes = computed(() => {
|
||||
if (activeNode.value) {
|
||||
return workflowObject.value?.getParentNodesByDepth(activeNode.value.name, 1) ?? [];
|
||||
return workflowDocumentStore.value.getParentNodesByDepth(activeNode.value.name, 1) ?? [];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
|
@ -170,7 +170,7 @@ const inputNodeName = computed<string | undefined>(() => {
|
|||
// For sub-nodes, we need to get their connected output node to determine the input
|
||||
// because sub-nodes use specialized outputs (e.g. NodeConnectionTypes.AiTool)
|
||||
// instead of the standard Main output type
|
||||
const connectedOutputNode = workflowObject.value?.getChildNodes(
|
||||
const connectedOutputNode = workflowDocumentStore.value.getChildNodes(
|
||||
activeNode.value.name,
|
||||
'ALL_NON_MAIN',
|
||||
)?.[0];
|
||||
|
|
@ -247,7 +247,7 @@ const maxInputRun = computed(() => {
|
|||
return 0;
|
||||
}
|
||||
|
||||
const workflowNode = workflowObject.value?.getNode(activeNode.value.name);
|
||||
const workflowNode = workflowDocumentStore.value.getNodeByName(activeNode.value.name);
|
||||
|
||||
if (!workflowNode || !activeNodeType.value || !workflowObject.value) {
|
||||
return 0;
|
||||
|
|
@ -746,7 +746,7 @@ onBeforeUnmount(() => {
|
|||
@activate="onWorkflowActivate"
|
||||
/>
|
||||
<InputPanel
|
||||
v-else-if="!isTriggerNode && workflowObject"
|
||||
v-else-if="!isTriggerNode"
|
||||
:can-link-runs="canLinkRuns"
|
||||
:run-index="inputRun"
|
||||
:linked-runs="linked"
|
||||
|
|
@ -774,9 +774,7 @@ onBeforeUnmount(() => {
|
|||
</template>
|
||||
<template #output>
|
||||
<OutputPanel
|
||||
v-if="workflowObject"
|
||||
data-test-id="output-panel"
|
||||
:workflow-object="workflowObject"
|
||||
:can-link-runs="canLinkRuns"
|
||||
:run-index="outputRun"
|
||||
:linked-runs="linked"
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ const workflowRunData = computed(() => {
|
|||
const parentNodes = computed(() => {
|
||||
if (activeNode.value) {
|
||||
return (
|
||||
workflowObject.value
|
||||
?.getParentNodesByDepth(activeNode.value.name, 1)
|
||||
workflowDocumentStore.value
|
||||
.getParentNodesByDepth(activeNode.value.name, 1)
|
||||
.map(({ name }) => name) || []
|
||||
);
|
||||
} else {
|
||||
|
|
@ -174,7 +174,7 @@ const inputNodeName = computed<string | undefined>(() => {
|
|||
// For sub-nodes, we need to get their connected output node to determine the input
|
||||
// because sub-nodes use specialized outputs (e.g. NodeConnectionTypes.AiTool)
|
||||
// instead of the standard Main output type
|
||||
const connectedOutputNode = workflowObject.value?.getChildNodes(
|
||||
const connectedOutputNode = workflowDocumentStore.value.getChildNodes(
|
||||
activeNode.value.name,
|
||||
'ALL_NON_MAIN',
|
||||
)?.[0];
|
||||
|
|
@ -251,7 +251,7 @@ const maxInputRun = computed(() => {
|
|||
return 0;
|
||||
}
|
||||
|
||||
const workflowNode = workflowObject.value?.getNode(activeNode.value.name);
|
||||
const workflowNode = workflowDocumentStore.value.getNodeByName(activeNode.value.name);
|
||||
|
||||
if (!workflowNode || !activeNodeType.value || !workflowObject.value) {
|
||||
return 0;
|
||||
|
|
@ -828,9 +828,7 @@ onBeforeUnmount(() => {
|
|||
:style="{ width: `${panelWidthPercentage.right}%` }"
|
||||
>
|
||||
<OutputPanel
|
||||
v-if="workflowObject"
|
||||
data-test-id="output-panel"
|
||||
:workflow-object="workflowObject"
|
||||
:can-link-runs="canLinkRuns"
|
||||
:run-index="outputRun"
|
||||
:linked-runs="linked"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user