diff --git a/src/config/production_template.yaml b/src/config/production_template.yaml index 7832711e..3612fa7a 100644 --- a/src/config/production_template.yaml +++ b/src/config/production_template.yaml @@ -262,7 +262,7 @@ Butler: rateLimit: 300 # Min seconds between emails for a given taskID. Defaults to 5 minutes. headScriptLogLines: 10 tailScriptLogLines: 10 - templateFile: /path/to/teams/template/directory/failed-reload.handlebars + templateFile: /path/to/teams/template/directory/failed-reload-qseow.handlebars reloadTaskAborted: enable: false webhookURL: @@ -271,7 +271,7 @@ Butler: rateLimit: 300 # Min seconds between emails for a given taskID. Defaults to 5 minutes. headScriptLogLines: 10 tailScriptLogLines: 10 - templateFile: /path/to/teams/template/directory/aborted-reload.handlebars + templateFile: /path/to/teams/template/directory/aborted-reload-qseow.handlebars serviceStopped: webhookURL: messageType: formatted # formatted / basic. Formatted means that template file below will be used to create the message. diff --git a/src/config/teams_templates/aborted-reload.handlebars b/src/config/teams_templates/aborted-reload-qseow.handlebars similarity index 100% rename from src/config/teams_templates/aborted-reload.handlebars rename to src/config/teams_templates/aborted-reload-qseow.handlebars diff --git a/src/config/teams_templates/failed-reload-qseow.handlebars b/src/config/teams_templates/failed-reload-qseow.handlebars new file mode 100644 index 00000000..a3c603c3 --- /dev/null +++ b/src/config/teams_templates/failed-reload-qseow.handlebars @@ -0,0 +1,203 @@ +{ + "type": "message", + "attachments": [ + { + "contentType": "application/vnd.microsoft.card.adaptive", + "contentUrl": null, + "content": { + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "type": "AdaptiveCard", + "version": "1.3", + "msteams": { + "width": "Full" + }, + "body": [ + { + "type": "TextBlock", + "size": "large", + "weight": "bolder", + "text": "Qlik Sense reload task failed", + "style": "heading", + "wrap": true + }, + { + "type": "ColumnSet", + "columns": [ + { + "type": "Column", + "items": [ + { + "type": "Image", + "style": "person", + "url": "https://raw.githubusercontent.com/ptarmiganlabs/butler/master/icon.png", + "altText": "Butler the Bot", + "size": "medium" + } + ], + "width": "auto" + }, + { + "type": "Column", + "items": [ + { + "type": "TextBlock", + "weight": "bolder", + "text": "Butler the Bot", + "wrap": true + }, + { + "type": "TextBlock", + "spacing": "none", + "text": "", + "isSubtle": true, + "wrap": true + } + ], + "width": "stretch" + } + ] + }, + { + "type": "FactSet", + "spacing": "large", + "facts": [ + { + "title": "App name:", + "value": "{{appName}}" + }, + { + "title": "App ID:", + "value": "{{appId}}" + }, + { + "title": "Task name:", + "value": "{{taskName}}" + }, + { + "title": "Task ID:", + "value": "{{tasId}}" + }, + { + "title": "App owner:", + "value": "{{appOwnerName}}" + }, + { + "title": "App owner user:", + "value": "{{appOwnerUserDirectory}}/{{appOwnerUserId}}" + }, + { + "title": "App owner email:", + "value": "{{appOwnerEmail}}" + }, + { + "title": "Reload started:", + "value": "{{executionStartTime.startTimeLocal1}}" + }, + { + "title": "Duration:", + "value": "{{executionDuration.hours}} hours, {{executionDuration.minutes}} minutes, {{executionDuration.seconds}} seconds" + }, + { + "title": "Reload ended:", + "value": "{{executionStopTime.stopTimeLocal1}}" + }, + { + "title": "User starting the reload:", + "value": "{{executionStartTime.startTimeLocal1}}" + } + ] + }, + + { + "type": "ActionSet", + "spacing": "extraLarge", + "separator": true, + "actions": [ + { + "type": "Action.OpenUrl", + "title": "Open QMC", + "tooltip": "Open management console in Qlik Sense", + "url": "{{qlikSenseQMC}}", + "role": "button" + }, + { + "type": "Action.OpenUrl", + "title": "Open hub", + "tooltip": "Open hub Qlik Sense", + "url": "{{qlikSenseQMC}}", + "role": "button" + } + ] + }, + + + { + "type": "Container", + "spacing": "extraLarge", + "style": "emphasis", + "items": [ + { + "type": "TextBlock", + "size": "large", + "weight": "bolder", + "text": "Details", + "style": "heading" + }, + { + "type": "FactSet", + "separator": true, + "facts": [ + { + "title": "Execution result:", + "value": "{{executionStatusText}}" + }, + { + "title": "Execution result code:", + "value": "{{executionStatusNum}}" + }, + { + "title": "Log timestamp:", + "value": "{{logTimeStamp}}" + }, + { + "title": "Log message:", + "value": "{{logMessage}}" + } + ] + }, + { + "type": "CodeBlock", + "codeSnippet": "{{executionDetailsConcatenated}}" + } + ] + }, + { + "type": "Container", + "spacing": "extraLarge", + "style": "emphasis", + "items": [ + { + "type": "TextBlock", + "size": "large", + "weight": "bolder", + "text": "End of script log", + "style": "heading" + }, + { + "type": "TextBlock", + "size": "small", + "weight": "normal", + "text": "Last {{scriptLogTailCount}} rows shown. The script log contains {{scriptLogSize}} rows in total.", + "style": "heading" + }, + { + "type": "CodeBlock", + "codeSnippet": "{{scriptLogTail}}" + } + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/config/teams_templates/failed-reload.handlebars b/src/config/teams_templates/failed-reload.handlebars deleted file mode 100644 index 770f3a51..00000000 --- a/src/config/teams_templates/failed-reload.handlebars +++ /dev/null @@ -1,89 +0,0 @@ -{ - "@type": "MessageCard", - "@context": "https://schema.org/extensions", - "themeColor": "0076D7", - "summary": "Qlik Sense reload task failed", - "sections": [{ - "activityTitle": "# Reload task failed: '{{taskName}}'", - "activitySubtitle": "Reload attempt was done on server: {{executingNodeName}}", - "facts": [{ - "name": "App name", - "value": "{{appName}}" - },{ - "name": "App ID", - "value": "{{appId}}" - },{ - "name": "Task Name", - "value": "{{taskName}}" - },{ - "name": "Task ID", - "value": "{{taskId}}" - },{ - "name": "App owner", - "value": "{{appOwnerName}}" - },{ - "name": "App owner user", - "value": "{{appOwnerUserDirectory}}/{{appOwnerUserId}}" - },{ - "name": "App owner email", - "value": "{{appOwnerEmail}}" - }], - "markdown": true - }, { - "facts": [{ - "name": "User starting the reload", - "value": "{{user}}" - },{ - "name": "Duration", - "value": "{{executionDuration.hours}} hours, {{executionDuration.minutes}} minutes, {{executionDuration.seconds}} seconds" - },{ - "name": "Execution started", - "value": "{{executionStartTime.startTimeLocal1}}" - },{ - "name": "Execution ended", - "value": "{{executionStartTime.stopTimeLocal1}}" - },{ - "name": "Execution result", - "value": "{{executionStatusText}}" - },{ - "name": "Execution result code", - "value": "{{executionStatusNum}}" - },{ - "name": "Log timestamp", - "value": "{{logTimeStamp}}" - },{ - "name": "Log message", - "value": "{{logMessage}}" - }], - "markdown": true - },{ - "activityTitle": "History", - "text": "{{executionDetailsConcatenated}}", - "markdown": true - },{ - "activityTitle": "Beginning of script log (up to {{scriptLogHeadCount}} lines)", - "activitySubtitle": "The script log contains {{scriptLogSize}} characters in total.", - "text": "{{scriptLogHead}}", - "markdown": true - },{ - "activityTitle": "End of script log (up to {{scriptLogTailCount}} lines)", - "activitySubtitle": "The script log contains {{scriptLogSize}} characters in total.", - "text": "{{scriptLogTail}}", - "markdown": true - }], - "potentialAction": [{ - "@type": "OpenUri", - "name": "Qlik Sense QMC", - "targets": [{ - "os": "default", - "uri": "{{qlikSenseQMC}}" - }] - },{ - "@type": "OpenUri", - "name": "Qlik Sense Hub", - "targets": [{ - "os": "default", - "uri": "{{qlikSenseHub}}" - }] - }] -} diff --git a/src/lib/msteams_notification.js b/src/lib/msteams_notification.js index 8a1ca50b..cd1dba80 100644 --- a/src/lib/msteams_notification.js +++ b/src/lib/msteams_notification.js @@ -483,16 +483,16 @@ export function sendReloadTaskFailureNotificationTeams(reloadParams) { executionDetails: scriptLogData.executionDetails, executionDetailsConcatenated: scriptLogData.executionDetailsConcatenated .replace(/([\r])/gm, '') - .replace(/([\n])/gm, '\\n\\n') + .replace(/([\n])/gm, '\\n') .replace(/([\t])/gm, '\\t'), scriptLogSize: scriptLogData.scriptLogSize, scriptLogHead: scriptLogData.scriptLogHead .replace(/([\r])/gm, '') - .replace(/([\n])/gm, '\\n\\n') + .replace(/([\n])/gm, '\\n') .replace(/([\t])/gm, '\\t'), scriptLogTail: scriptLogData.scriptLogTail .replace(/([\r])/gm, '') - .replace(/([\n])/gm, '\\n\\n') + .replace(/([\n])/gm, '\\n') .replace(/([\t])/gm, '\\t'), scriptLogTailCount: scriptLogData.scriptLogTailCount, scriptLogHeadCount: scriptLogData.scriptLogHeadCount, @@ -629,16 +629,16 @@ export function sendReloadTaskAbortedNotificationTeams(reloadParams) { executionDetails: scriptLogData.executionDetails, executionDetailsConcatenated: scriptLogData.executionDetailsConcatenated .replace(/([\r])/gm, '') - .replace(/([\n])/gm, '\\n\\n') + .replace(/([\n])/gm, '\\n') .replace(/([\t])/gm, '\\t'), scriptLogSize: scriptLogData.scriptLogSize, scriptLogHead: scriptLogData.scriptLogHead .replace(/([\r])/gm, '') - .replace(/([\n])/gm, '\\n\\n') + .replace(/([\n])/gm, '\\n') .replace(/([\t])/gm, '\\t'), scriptLogTail: scriptLogData.scriptLogTail .replace(/([\r])/gm, '') - .replace(/([\n])/gm, '\\n\\n') + .replace(/([\n])/gm, '\\n') .replace(/([\t])/gm, '\\t'), scriptLogTailCount: scriptLogData.scriptLogTailCount, scriptLogHeadCount: scriptLogData.scriptLogHeadCount,