feat(editor): Remember different panel state for sub nodes (#16189)

This commit is contained in:
Suguru Inoue
2025-06-11 14:46:19 +02:00
committed by GitHub
parent 21b84ef4e7
commit b9e03515bd
6 changed files with 100 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ import {
aiAgentNode,
aiChatExecutionResponse,
aiChatWorkflow,
aiManualExecutionResponse,
aiManualWorkflow,
chatTriggerNode,
nodeTypes,
@@ -107,6 +108,8 @@ describe('LogsPanel', () => {
y: 0,
height: VIEWPORT_HEIGHT,
} as DOMRect);
localStorage.clear();
});
afterEach(() => {
@@ -138,6 +141,30 @@ describe('LogsPanel', () => {
expect(await rendered.findByTestId('chat-header')).toBeInTheDocument();
});
it('should render only output panel of selected node by default', async () => {
logsStore.toggleOpen(true);
workflowsStore.setWorkflow(aiManualWorkflow);
workflowsStore.setWorkflowExecutionData(aiManualExecutionResponse);
const rendered = render();
expect(rendered.queryByTestId('log-details-header')).toHaveTextContent('AI Agent');
expect(rendered.queryByTestId('log-details-input')).not.toBeInTheDocument();
expect(rendered.queryByTestId('log-details-output')).toBeInTheDocument();
});
it('should render both input and output panel of selected node by default if it is sub node', async () => {
logsStore.toggleOpen(true);
workflowsStore.setWorkflow(aiChatWorkflow);
workflowsStore.setWorkflowExecutionData(aiChatExecutionResponse);
const rendered = render();
expect(rendered.queryByTestId('log-details-header')).toHaveTextContent('AI Model');
expect(rendered.queryByTestId('log-details-input')).toBeInTheDocument();
expect(rendered.queryByTestId('log-details-output')).toBeInTheDocument();
});
it('opens collapsed panel when clicked', async () => {
workflowsStore.setWorkflow(aiChatWorkflow);
@@ -384,8 +411,6 @@ describe('LogsPanel', () => {
it('should toggle input and output panel when the button is clicked', async () => {
logsStore.toggleOpen(true);
logsStore.toggleInputOpen(false);
logsStore.toggleOutputOpen(true);
workflowsStore.setWorkflow(aiChatWorkflow);
workflowsStore.setWorkflowExecutionData(aiChatExecutionResponse);
@@ -393,12 +418,12 @@ describe('LogsPanel', () => {
const header = within(rendered.getByTestId('log-details-header'));
expect(rendered.queryByTestId('log-details-input')).not.toBeInTheDocument();
expect(rendered.queryByTestId('log-details-input')).toBeInTheDocument();
expect(rendered.queryByTestId('log-details-output')).toBeInTheDocument();
await fireEvent.click(header.getByText('Input'));
expect(rendered.queryByTestId('log-details-input')).toBeInTheDocument();
expect(rendered.queryByTestId('log-details-input')).not.toBeInTheDocument();
expect(rendered.queryByTestId('log-details-output')).toBeInTheDocument();
await fireEvent.click(header.getByText('Output'));