diff --git a/cypress/e2e/1338-ADO-ndv-missing-input-panel.cy.ts b/cypress/e2e/1338-ADO-ndv-missing-input-panel.cy.ts new file mode 100644 index 0000000000000..046d4d809d1bd --- /dev/null +++ b/cypress/e2e/1338-ADO-ndv-missing-input-panel.cy.ts @@ -0,0 +1,25 @@ +import { v4 as uuid } from 'uuid'; +import { NDV, WorkflowPage as WorkflowPageClass } from '../pages'; + +const workflowPage = new WorkflowPageClass(); +const ndv = new NDV(); + +describe('ADO-1338-ndv-missing-input-panel', () => { + beforeEach(() => { + workflowPage.actions.visit(); + }); + + it('should show the input and output panels when node is missing input and output data', () => { + cy.createFixtureWorkflow('Test_ado_1338.json', uuid()); + + // Execute the workflow + workflowPage.getters.zoomToFitButton().click(); + workflowPage.getters.executeWorkflowButton().click(); + // Check success toast (works because Cypress waits enough for the element to show after the http request node has finished) + workflowPage.getters.successToast().should('be.visible'); + + workflowPage.actions.openNode('Discourse1'); + ndv.getters.inputPanel().should('be.visible'); + ndv.getters.outputPanel().should('be.visible'); + }); +}); diff --git a/cypress/fixtures/Test_ado_1338.json b/cypress/fixtures/Test_ado_1338.json new file mode 100644 index 0000000000000..0609ae6e55f75 --- /dev/null +++ b/cypress/fixtures/Test_ado_1338.json @@ -0,0 +1,632 @@ +{ + "meta": { + "instanceId": "2be09fdcb9594c0827fd4cee80f7e590c93297d9217685f34c2250fe3144ef0c" + }, + "nodes": [ + { + "parameters": {}, + "id": "6dace68e-0727-472d-a212-00863acb64d6", + "name": "When clicking \"Execute Workflow\"", + "type": "n8n-nodes-base.manualTrigger", + "typeVersion": 1, + "position": [ + -340, + 660 + ] + }, + { + "parameters": { + "resource": "user", + "operation": "getAll", + "flag": "new", + "returnAll": true, + "options": {} + }, + "id": "2465a943-0d2c-480d-a98a-a67e92151367", + "name": "Discourse", + "type": "n8n-nodes-base.discourse", + "typeVersion": 1, + "position": [ + -120, + 660 + ] + }, + { + "parameters": { + "conditions": { + "dateTime": [ + { + "value1": "={{ $json.user.created_at }}", + "operation": "before", + "value2": "={{ $today.minus(6,\"day\") }}" + } + ], + "number": [ + { + "value1": "={{ $json.user.accepted_answers }}", + "operation": "larger", + "value2": 1 + }, + { + "value1": "={{ $json.user.post_count }}", + "operation": "larger", + "value2": 4 + } + ] + } + }, + "id": "ce1b80bb-08db-42cf-b7d9-56df74044f5c", + "name": "Filter", + "type": "n8n-nodes-base.filter", + "typeVersion": 1, + "position": [ + 600, + 640 + ] + }, + { + "parameters": { + "resource": "user", + "operation": "get", + "username": "={{ $json.username }}" + }, + "id": "ad3c141b-7aee-449b-8254-f21815a3d124", + "name": "Discourse1", + "type": "n8n-nodes-base.discourse", + "typeVersion": 1, + "position": [ + 340, + 840 + ] + }, + { + "parameters": { + "batchSize": 5, + "options": {} + }, + "id": "97fa87d0-ba76-4156-aa40-6bccd4775cdc", + "name": "Loop Over Items", + "type": "n8n-nodes-base.splitInBatches", + "typeVersion": 3, + "position": [ + 100, + 660 + ], + "disabled": true + }, + { + "parameters": { + "amount": 4, + "unit": "seconds" + }, + "id": "4f7f4b5d-2e02-4479-a4ee-9818f5b3e6de", + "name": "Wait", + "type": "n8n-nodes-base.wait", + "typeVersion": 1, + "position": [ + 580, + 840 + ], + "webhookId": "6bbd5e21-6022-475d-ace1-2aeb73e899d2" + }, + { + "parameters": {}, + "id": "a6cfc3b9-0d7a-4d4e-99c4-eba5085947d0", + "name": "No Operation, do nothing", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [ + 340, + 640 + ] + }, + { + "parameters": { + "content": "### filtering\n- Forum account older than 6 days\n- 2+ replies marked as answer\n- 5+ posts" + }, + "id": "580c80dc-cf95-413c-9465-29c9dc66ef6e", + "name": "Sticky Note", + "type": "n8n-nodes-base.stickyNote", + "typeVersion": 1, + "position": [ + 640, + 420 + ] + } + ], + "connections": { + "When clicking \"Execute Workflow\"": { + "main": [ + [ + { + "node": "Discourse", + "type": "main", + "index": 0 + } + ] + ] + }, + "Discourse": { + "main": [ + [ + { + "node": "Loop Over Items", + "type": "main", + "index": 0 + } + ] + ] + }, + "Discourse1": { + "main": [ + [ + { + "node": "Wait", + "type": "main", + "index": 0 + } + ] + ] + }, + "Loop Over Items": { + "main": [ + [ + { + "node": "No Operation, do nothing", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "Discourse1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Wait": { + "main": [ + [ + { + "node": "Loop Over Items", + "type": "main", + "index": 0 + } + ] + ] + }, + "No Operation, do nothing": { + "main": [ + [ + { + "node": "Filter", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "pinData": { + "Discourse": [ + { + "id": 1, + "user": "name" + } + ], + "Wait": [ + { + "user_badges": [], + "user": { + "id": 1, + "username": "User", + "name": "User", + "avatar_template": "/user_avatar/community.n8n.io/user/{size}/2.png", + "last_posted_at": "2023-11-02T16:16:05.615Z", + "last_seen_at": "2023-11-02T16:15:42.734Z", + "created_at": "2023-11-01T15:16:53.268Z", + "ignored": false, + "muted": false, + "can_ignore_user": true, + "can_mute_user": true, + "can_send_private_messages": true, + "can_send_private_message_to_user": true, + "trust_level": 0, + "moderator": false, + "admin": false, + "title": null, + "badge_count": 0, + "user_fields": { + "1": null + }, + "custom_fields": {}, + "time_read": 121, + "recent_time_read": 121, + "primary_group_id": null, + "primary_group_name": null, + "flair_group_id": null, + "flair_name": null, + "flair_url": null, + "flair_bg_color": null, + "flair_color": null, + "featured_topic": null, + "pending_posts_count": 0, + "staged": false, + "can_edit": true, + "can_edit_username": true, + "can_edit_email": true, + "can_edit_name": true, + "uploaded_avatar_id": 31486, + "has_title_badges": false, + "pending_count": 0, + "profile_view_count": 7, + "second_factor_enabled": false, + "can_upload_profile_header": true, + "can_upload_user_card_background": true, + "post_count": 1, + "can_be_deleted": true, + "can_delete_all_posts": true, + "locale": "en", + "muted_category_ids": [], + "regular_category_ids": [], + "watched_tags": [], + "watching_first_post_tags": [], + "tracked_tags": [], + "muted_tags": [], + "tracked_category_ids": [], + "watched_category_ids": [], + "watched_first_post_category_ids": [], + "system_avatar_upload_id": null, + "system_avatar_template": "/letter_avatar_proxy/v4/letter/c/3be4f8/{size}.png", + "custom_avatar_upload_id": 31486, + "custom_avatar_template": "/user_avatar/community.n8n.io/user/{size}/2.png", + "muted_usernames": [], + "ignored_usernames": [], + "allowed_pm_usernames": [], + "mailing_list_posts_per_day": 100, + "can_change_bio": true, + "can_change_location": true, + "can_change_website": true, + "can_change_tracking_preferences": true, + "user_api_keys": null, + "user_auth_tokens": [], + "user_notification_schedule": { + "enabled": false, + "day_0_start_time": 480, + "day_0_end_time": 1020, + "day_1_start_time": 480, + "day_1_end_time": 1020, + "day_2_start_time": 480, + "day_2_end_time": 1020, + "day_3_start_time": 480, + "day_3_end_time": 1020, + "day_4_start_time": 480, + "day_4_end_time": 1020, + "day_5_start_time": 480, + "day_5_end_time": 1020, + "day_6_start_time": 480, + "day_6_end_time": 1020 + }, + "use_logo_small_as_avatar": false, + "reminders_frequency": [ + { + "name": "discourse_assign.reminders_frequency.never", + "value": 0 + }, + { + "name": "discourse_assign.reminders_frequency.daily", + "value": 1440 + }, + { + "name": "discourse_assign.reminders_frequency.weekly", + "value": 10080 + }, + { + "name": "discourse_assign.reminders_frequency.monthly", + "value": 43200 + }, + { + "name": "discourse_assign.reminders_frequency.quarterly", + "value": 129600 + } + ], + "assign_icon": "user-plus", + "assign_path": "/u/User/activity/assigned", + "accepted_answers": 0, + "featured_user_badge_ids": [], + "invited_by": null, + "groups": [ + { + "id": 10, + "automatic": true, + "name": "trust_level_0", + "display_name": "trust_level_0", + "user_count": 9295, + "mentionable_level": 0, + "messageable_level": 0, + "visibility_level": 1, + "primary_group": false, + "title": null, + "grant_trust_level": null, + "incoming_email": null, + "has_messages": false, + "flair_url": null, + "flair_bg_color": null, + "flair_color": null, + "bio_raw": null, + "bio_cooked": null, + "bio_excerpt": null, + "public_admission": false, + "public_exit": false, + "allow_membership_requests": false, + "full_name": null, + "default_notification_level": 3, + "membership_request_template": null, + "members_visibility_level": 0, + "can_see_members": true, + "can_admin_group": true, + "publish_read_state": false + } + ], + "group_users": [ + { + "group_id": 10, + "user_id": 1, + "notification_level": 3 + } + ], + "user_option": { + "user_id": 1, + "mailing_list_mode": false, + "mailing_list_mode_frequency": 1, + "email_digests": false, + "email_level": 1, + "email_messages_level": 0, + "external_links_in_new_tab": true, + "color_scheme_id": null, + "dark_scheme_id": null, + "dynamic_favicon": true, + "enable_quoting": true, + "enable_defer": false, + "digest_after_minutes": 0, + "automatically_unpin_topics": true, + "auto_track_topics_after_msecs": 300000, + "notification_level_when_replying": 2, + "new_topic_duration_minutes": 2880, + "email_previous_replies": 2, + "email_in_reply_to": false, + "like_notification_frequency": 1, + "include_tl0_in_digests": false, + "theme_ids": [ + 7 + ], + "theme_key_seq": 0, + "allow_private_messages": true, + "enable_allowed_pm_users": false, + "homepage_id": null, + "hide_profile_and_presence": false, + "text_size": "normal", + "text_size_seq": 0, + "title_count_mode": "notifications", + "bookmark_auto_delete_preference": 3, + "timezone": "Europe/Berlin", + "skip_new_user_tips": false, + "default_calendar": "none_selected", + "oldest_search_log_date": null, + "seen_popups": [ + 1, + 3 + ] + } + } + }], + "No Operation, do nothing": [ + { + "user_badges": [], + "user": { + "id": 1, + "username": "User", + "name": "User", + "avatar_template": "/user_avatar/community.n8n.io/user/{size}/2.png", + "last_posted_at": "2023-11-02T16:16:05.615Z", + "last_seen_at": "2023-11-02T16:15:42.734Z", + "created_at": "2023-11-01T15:16:53.268Z", + "ignored": false, + "muted": false, + "can_ignore_user": true, + "can_mute_user": true, + "can_send_private_messages": true, + "can_send_private_message_to_user": true, + "trust_level": 0, + "moderator": false, + "admin": false, + "title": null, + "badge_count": 0, + "user_fields": { + "1": null + }, + "custom_fields": {}, + "time_read": 121, + "recent_time_read": 121, + "primary_group_id": null, + "primary_group_name": null, + "flair_group_id": null, + "flair_name": null, + "flair_url": null, + "flair_bg_color": null, + "flair_color": null, + "featured_topic": null, + "pending_posts_count": 0, + "staged": false, + "can_edit": true, + "can_edit_username": true, + "can_edit_email": true, + "can_edit_name": true, + "uploaded_avatar_id": 31486, + "has_title_badges": false, + "pending_count": 0, + "profile_view_count": 7, + "second_factor_enabled": false, + "can_upload_profile_header": true, + "can_upload_user_card_background": true, + "post_count": 1, + "can_be_deleted": true, + "can_delete_all_posts": true, + "locale": "en", + "muted_category_ids": [], + "regular_category_ids": [], + "watched_tags": [], + "watching_first_post_tags": [], + "tracked_tags": [], + "muted_tags": [], + "tracked_category_ids": [], + "watched_category_ids": [], + "watched_first_post_category_ids": [], + "system_avatar_upload_id": null, + "system_avatar_template": "/letter_avatar_proxy/v4/letter/c/3be4f8/{size}.png", + "custom_avatar_upload_id": 31486, + "custom_avatar_template": "/user_avatar/community.n8n.io/user/{size}/2.png", + "muted_usernames": [], + "ignored_usernames": [], + "allowed_pm_usernames": [], + "mailing_list_posts_per_day": 100, + "can_change_bio": true, + "can_change_location": true, + "can_change_website": true, + "can_change_tracking_preferences": true, + "user_api_keys": null, + "user_auth_tokens": [], + "user_notification_schedule": { + "enabled": false, + "day_0_start_time": 480, + "day_0_end_time": 1020, + "day_1_start_time": 480, + "day_1_end_time": 1020, + "day_2_start_time": 480, + "day_2_end_time": 1020, + "day_3_start_time": 480, + "day_3_end_time": 1020, + "day_4_start_time": 480, + "day_4_end_time": 1020, + "day_5_start_time": 480, + "day_5_end_time": 1020, + "day_6_start_time": 480, + "day_6_end_time": 1020 + }, + "use_logo_small_as_avatar": false, + "reminders_frequency": [ + { + "name": "discourse_assign.reminders_frequency.never", + "value": 0 + }, + { + "name": "discourse_assign.reminders_frequency.daily", + "value": 1440 + }, + { + "name": "discourse_assign.reminders_frequency.weekly", + "value": 10080 + }, + { + "name": "discourse_assign.reminders_frequency.monthly", + "value": 43200 + }, + { + "name": "discourse_assign.reminders_frequency.quarterly", + "value": 129600 + } + ], + "assign_icon": "user-plus", + "assign_path": "/u/User/activity/assigned", + "accepted_answers": 0, + "featured_user_badge_ids": [], + "invited_by": null, + "groups": [ + { + "id": 10, + "automatic": true, + "name": "trust_level_0", + "display_name": "trust_level_0", + "user_count": 9295, + "mentionable_level": 0, + "messageable_level": 0, + "visibility_level": 1, + "primary_group": false, + "title": null, + "grant_trust_level": null, + "incoming_email": null, + "has_messages": false, + "flair_url": null, + "flair_bg_color": null, + "flair_color": null, + "bio_raw": null, + "bio_cooked": null, + "bio_excerpt": null, + "public_admission": false, + "public_exit": false, + "allow_membership_requests": false, + "full_name": null, + "default_notification_level": 3, + "membership_request_template": null, + "members_visibility_level": 0, + "can_see_members": true, + "can_admin_group": true, + "publish_read_state": false + } + ], + "group_users": [ + { + "group_id": 10, + "user_id": 1, + "notification_level": 3 + } + ], + "user_option": { + "user_id": 1, + "mailing_list_mode": false, + "mailing_list_mode_frequency": 1, + "email_digests": false, + "email_level": 1, + "email_messages_level": 0, + "external_links_in_new_tab": true, + "color_scheme_id": null, + "dark_scheme_id": null, + "dynamic_favicon": true, + "enable_quoting": true, + "enable_defer": false, + "digest_after_minutes": 0, + "automatically_unpin_topics": true, + "auto_track_topics_after_msecs": 300000, + "notification_level_when_replying": 2, + "new_topic_duration_minutes": 2880, + "email_previous_replies": 2, + "email_in_reply_to": false, + "like_notification_frequency": 1, + "include_tl0_in_digests": false, + "theme_ids": [ + 7 + ], + "theme_key_seq": 0, + "allow_private_messages": true, + "enable_allowed_pm_users": false, + "homepage_id": null, + "hide_profile_and_presence": false, + "text_size": "normal", + "text_size_seq": 0, + "title_count_mode": "notifications", + "bookmark_auto_delete_preference": 3, + "timezone": "Europe/Berlin", + "skip_new_user_tips": false, + "default_calendar": "none_selected", + "oldest_search_log_date": null, + "seen_popups": [ + 1, + 3 + ] + } + } + }] + } +} diff --git a/packages/editor-ui/src/composables/useNodeHelpers.ts b/packages/editor-ui/src/composables/useNodeHelpers.ts index b7b431ffd4f27..7eb41633b1c95 100644 --- a/packages/editor-ui/src/composables/useNodeHelpers.ts +++ b/packages/editor-ui/src/composables/useNodeHelpers.ts @@ -562,7 +562,7 @@ export function useNodeHelpers() { let data: ITaskDataConnections | undefined = taskData.data; if (paneType === 'input' && taskData.inputOverride) { - data = taskData.inputOverride!; + data = taskData.inputOverride; } if (!data) { @@ -577,16 +577,7 @@ export function useNodeHelpers() { outputIndex: number, connectionType: ConnectionTypes = NodeConnectionType.Main, ): INodeExecutionData[] { - if ( - !connectionsData || - !connectionsData.hasOwnProperty(connectionType) || - connectionsData[connectionType] === undefined || - connectionsData[connectionType].length < outputIndex || - connectionsData[connectionType][outputIndex] === null - ) { - return []; - } - return connectionsData[connectionType][outputIndex] as INodeExecutionData[]; + return connectionsData?.[connectionType]?.[outputIndex] ?? []; } function getBinaryData( @@ -602,16 +593,18 @@ export function useNodeHelpers() { const runData: IRunData | null = workflowRunData; - if (!runData?.[node]?.[runIndex]?.data) { + const runDataOfNode = runData?.[node]?.[runIndex]?.data; + if (!runDataOfNode) { return []; } - const inputData = getInputData(runData[node][runIndex].data!, outputIndex, connectionType); + const inputData = getInputData(runDataOfNode, outputIndex, connectionType); const returnData: IBinaryKeyData[] = []; for (let i = 0; i < inputData.length; i++) { - if (inputData[i].hasOwnProperty('binary') && inputData[i].binary !== undefined) { - returnData.push(inputData[i].binary!); + const binaryDataInIdx = inputData[i]?.binary; + if (binaryDataInIdx !== undefined) { + returnData.push(binaryDataInIdx); } }