diff --git a/n8n-workflow.json b/n8n-workflow.json
index 82883ae..833495b 100644
--- a/n8n-workflow.json
+++ b/n8n-workflow.json
@@ -4747,6 +4747,38 @@
-400
]
},
+ {
+ "parameters": {
+ "conditions": {
+ "options": {
+ "caseSensitive": true,
+ "leftValue": "",
+ "typeValidation": "strict"
+ },
+ "conditions": [
+ {
+ "id": "is-batch-complete",
+ "leftValue": "={{ $json.isComplete }}",
+ "rightValue": true,
+ "operator": {
+ "type": "boolean",
+ "operation": "equals"
+ }
+ }
+ ],
+ "combinator": "and"
+ },
+ "options": {}
+ },
+ "id": "if-batch-complete",
+ "name": "Is Batch Complete",
+ "type": "n8n-nodes-base.if",
+ "typeVersion": 2,
+ "position": [
+ 5620,
+ -400
+ ]
+ },
{
"parameters": {
"jsCode": "// Prepare batch stop data for execution\n// Input from Check Batch Stop Expired (not expired)\nconst data = $json;\n\n// containerNames is a comma-separated array from callback\nconst containerNames = data.containerNames || [];\n\nreturn {\n json: {\n allMatched: containerNames.map(name => ({ Name: name, Id: null })),\n action: 'stop',\n chatId: data.chatId,\n messageId: data.messageId\n }\n};"
@@ -4772,6 +4804,37 @@
1560,
900
]
+ },
+ {
+ "parameters": {
+ "jsCode": "// Build batch summary message with failure emphasis\n// Input: final batch state with results array and counters\nconst data = $json;\n\nconst action = data.action;\nconst results = data.results || [];\nconst successCount = data.successCount || 0;\nconst failureCount = data.failureCount || 0;\nconst warningCount = data.warningCount || 0;\nconst totalCount = data.totalCount || results.length;\nconst chatId = data.chatId;\nconst progressMessageId = data.progressMessageId;\n\n// Build summary text - failures emphasized first\nlet summaryText = `Batch ${action} Complete\\n\\n`;\n\n// Show failures first and prominently\nconst failures = results.filter(r => r.status === 'error');\nif (failures.length > 0) {\n summaryText += `\\u274c Failed (${failures.length}):\\n`;\n for (const f of failures) {\n summaryText += `\\u2022 ${f.name}: ${f.reason || 'Unknown error'}\\n`;\n }\n summaryText += '\\n';\n}\n\n// Show warnings summary (not individual) per context discretion\nconst warnings = results.filter(r => r.status === 'warning');\nif (warnings.length > 0) {\n // If 3 or fewer warnings, show details; otherwise just count\n if (warnings.length <= 3) {\n summaryText += `\\u26a0\\ufe0f Warnings (${warnings.length}):\\n`;\n for (const w of warnings) {\n summaryText += `\\u2022 ${w.name}: ${w.reason}\\n`;\n }\n summaryText += '\\n';\n } else {\n summaryText += `\\u26a0\\ufe0f Warnings: ${warnings.length} (containers already in desired state)\\n\\n`;\n }\n}\n\n// Show success count\nif (successCount > 0) {\n summaryText += `\\u2705 Successful: ${successCount}/${totalCount}\\n`;\n} else if (failureCount === 0 && warningCount > 0) {\n // All warnings, no success/failures\n summaryText += `No changes needed for ${totalCount} container(s)\\n`;\n}\n\nreturn {\n json: {\n chatId: chatId,\n messageId: progressMessageId,\n text: summaryText,\n hasFailures: failureCount > 0\n }\n};"
+ },
+ "id": "code-build-batch-summary",
+ "name": "Build Batch Summary",
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ 5740,
+ -400
+ ]
+ },
+ {
+ "parameters": {
+ "method": "POST",
+ "url": "=https://api.telegram.org/bot{{ $env.TELEGRAM_BOT_TOKEN }}/editMessageText",
+ "sendBody": true,
+ "specifyBody": "json",
+ "jsonBody": "={{ JSON.stringify({ chat_id: $json.chatId, message_id: $json.messageId, text: $json.text, parse_mode: 'HTML', reply_markup: { inline_keyboard: [[{ text: 'Back to List', callback_data: 'list:0' }]] } }) }}",
+ "options": {}
+ },
+ "id": "http-send-batch-summary",
+ "name": "Send Batch Summary",
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.2,
+ "position": [
+ 5960,
+ -400
+ ]
}
],
"connections": {
@@ -6954,6 +7017,24 @@
},
"Prepare Next Iteration": {
"main": [
+ [
+ {
+ "node": "Is Batch Complete",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Is Batch Complete": {
+ "main": [
+ [
+ {
+ "node": "Build Batch Summary",
+ "type": "main",
+ "index": 0
+ }
+ ],
[
{
"node": "Batch Loop",
@@ -6963,6 +7044,17 @@
]
]
},
+ "Build Batch Summary": {
+ "main": [
+ [
+ {
+ "node": "Send Batch Summary",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
"Prepare Batch Stop Exec": {
"main": [
[