mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(editor): Open NDV from logs view with correct run index (#14779)
This commit is contained in:
@@ -1563,6 +1563,7 @@ export type InputPanel = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type OutputPanel = {
|
export type OutputPanel = {
|
||||||
|
run?: number;
|
||||||
branch?: number;
|
branch?: number;
|
||||||
data: {
|
data: {
|
||||||
isEmpty: boolean;
|
isEmpty: boolean;
|
||||||
|
|||||||
@@ -115,9 +115,15 @@ describe('LogsOverviewPanel', () => {
|
|||||||
const rendered = render({ isOpen: true });
|
const rendered = render({ isOpen: true });
|
||||||
const aiAgentRow = rendered.getAllByRole('treeitem')[0];
|
const aiAgentRow = rendered.getAllByRole('treeitem')[0];
|
||||||
|
|
||||||
|
expect(ndvStore.activeNodeName).toBe(null);
|
||||||
|
expect(ndvStore.output.run).toBe(undefined);
|
||||||
|
|
||||||
await fireEvent.click(within(aiAgentRow).getAllByLabelText('Open...')[0]);
|
await fireEvent.click(within(aiAgentRow).getAllByLabelText('Open...')[0]);
|
||||||
|
|
||||||
await waitFor(() => expect(ndvStore.activeNodeName).toBe('AI Agent'));
|
await waitFor(() => {
|
||||||
|
expect(ndvStore.activeNodeName).toBe('AI Agent');
|
||||||
|
expect(ndvStore.output.run).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should trigger partial execution if the button is clicked', async () => {
|
it('should trigger partial execution if the button is clicked', async () => {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useI18n } from '@/composables/useI18n';
|
|||||||
import { useNodeHelpers } from '@/composables/useNodeHelpers';
|
import { useNodeHelpers } from '@/composables/useNodeHelpers';
|
||||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||||
import { N8nButton, N8nRadioButtons, N8nText, N8nTooltip } from '@n8n/design-system';
|
import { N8nButton, N8nRadioButtons, N8nText, N8nTooltip } from '@n8n/design-system';
|
||||||
import { computed } from 'vue';
|
import { computed, nextTick } from 'vue';
|
||||||
import { ElTree, type TreeNode as ElTreeNode } from 'element-plus';
|
import { ElTree, type TreeNode as ElTreeNode } from 'element-plus';
|
||||||
import {
|
import {
|
||||||
getSubtreeTotalConsumedTokens,
|
getSubtreeTotalConsumedTokens,
|
||||||
@@ -80,6 +80,8 @@ function handleToggleExpanded(treeNode: ElTreeNode) {
|
|||||||
|
|
||||||
async function handleOpenNdv(treeNode: TreeNode) {
|
async function handleOpenNdv(treeNode: TreeNode) {
|
||||||
ndvStore.setActiveNodeName(treeNode.node);
|
ndvStore.setActiveNodeName(treeNode.node);
|
||||||
|
|
||||||
|
await nextTick(() => ndvStore.setOutputRunIndex(treeNode.runIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleTriggerPartialExecution(treeNode: TreeNode) {
|
async function handleTriggerPartialExecution(treeNode: TreeNode) {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const { APP_Z_INDEXES } = useStyles();
|
|||||||
const settingsEventBus = createEventBus();
|
const settingsEventBus = createEventBus();
|
||||||
const redrawRequired = ref(false);
|
const redrawRequired = ref(false);
|
||||||
const runInputIndex = ref(-1);
|
const runInputIndex = ref(-1);
|
||||||
const runOutputIndex = ref(-1);
|
const runOutputIndex = computed(() => ndvStore.output.run ?? -1);
|
||||||
const isLinkingEnabled = ref(true);
|
const isLinkingEnabled = ref(true);
|
||||||
const selectedInput = ref<string | undefined>();
|
const selectedInput = ref<string | undefined>();
|
||||||
const triggerWaitingWarningEnabled = ref(false);
|
const triggerWaitingWarningEnabled = ref(false);
|
||||||
@@ -476,7 +476,7 @@ const trackLinking = (pane: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onLinkRunToInput = () => {
|
const onLinkRunToInput = () => {
|
||||||
runOutputIndex.value = runInputIndex.value;
|
ndvStore.setOutputRunIndex(runInputIndex.value);
|
||||||
isLinkingEnabled.value = true;
|
isLinkingEnabled.value = true;
|
||||||
trackLinking('input');
|
trackLinking('input');
|
||||||
};
|
};
|
||||||
@@ -553,14 +553,14 @@ const trackRunChange = (run: number, pane: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onRunOutputIndexChange = (run: number) => {
|
const onRunOutputIndexChange = (run: number) => {
|
||||||
runOutputIndex.value = run;
|
ndvStore.setOutputRunIndex(run);
|
||||||
trackRunChange(run, 'output');
|
trackRunChange(run, 'output');
|
||||||
};
|
};
|
||||||
|
|
||||||
const onRunInputIndexChange = (run: number) => {
|
const onRunInputIndexChange = (run: number) => {
|
||||||
runInputIndex.value = run;
|
runInputIndex.value = run;
|
||||||
if (linked.value) {
|
if (linked.value) {
|
||||||
runOutputIndex.value = run;
|
ndvStore.setOutputRunIndex(run);
|
||||||
}
|
}
|
||||||
trackRunChange(run, 'input');
|
trackRunChange(run, 'input');
|
||||||
};
|
};
|
||||||
@@ -622,7 +622,7 @@ watch(
|
|||||||
|
|
||||||
if (node && node.name !== oldNode?.name && !isActiveStickyNode.value) {
|
if (node && node.name !== oldNode?.name && !isActiveStickyNode.value) {
|
||||||
runInputIndex.value = -1;
|
runInputIndex.value = -1;
|
||||||
runOutputIndex.value = -1;
|
ndvStore.setOutputRunIndex(-1);
|
||||||
isLinkingEnabled.value = true;
|
isLinkingEnabled.value = true;
|
||||||
selectedInput.value = undefined;
|
selectedInput.value = undefined;
|
||||||
triggerWaitingWarningEnabled.value = false;
|
triggerWaitingWarningEnabled.value = false;
|
||||||
@@ -675,7 +675,7 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
watch(maxOutputRun, () => {
|
watch(maxOutputRun, () => {
|
||||||
runOutputIndex.value = -1;
|
ndvStore.setOutputRunIndex(-1);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(maxInputRun, () => {
|
watch(maxInputRun, () => {
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export const useNDVStore = defineStore(STORES.NDV, () => {
|
|||||||
'schema',
|
'schema',
|
||||||
);
|
);
|
||||||
const output = ref<OutputPanel>({
|
const output = ref<OutputPanel>({
|
||||||
|
run: undefined,
|
||||||
branch: undefined,
|
branch: undefined,
|
||||||
data: {
|
data: {
|
||||||
isEmpty: true,
|
isEmpty: true,
|
||||||
@@ -224,6 +225,10 @@ export const useNDVStore = defineStore(STORES.NDV, () => {
|
|||||||
input.value.run = run;
|
input.value.run = run;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setOutputRunIndex = (run?: number): void => {
|
||||||
|
output.value.run = run;
|
||||||
|
};
|
||||||
|
|
||||||
const setMainPanelDimensions = (params: {
|
const setMainPanelDimensions = (params: {
|
||||||
panelType: MainPanelType;
|
panelType: MainPanelType;
|
||||||
dimensions: { relativeLeft?: number; relativeRight?: number; relativeWidth?: number };
|
dimensions: { relativeLeft?: number; relativeRight?: number; relativeWidth?: number };
|
||||||
@@ -407,6 +412,7 @@ export const useNDVStore = defineStore(STORES.NDV, () => {
|
|||||||
setActiveNodeName,
|
setActiveNodeName,
|
||||||
setInputNodeName,
|
setInputNodeName,
|
||||||
setInputRunIndex,
|
setInputRunIndex,
|
||||||
|
setOutputRunIndex,
|
||||||
setMainPanelDimensions,
|
setMainPanelDimensions,
|
||||||
setNDVPushRef,
|
setNDVPushRef,
|
||||||
resetNDVPushRef,
|
resetNDVPushRef,
|
||||||
|
|||||||
Reference in New Issue
Block a user