From 1c53ac9f8522f126dbbf6441d802d36d0bd065f4 Mon Sep 17 00:00:00 2001 From: brianinoa Date: Thu, 16 Jun 2022 15:03:56 +0200 Subject: [PATCH] :zap: Improve descriptions --- nodes/HttpBin/HttpBin.node.json | 1 - nodes/HttpBin/HttpBin.node.ts | 9 ++++++++- nodes/HttpBin/HttpVerbDescriptions.ts | 19 +++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/nodes/HttpBin/HttpBin.node.json b/nodes/HttpBin/HttpBin.node.json index 1b0235c..cc9eb82 100644 --- a/nodes/HttpBin/HttpBin.node.json +++ b/nodes/HttpBin/HttpBin.node.json @@ -4,7 +4,6 @@ "codexVersion": "1.0", "categories": [ "Development", - "HTTP Request & Response Service", "Developer Tools" ], "resources": { diff --git a/nodes/HttpBin/HttpBin.node.ts b/nodes/HttpBin/HttpBin.node.ts index 2bb9502..7737f7c 100644 --- a/nodes/HttpBin/HttpBin.node.ts +++ b/nodes/HttpBin/HttpBin.node.ts @@ -33,7 +33,13 @@ export class HttpBin implements INodeType { /** * In the properties array we have two mandatory options objects required * - * Resource & Operation + * [Resource & Operation] + * + * + * https://docs.n8n.io/integrations/creating-nodes/code/create-first-node/#resources-and-operations + * + * In our example, the operations are separated into their own file (HTTPVerbDescription) + * to keep this class easy to read * */ properties: [ @@ -54,6 +60,7 @@ export class HttpBin implements INodeType { ], default: "httpverbs", }, + ...httpVerbOperations, ...httpVerbFields, ], diff --git a/nodes/HttpBin/HttpVerbDescriptions.ts b/nodes/HttpBin/HttpVerbDescriptions.ts index 4a47ed7..9609101 100644 --- a/nodes/HttpBin/HttpVerbDescriptions.ts +++ b/nodes/HttpBin/HttpVerbDescriptions.ts @@ -1,7 +1,7 @@ import { INodeProperties } from "n8n-workflow"; /** - * This maps the operations to when the resource HTTP Verbs is selected + * This maps the operations to when the Resource option HTTP Verbs is selected */ export const httpVerbOperations: Array = [ { @@ -40,12 +40,17 @@ export const httpVerbOperations: Array = [ }, ]; +/** + * + * Here we define what to show when the GET Operation is selected + * + * We do that by adding operation: ["get"], to "displayOptions.show" + */ const getOperation: Array = [ { name: "typeofData", default: "queryParameterOption", - description: - "Select type of data to send [Query Parameter Arguments, JSON-Body]", + description: "Select type of data to send [Query Parameters]", displayName: "Type of Data", displayOptions: { show: { @@ -110,12 +115,18 @@ const getOperation: Array = [ }, ]; +/** + * + * Here we define what to show when the DELETE Operation is selected + * + * We do that by adding operation: ["delete"], to "displayOptions.show" + */ const deleteOperation: Array = [ { name: "typeofData", default: "queryParameterOption", description: - "Select type of data to send [Query Parameter Arguments, Form-Data, Body, JSON]", + "Select type of data to send [Query Parameter Arguments, JSON-Body]", displayName: "Type of Data", displayOptions: { show: {