feat(10.2-02): add correlation ID generation and error capture to main workflow
Part A - Correlation ID Generation: - Added Generate Correlation ID node for text command path - Added Generate Callback Correlation ID node for callback path - Wired between authentication and routing nodes - Uses timestamp + random string pattern (no external dependencies) Part B - Correlation ID Propagation: - Modified 19 Prepare Input nodes to pass correlationId to sub-workflows - Uses $input.item.json.correlationId pattern for flexibility - Supports both text and callback paths Part C - Error Capture Infrastructure: - Added 2 error detection IF nodes for high-value paths: * Check Execute Container Action Success * Check Execute Inline Action Success - Error path: success === false → Log Error node - Success path: continues to original result handling - Log Error node receives error data from sub-workflows - Pass-through design preserves data for downstream handlers Main workflow: 172 → 176 nodes (+4) - 2 correlation ID generators - 2 error detection IF nodes Error ring buffer now captures: - Container action failures (Docker API errors) - Sub-workflow errors with full diagnostic context - Correlation IDs for request tracing - Workflow name, node, HTTP codes, raw responses
This commit is contained in:
+170
-21
@@ -3203,7 +3203,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for container-update sub-workflow (text mode)\nconst data = $input.item.json;\nconst containerId = data.containerId;\nconst containerName = data.containerName;\nconst chatId = data.chatId;\n\nreturn {\n json: {\n containerId,\n containerName,\n chatId,\n messageId: 0, // No message to edit in text mode\n responseMode: 'text'\n }\n};"
|
||||
"jsCode": "// Prepare input for container-update sub-workflow (text mode)\nconst data = $input.item.json;\nconst containerId = data.containerId;\nconst containerName = data.containerName;\nconst chatId = data.chatId;\n\nreturn {\n json: {\n containerId,\n containerName,\n chatId,\n messageId: 0, // No message to edit in text mode\n responseMode: 'text'\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-text-update",
|
||||
"name": "Prepare Text Update Input",
|
||||
@@ -3263,7 +3263,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for container-update sub-workflow (inline mode)\nconst data = $('Parse Callback Data').item.json;\nconst containerName = data.containerName;\nconst chatId = data.chatId;\nconst messageId = data.messageId;\n\nreturn {\n json: {\n containerId: '', // Will be resolved by sub-workflow from name\n containerName,\n chatId,\n messageId,\n responseMode: 'inline'\n }\n};"
|
||||
"jsCode": "// Prepare input for container-update sub-workflow (inline mode)\nconst data = $('Parse Callback Data').item.json;\nconst containerName = data.containerName;\nconst chatId = data.chatId;\nconst messageId = data.messageId;\n\nreturn {\n json: {\n containerId: '', // Will be resolved by sub-workflow from name\n containerName,\n chatId,\n messageId,\n responseMode: 'inline'\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-callback-update",
|
||||
"name": "Prepare Callback Update Input",
|
||||
@@ -3344,7 +3344,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for container actions sub-workflow\nconst data = $input.item.json;\nconst containerId = data.containerId;\nconst containerName = data.containerName;\n// Get the actual requested action (stop/start/restart) from Parse Action Command\nconst actionType = $('Parse Action Command').item.json.action || 'restart';\nconst chatId = data.chatId;\n\nreturn {\n json: {\n containerId: containerId,\n containerName: containerName,\n action: actionType,\n chatId: chatId,\n messageId: 0, // Text mode doesn't have a message to edit\n responseMode: 'text'\n }\n};"
|
||||
"jsCode": "// Prepare input for container actions sub-workflow\nconst data = $input.item.json;\nconst containerId = data.containerId;\nconst containerName = data.containerName;\n// Get the actual requested action (stop/start/restart) from Parse Action Command\nconst actionType = $('Parse Action Command').item.json.action || 'restart';\nconst chatId = data.chatId;\n\nreturn {\n json: {\n containerId: containerId,\n containerName: containerName,\n action: actionType,\n chatId: chatId,\n messageId: 0, // Text mode doesn't have a message to edit\n responseMode: 'text'\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-text-action-rr53pd94",
|
||||
"name": "Prepare Text Action Input",
|
||||
@@ -3392,7 +3392,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for container actions sub-workflow from inline keyboard\n// Container lookup already done by Get Container For Action\nconst containers = $input.all().map(item => item.json);\nconst prevData = $('Prepare Immediate Action').item.json;\nconst containerName = prevData.containerName.toLowerCase();\nconst action = prevData.action;\nconst chatId = prevData.chatId;\nconst messageId = prevData.messageId;\n\n// Function to normalize container names\nfunction normalizeName(name) {\n return name\n .replace(/^\\//, '')\n .replace(/^(linuxserver[-_]|binhex[-_])/i, '')\n .toLowerCase();\n}\n\n// Find the matching container\nconst container = containers.find(c => normalizeName(c.Names[0]) === containerName);\n\nif (!container) {\n return {\n json: {\n error: true,\n chatId,\n messageId,\n text: 'Container not found'\n }\n };\n}\n\nreturn {\n json: {\n containerId: container.Id,\n containerName: normalizeName(container.Names[0]),\n action: action,\n chatId: chatId,\n messageId: messageId,\n responseMode: 'inline'\n }\n};"
|
||||
"jsCode": "// Prepare input for container actions sub-workflow from inline keyboard\n// Container lookup already done by Get Container For Action\nconst containers = $input.all().map(item => item.json);\nconst prevData = $('Prepare Immediate Action').item.json;\nconst containerName = prevData.containerName.toLowerCase();\nconst action = prevData.action;\nconst chatId = prevData.chatId;\nconst messageId = prevData.messageId;\n\n// Function to normalize container names\nfunction normalizeName(name) {\n return name\n .replace(/^\\//, '')\n .replace(/^(linuxserver[-_]|binhex[-_])/i, '')\n .toLowerCase();\n}\n\n// Find the matching container\nconst container = containers.find(c => normalizeName(c.Names[0]) === containerName);\n\nif (!container) {\n return {\n json: {\n error: true,\n chatId,\n messageId,\n text: 'Container not found'\n }\n };\n}\n\nreturn {\n json: {\n containerId: container.Id,\n containerName: normalizeName(container.Names[0]),\n action: action,\n chatId: chatId,\n messageId: messageId,\n responseMode: 'inline'\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-inline-action-tyjn5pb1",
|
||||
"name": "Prepare Inline Action Input",
|
||||
@@ -3440,7 +3440,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for Container Update sub-workflow\nconst data = $('Build Progress Message').item.json;\nconst container = data.container;\n\n// Extract container info\nconst containerId = container.id || container.Id || '';\nconst containerName = container.name || container.Name || '';\n\nreturn {\n json: {\n containerId: containerId,\n containerName: containerName,\n chatId: data.chatId,\n messageId: data.progressMessageId || 0,\n responseMode: \"inline\"\n }\n};"
|
||||
"jsCode": "// Prepare input for Container Update sub-workflow\nconst data = $('Build Progress Message').item.json;\nconst container = data.container;\n\n// Extract container info\nconst containerId = container.id || container.Id || '';\nconst containerName = container.name || container.Name || '';\n\nreturn {\n json: {\n containerId: containerId,\n containerName: containerName,\n chatId: data.chatId,\n messageId: data.progressMessageId || 0,\n responseMode: \"inline\"\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "caeae5d6-f9ec-4aa3-83d3-198b6b55be65",
|
||||
"name": "Prepare Batch Update Input",
|
||||
@@ -3484,7 +3484,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for Container Actions sub-workflow\nconst data = $('Build Progress Message').item.json;\nconst container = data.container;\nconst action = data.action;\n\n// Extract container info\nconst containerId = container.id || container.Id || '';\nconst containerName = container.name || container.Name || '';\n\nreturn {\n json: {\n containerId: containerId,\n containerName: containerName,\n action: action,\n chatId: data.chatId,\n messageId: data.progressMessageId || 0,\n responseMode: \"inline\"\n }\n};"
|
||||
"jsCode": "// Prepare input for Container Actions sub-workflow\nconst data = $('Build Progress Message').item.json;\nconst container = data.container;\nconst action = data.action;\n\n// Extract container info\nconst containerId = container.id || container.Id || '';\nconst containerName = container.name || container.Name || '';\n\nreturn {\n json: {\n containerId: containerId,\n containerName: containerName,\n action: action,\n chatId: data.chatId,\n messageId: data.progressMessageId || 0,\n responseMode: \"inline\"\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "958f19ef-249b-42ca-8a29-ecb91548f1dd",
|
||||
"name": "Prepare Batch Action Input",
|
||||
@@ -3528,7 +3528,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for Container Logs sub-workflow (text command)\nconst data = $json;\n\n// Check if there's an error from Parse Logs Command\nif (data.error) {\n return {\n json: {\n error: true,\n chatId: data.chatId,\n text: data.text\n }\n };\n}\n\nreturn {\n json: {\n containerName: data.containerQuery,\n lineCount: data.lines,\n chatId: data.chatId,\n messageId: data.messageId || 0,\n responseMode: \"text\"\n }\n};"
|
||||
"jsCode": "// Prepare input for Container Logs sub-workflow (text command)\nconst data = $json;\n\n// Check if there's an error from Parse Logs Command\nif (data.error) {\n return {\n json: {\n error: true,\n chatId: data.chatId,\n text: data.text\n }\n };\n}\n\nreturn {\n json: {\n containerName: data.containerQuery,\n lineCount: data.lines,\n chatId: data.chatId,\n messageId: data.messageId || 0,\n responseMode: \"text\"\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "a895bb2d-1f61-4466-b475-b32ec5f0e83a",
|
||||
"name": "Prepare Text Logs Input",
|
||||
@@ -3559,7 +3559,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for Container Logs sub-workflow (inline action)\nconst data = $('Parse Callback Data').item.json;\n\nreturn {\n json: {\n containerName: data.containerName,\n lineCount: 30,\n chatId: data.chatId,\n messageId: data.messageId,\n responseMode: \"inline\"\n }\n};"
|
||||
"jsCode": "// Prepare input for Container Logs sub-workflow (inline action)\nconst data = $('Parse Callback Data').item.json;\n\nreturn {\n json: {\n containerName: data.containerName,\n lineCount: 30,\n chatId: data.chatId,\n messageId: data.messageId,\n responseMode: \"inline\"\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "16b24086-5b5d-4980-82c7-4fb37b4e8f6c",
|
||||
"name": "Prepare Inline Logs Input",
|
||||
@@ -3603,7 +3603,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for Batch UI sub-workflow\nconst data = $json;\n\n// Determine action from callback data\nlet action = 'mode'; // default\nconst callbackData = data.callbackData || '';\n\nif (data.isBatchMode) action = 'mode';\nelse if (data.isBatchToggle) action = 'toggle';\nelse if (data.isBatchNav) action = 'nav';\nelse if (data.isBatchExec) action = 'exec';\nelse if (data.isBatchClear) action = 'clear';\nelse if (data.isBatchCancel) action = 'cancel';\n\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n queryId: data.queryId,\n callbackData: callbackData,\n action: action,\n batchAction: data.action || 'start',\n batchPage: data.batchPage || 0,\n selectedCsv: data.selectedCsv || '',\n toggleName: data.toggleName || ''\n }\n};"
|
||||
"jsCode": "// Prepare input for Batch UI sub-workflow\nconst data = $json;\n\n// Determine action from callback data\nlet action = 'mode'; // default\nconst callbackData = data.callbackData || '';\n\nif (data.isBatchMode) action = 'mode';\nelse if (data.isBatchToggle) action = 'toggle';\nelse if (data.isBatchNav) action = 'nav';\nelse if (data.isBatchExec) action = 'exec';\nelse if (data.isBatchClear) action = 'clear';\nelse if (data.isBatchCancel) action = 'cancel';\n\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n queryId: data.queryId,\n callbackData: callbackData,\n action: action,\n batchAction: data.action || 'start',\n batchPage: data.batchPage || 0,\n selectedCsv: data.selectedCsv || '',\n toggleName: data.toggleName || ''\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-batch-ui-input",
|
||||
"name": "Prepare Batch UI Input",
|
||||
@@ -3899,7 +3899,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for Container Status sub-workflow from /status command\nconst message = $('Keyword Router').item.json.message;\nconst chatId = message.chat.id;\nconst text = (message.text || '').toLowerCase().trim();\n\n// Check if user specified a container name (e.g., \"/status plex\")\nlet searchTerm = null;\nconst parts = text.split(/\\s+/);\nif (parts.length > 1) {\n searchTerm = parts.filter(p => p !== 'status' && p !== '/status').join(' ');\n}\n\nreturn {\n json: {\n chatId: chatId,\n messageId: 0,\n action: 'list',\n containerId: null,\n containerName: null,\n page: 0,\n queryId: null,\n searchTerm: searchTerm\n }\n};"
|
||||
"jsCode": "// Prepare input for Container Status sub-workflow from /status command\nconst message = $('Keyword Router').item.json.message;\nconst chatId = message.chat.id;\nconst text = (message.text || '').toLowerCase().trim();\n\n// Check if user specified a container name (e.g., \"/status plex\")\nlet searchTerm = null;\nconst parts = text.split(/\\s+/);\nif (parts.length > 1) {\n searchTerm = parts.filter(p => p !== 'status' && p !== '/status').join(' ');\n}\n\nreturn {\n json: {\n chatId: chatId,\n messageId: 0,\n action: 'list',\n containerId: null,\n containerName: null,\n page: 0,\n queryId: null,\n searchTerm: searchTerm\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-status-input",
|
||||
"name": "Prepare Status Input",
|
||||
@@ -4022,7 +4022,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for Container Status sub-workflow from select callback\nconst data = $(\"Parse Callback Data\").item.json;\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'status',\n containerId: null,\n containerName: data.containerName,\n page: 0,\n queryId: data.queryId,\n searchTerm: null\n }\n};"
|
||||
"jsCode": "// Prepare input for Container Status sub-workflow from select callback\nconst data = $(\"Parse Callback Data\").item.json;\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'status',\n containerId: null,\n containerName: data.containerName,\n page: 0,\n queryId: data.queryId,\n searchTerm: null\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-select-input",
|
||||
"name": "Prepare Select Status Input",
|
||||
@@ -4057,7 +4057,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for Container Status sub-workflow from list pagination callback\nconst data = $(\"Parse Callback Data\").item.json;\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'paginate',\n containerId: null,\n containerName: null,\n page: data.page || 0,\n queryId: data.queryId,\n searchTerm: null\n }\n};"
|
||||
"jsCode": "// Prepare input for Container Status sub-workflow from list pagination callback\nconst data = $(\"Parse Callback Data\").item.json;\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'paginate',\n containerId: null,\n containerName: null,\n page: data.page || 0,\n queryId: data.queryId,\n searchTerm: null\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-paginate-input",
|
||||
"name": "Prepare Paginate Input",
|
||||
@@ -4092,7 +4092,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for Container Status sub-workflow from batch cancel return\nconst data = $input.item.json;\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'paginate',\n containerId: null,\n containerName: null,\n page: data.page || 0,\n queryId: data.queryId || null,\n searchTerm: null\n }\n};"
|
||||
"jsCode": "// Prepare input for Container Status sub-workflow from batch cancel return\nconst data = $input.item.json;\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'paginate',\n containerId: null,\n containerName: null,\n page: data.page || 0,\n queryId: data.queryId || null,\n searchTerm: null\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-batch-cancel-input",
|
||||
"name": "Prepare Batch Cancel Return Input",
|
||||
@@ -4127,7 +4127,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for confirmation sub-workflow\nconst data = $('Parse Callback Data').item.json;\n\n// Determine action based on callback type\nlet action = 'confirm'; // Default\nif (data.isCancelConfirm) {\n action = 'cancel';\n} else if (data.isConfirm && data.expired) {\n action = 'expired';\n} else if (data.isConfirm) {\n action = 'confirm';\n}\n\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: action,\n containerId: data.containerId || '',\n containerName: data.containerName,\n confirmAction: data.confirmAction || '',\n confirmationToken: data.timestamp || '',\n expired: data.expired || false,\n responseMode: 'inline'\n }\n};"
|
||||
"jsCode": "// Prepare input for confirmation sub-workflow\nconst data = $('Parse Callback Data').item.json;\n\n// Determine action based on callback type\nlet action = 'confirm'; // Default\nif (data.isCancelConfirm) {\n action = 'cancel';\n} else if (data.isConfirm && data.expired) {\n action = 'expired';\n} else if (data.isConfirm) {\n action = 'confirm';\n}\n\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: action,\n containerId: data.containerId || '',\n containerName: data.containerName,\n confirmAction: data.confirmAction || '',\n confirmationToken: data.timestamp || '',\n expired: data.expired || false,\n responseMode: 'inline'\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-confirm-input",
|
||||
"name": "Prepare Confirm Input",
|
||||
@@ -4140,7 +4140,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for showing stop confirmation dialog\nconst data = $('Parse Callback Data').item.json;\n\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'show_stop',\n containerId: data.containerId || '',\n containerName: data.containerName,\n responseMode: 'inline'\n }\n};"
|
||||
"jsCode": "// Prepare input for showing stop confirmation dialog\nconst data = $('Parse Callback Data').item.json;\n\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'show_stop',\n containerId: data.containerId || '',\n containerName: data.containerName,\n responseMode: 'inline'\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-show-stop",
|
||||
"name": "Prepare Show Stop Input",
|
||||
@@ -4153,7 +4153,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for showing update confirmation dialog\nconst data = $('Parse Callback Data').item.json;\n\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'show_update',\n containerId: data.containerId || '',\n containerName: data.containerName,\n responseMode: 'inline'\n }\n};"
|
||||
"jsCode": "// Prepare input for showing update confirmation dialog\nconst data = $('Parse Callback Data').item.json;\n\nreturn {\n json: {\n chatId: data.chatId,\n messageId: data.messageId,\n action: 'show_update',\n containerId: data.containerId || '',\n containerName: data.containerName,\n responseMode: 'inline'\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-show-update",
|
||||
"name": "Prepare Show Update Input",
|
||||
@@ -4389,7 +4389,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for matching sub-workflow (action commands)\nconst dockerOutput = $input.item.json.stdout;\nconst actionData = $('Parse Action Command').item.json;\nconst action = actionData.action || 'restart';\nconst containerQuery = actionData.containerQuery || '';\nconst chatId = actionData.chatId;\n\nreturn {\n json: {\n action: \"match_action\",\n containerList: dockerOutput,\n searchTerm: containerQuery,\n selectedContainers: \"\",\n chatId: chatId,\n messageId: 0\n }\n};"
|
||||
"jsCode": "// Prepare input for matching sub-workflow (action commands)\nconst dockerOutput = $input.item.json.stdout;\nconst actionData = $('Parse Action Command').item.json;\nconst action = actionData.action || 'restart';\nconst containerQuery = actionData.containerQuery || '';\nconst chatId = actionData.chatId;\n\nreturn {\n json: {\n action: \"match_action\",\n containerList: dockerOutput,\n searchTerm: containerQuery,\n selectedContainers: \"\",\n chatId: chatId,\n messageId: 0\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-action-match-input",
|
||||
"name": "Prepare Action Match Input",
|
||||
@@ -4558,7 +4558,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for matching sub-workflow (update commands)\nconst dockerOutput = $input.item.json.stdout;\nconst updateData = $('Parse Update Command').item.json;\nconst containerQuery = updateData.containerQuery;\nconst chatId = updateData.chatId;\n\nreturn {\n json: {\n action: \"match_update\",\n containerList: dockerOutput,\n searchTerm: containerQuery,\n selectedContainers: \"\",\n chatId: chatId,\n messageId: 0\n }\n};"
|
||||
"jsCode": "// Prepare input for matching sub-workflow (update commands)\nconst dockerOutput = $input.item.json.stdout;\nconst updateData = $('Parse Update Command').item.json;\nconst containerQuery = updateData.containerQuery;\nconst chatId = updateData.chatId;\n\nreturn {\n json: {\n action: \"match_update\",\n containerList: dockerOutput,\n searchTerm: containerQuery,\n selectedContainers: \"\",\n chatId: chatId,\n messageId: 0\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-update-match-input",
|
||||
"name": "Prepare Update Match Input",
|
||||
@@ -4704,7 +4704,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Prepare input for matching sub-workflow (batch commands)\nconst dockerOutput = $input.item.json.stdout;\nconst batchData = $('Detect Batch Command').item.json;\nconst containerNames = batchData.containerNames;\nconst action = batchData.action;\nconst chatId = batchData.chatId;\nconst messageId = batchData.messageId;\n\n// Convert containerNames array to CSV for sub-workflow input\nconst selectedContainers = Array.isArray(containerNames) ? containerNames.join(',') : containerNames;\n\nreturn {\n json: {\n action: \"match_batch\",\n containerList: dockerOutput,\n searchTerm: \"\",\n selectedContainers: selectedContainers,\n chatId: chatId,\n messageId: messageId\n }\n};"
|
||||
"jsCode": "// Prepare input for matching sub-workflow (batch commands)\nconst dockerOutput = $input.item.json.stdout;\nconst batchData = $('Detect Batch Command').item.json;\nconst containerNames = batchData.containerNames;\nconst action = batchData.action;\nconst chatId = batchData.chatId;\nconst messageId = batchData.messageId;\n\n// Convert containerNames array to CSV for sub-workflow input\nconst selectedContainers = Array.isArray(containerNames) ? containerNames.join(',') : containerNames;\n\nreturn {\n json: {\n action: \"match_batch\",\n containerList: dockerOutput,\n searchTerm: \"\",\n selectedContainers: selectedContainers,\n chatId: chatId,\n messageId: messageId\n },\n correlationId: $input.item.json.correlationId || ''\n }\n};"
|
||||
},
|
||||
"id": "code-prepare-batch-match-input",
|
||||
"name": "Prepare Batch Match Input",
|
||||
@@ -4967,6 +4967,92 @@
|
||||
2600,
|
||||
-400
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Generate correlation ID for this request\nconst correlationId = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\nreturn {\n json: {\n ...$input.item.json,\n correlationId\n }\n};"
|
||||
},
|
||||
"id": "code-generate-correlation-id",
|
||||
"name": "Generate Correlation ID",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
700,
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Generate correlation ID for this callback\nconst correlationId = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\nreturn {\n json: {\n ...$input.item.json,\n correlationId\n }\n};"
|
||||
},
|
||||
"id": "code-generate-callback-correlation-id",
|
||||
"name": "Generate Callback Correlation ID",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
2400,
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "check-success",
|
||||
"leftValue": "={{ $json.success }}",
|
||||
"rightValue": false,
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
}
|
||||
},
|
||||
"id": "if-check-success-qokchnw8",
|
||||
"name": "Check Execute Container Action Success",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.2,
|
||||
"position": [
|
||||
2240,
|
||||
500
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "check-success",
|
||||
"leftValue": "={{ $json.success }}",
|
||||
"rightValue": false,
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
}
|
||||
},
|
||||
"id": "if-check-success-8aoev7xt",
|
||||
"name": "Check Execute Inline Action Success",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.2,
|
||||
"position": [
|
||||
2680,
|
||||
1200
|
||||
]
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
@@ -6136,7 +6222,7 @@
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Handle Text Action Result",
|
||||
"node": "Check Execute Container Action Success",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
@@ -6169,7 +6255,7 @@
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Handle Inline Action Result",
|
||||
"node": "Check Execute Inline Action Success",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
@@ -6862,6 +6948,69 @@
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"code-generate-correlation-id": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Keyword Router",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"code-generate-callback-correlation-id": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Parse Callback Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"code-log-error": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Check Execute Container Action Success": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Log Error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Handle Text Action Result",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Execute Inline Action Success": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Log Error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Handle Inline Action Result",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {},
|
||||
|
||||
Reference in New Issue
Block a user