|
9 | 9 | from elementary.clients.slack.schema import SlackBlocksType, SlackMessageSchema |
10 | 10 | from elementary.clients.slack.slack_message_builder import MessageColor |
11 | 11 | from elementary.config.config import Config |
| 12 | +from elementary.messages.blocks import Icon |
| 13 | +from elementary.messages.formats.unicode import ICON_TO_UNICODE |
12 | 14 | from elementary.monitor.alerts.alerts_groups import AlertsGroup, GroupedByTableAlerts |
13 | 15 | from elementary.monitor.alerts.alerts_groups.base_alerts_group import BaseAlertsGroup |
14 | 16 | from elementary.monitor.alerts.model_alert import ModelAlertModel |
@@ -171,8 +173,11 @@ def _get_dbt_test_template( |
171 | 173 | ) |
172 | 174 |
|
173 | 175 | compacted_sections = [] |
174 | | - if COLUMN_FIELD in (alert.alert_fields or DEFAULT_ALERT_FIELDS): |
175 | | - compacted_sections.append(f"*Column*\n{alert.column_name or '_No column_'}") |
| 176 | + if ( |
| 177 | + COLUMN_FIELD in (alert.alert_fields or DEFAULT_ALERT_FIELDS) |
| 178 | + and alert.column_name |
| 179 | + ): |
| 180 | + compacted_sections.append(f"*Column*\n{alert.column_name}") |
176 | 181 | if TAGS_FIELD in (alert.alert_fields or DEFAULT_ALERT_FIELDS): |
177 | 182 | tags = prettify_and_dedup_list(alert.tags or []) |
178 | 183 | compacted_sections.append(f"*Tags*\n{tags or '_No tags_'}") |
@@ -223,7 +228,7 @@ def _get_dbt_test_template( |
223 | 228 | result.extend( |
224 | 229 | [ |
225 | 230 | self.message_builder.create_text_section_block( |
226 | | - "*Test results sample*" |
| 231 | + f"{ICON_TO_UNICODE[Icon.MAGNIFYING_GLASS]} *Test results sample*" |
227 | 232 | ), |
228 | 233 | self.message_builder.create_text_section_block( |
229 | 234 | f"```{test_rows_sample_table}```" |
@@ -332,8 +337,11 @@ def _get_elementary_test_template( |
332 | 337 | ) |
333 | 338 |
|
334 | 339 | compacted_sections = [] |
335 | | - if COLUMN_FIELD in (alert.alert_fields or DEFAULT_ALERT_FIELDS): |
336 | | - compacted_sections.append(f"*Column*\n{alert.column_name or '_No column_'}") |
| 340 | + if ( |
| 341 | + COLUMN_FIELD in (alert.alert_fields or DEFAULT_ALERT_FIELDS) |
| 342 | + and alert.column_name |
| 343 | + ): |
| 344 | + compacted_sections.append(f"*Column*\n{alert.column_name}") |
337 | 345 | if TAGS_FIELD in (alert.alert_fields or DEFAULT_ALERT_FIELDS): |
338 | 346 | tags = prettify_and_dedup_list(alert.tags or []) |
339 | 347 | compacted_sections.append(f"*Tags*\n{tags or '_No tags_'}") |
@@ -1196,6 +1204,9 @@ def _create_single_alert_details_blocks( |
1196 | 1204 | if result: |
1197 | 1205 | details_blocks.extend( |
1198 | 1206 | [ |
| 1207 | + self.message_builder.create_text_section_block( |
| 1208 | + f"{ICON_TO_UNICODE[Icon.INFO]} *Details*" |
| 1209 | + ), |
1199 | 1210 | self.message_builder.create_divider_block(), |
1200 | 1211 | *result, |
1201 | 1212 | ] |
|
0 commit comments