From 119965b4324bade48fa3969f1f26a94a7deca38f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 23 Mar 2020 12:23:25 +0200 Subject: [PATCH] Change the order of fields in slack notifications: start with description, project name and tags. Follow with period, last ping, total pings. --- CHANGELOG.md | 1 + templates/integrations/slack_message.json | 25 +++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cd8edc6..65d76b5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. - OpsGenie integration returns more detailed error messages - Telegram integration returns more detailed error messages - Added the "Get a single check" API call (#337) +- Display project name in Slack notifications (#342) ### Bug Fixes - The "render_docs" command checks if markdown and pygments is installed (#329) diff --git a/templates/integrations/slack_message.json b/templates/integrations/slack_message.json index 72a08101..618bf6c3 100644 --- a/templates/integrations/slack_message.json +++ b/templates/integrations/slack_message.json @@ -13,17 +13,26 @@ "mrkdwn_in": ["fields"], "text": "“{{ check.name_then_code|escapejs }}” is {{ check.status|upper }}.", "fields": [ + {% if check.desc %} + {"title": "Description", + "value": "{{ check.desc|escapejs }}" + }, + {% endif %} + {% if check.project.name %} {"title": "Project", - "value": "{{ check.project.name|escapejs }}" + "value": "{{ check.project.name|escapejs }}", + "short": true }, {% endif %} - - {% if check.desc %} - {"title": "Description", - "value": "{{ check.desc|escapejs }}" + + {% if check.tags_list %} + {"title": "Tags", + "value": "{% for tag in check.tags_list %}`{{ tag|escapejs }}` {% endfor %}", + "short": true }, {% endif %} + {% if check.kind == "simple" %} {"title": "Period", "value": "{{ check.timeout|hc_duration }}", @@ -45,12 +54,6 @@ "short": true }, - {% if check.tags_list %} - {"title": "Tags", - "value": "{% for tag in check.tags_list %}`{{ tag|escapejs }}` {% endfor %}", - "short": true - }, - {% endif %} {"title": "Total Pings", "value": "{{ check.n_pings }}",