Skip to content

Commit 3bbd7d8

Browse files
committed
Update alert message builder to use new fact block types
- Replaced `FactsBlock` with `FactListBlock` to support primary and non-primary fact blocks - Converted existing facts to use `PrimaryFactBlock` for table and column - Used `NonPrimaryFactBlock` for tags, owners, subscribers, description, and path - Maintained existing information display while improving block type specificity
1 parent edda310 commit 3bbd7d8

File tree

1 file changed

+24
-10
lines changed
  • elementary/monitor/alerts/alert_messages

1 file changed

+24
-10
lines changed

elementary/monitor/alerts/alert_messages/builder.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
FactsBlock,
88
JsonCodeBlock,
99
LinkLineBlock,
10+
NonPrimaryFactBlock,
11+
PrimaryFactBlock,
1012
SummaryLineBlock,
1113
)
1214
from elementary.messages.blocks import (
1315
CodeBlock,
1416
DividerBlock,
1517
ExpandableBlock,
18+
FactListBlock,
1619
HeaderBlock,
1720
Icon,
1821
InlineBlock,
@@ -222,23 +225,34 @@ def _get_details_blocks(
222225
]
223226
)
224227
)
225-
facts = []
228+
fact_blocks = []
226229
if table:
227-
facts.append(("Table", table))
230+
fact_blocks.append(PrimaryFactBlock(("Table", table)))
228231
if column:
229-
facts.append(("Column", column))
232+
fact_blocks.append(PrimaryFactBlock(("Column", column)))
230233

231-
facts.append(("Tags", ", ".join(tags) if tags else "No tags"))
232-
facts.append(("Owners", ", ".join(owners) if owners else "No owners"))
233-
facts.append(
234-
("Subscribers", ", ".join(subscribers) if subscribers else "No subscribers")
234+
fact_blocks.append(
235+
NonPrimaryFactBlock(("Tags", ", ".join(tags) if tags else "No tags"))
236+
)
237+
fact_blocks.append(
238+
NonPrimaryFactBlock(
239+
("Owners", ", ".join(owners) if owners else "No owners")
240+
)
241+
)
242+
fact_blocks.append(
243+
NonPrimaryFactBlock(
244+
(
245+
"Subscribers",
246+
", ".join(subscribers) if subscribers else "No subscribers",
247+
)
248+
)
235249
)
236250

237251
if description:
238-
facts.append(("Description", description))
252+
fact_blocks.append(NonPrimaryFactBlock(("Description", description)))
239253
if path:
240-
facts.append(("Path", path))
241-
blocks.append(FactsBlock(facts=facts))
254+
fact_blocks.append(NonPrimaryFactBlock(("Path", path)))
255+
blocks.append(FactListBlock(facts=fact_blocks))
242256
return blocks
243257

244258
def _get_result_blocks(

0 commit comments

Comments
 (0)