|
5 | 5 | BoldTextLineBlock, |
6 | 6 | BulletListBlock, |
7 | 7 | FactsBlock, |
| 8 | + ItalicTextLineBlock, |
8 | 9 | JsonCodeBlock, |
9 | 10 | LinkLineBlock, |
| 11 | + NonPrimaryFactBlock, |
| 12 | + PrimaryFactBlock, |
10 | 13 | SummaryLineBlock, |
| 14 | + TextLineBlock, |
11 | 15 | ) |
12 | 16 | from elementary.messages.blocks import ( |
13 | 17 | CodeBlock, |
14 | 18 | DividerBlock, |
15 | 19 | ExpandableBlock, |
| 20 | + FactListBlock, |
16 | 21 | HeaderBlock, |
17 | 22 | Icon, |
18 | 23 | InlineBlock, |
@@ -217,23 +222,54 @@ def _get_details_blocks( |
217 | 222 | ] |
218 | 223 | ) |
219 | 224 | ) |
220 | | - facts = [] |
| 225 | + fact_blocks = [] |
221 | 226 | if table: |
222 | | - facts.append(("Table", table)) |
| 227 | + fact_blocks.append( |
| 228 | + PrimaryFactBlock( |
| 229 | + (TextLineBlock(text="Table"), TextLineBlock(text=table)) |
| 230 | + ) |
| 231 | + ) |
223 | 232 | if column: |
224 | | - facts.append(("Column", column)) |
| 233 | + fact_blocks.append( |
| 234 | + NonPrimaryFactBlock( |
| 235 | + (TextLineBlock(text="Column"), TextLineBlock(text=column)) |
| 236 | + ) |
| 237 | + ) |
225 | 238 |
|
226 | | - facts.append(("Tags", ", ".join(tags) if tags else "No tags")) |
227 | | - facts.append(("Owners", ", ".join(owners) if owners else "No owners")) |
228 | | - facts.append( |
229 | | - ("Subscribers", ", ".join(subscribers) if subscribers else "No subscribers") |
| 239 | + tags_line = ( |
| 240 | + TextLineBlock(text=", ".join(tags)) |
| 241 | + if tags |
| 242 | + else ItalicTextLineBlock(text="No tags") |
| 243 | + ) |
| 244 | + owners_line = ( |
| 245 | + TextLineBlock(text=", ".join(owners)) |
| 246 | + if owners |
| 247 | + else ItalicTextLineBlock(text="No owners") |
| 248 | + ) |
| 249 | + subscribers_line = ( |
| 250 | + TextLineBlock(text=", ".join(subscribers)) |
| 251 | + if subscribers |
| 252 | + else ItalicTextLineBlock(text="No subscribers") |
| 253 | + ) |
| 254 | + fact_blocks.append(NonPrimaryFactBlock((TextLineBlock(text="Tags"), tags_line))) |
| 255 | + fact_blocks.append( |
| 256 | + NonPrimaryFactBlock((TextLineBlock(text="Owners"), owners_line)) |
| 257 | + ) |
| 258 | + fact_blocks.append( |
| 259 | + NonPrimaryFactBlock((TextLineBlock(text="Subscribers"), subscribers_line)) |
230 | 260 | ) |
231 | 261 |
|
232 | 262 | if description: |
233 | | - facts.append(("Description", description)) |
| 263 | + fact_blocks.append( |
| 264 | + PrimaryFactBlock( |
| 265 | + (TextLineBlock(text="Description"), TextLineBlock(text=description)) |
| 266 | + ) |
| 267 | + ) |
234 | 268 | if path: |
235 | | - facts.append(("Path", path)) |
236 | | - blocks.append(FactsBlock(facts=facts)) |
| 269 | + fact_blocks.append( |
| 270 | + PrimaryFactBlock((TextLineBlock(text="Path"), TextLineBlock(text=path))) |
| 271 | + ) |
| 272 | + blocks.append(FactListBlock(facts=fact_blocks)) |
237 | 273 | return blocks |
238 | 274 |
|
239 | 275 | def _get_result_blocks( |
@@ -333,7 +369,7 @@ def _get_model_alert_config_blocks( |
333 | 369 | facts = [] |
334 | 370 | if materialization: |
335 | 371 | facts.append(("Materialization", materialization)) |
336 | | - if full_refresh is not None: |
| 372 | + if full_refresh: |
337 | 373 | facts.append(("Full Refresh", "Yes" if full_refresh else "No")) |
338 | 374 | return [FactsBlock(facts=facts)] |
339 | 375 |
|
@@ -368,6 +404,7 @@ def _get_alert_list_line( |
368 | 404 | if len(owners) == 1: |
369 | 405 | inlines.append(TextBlock(text=f"Owner: {owners.pop()}")) |
370 | 406 | else: |
| 407 | + # order owners by alphabetical order |
371 | 408 | owners.sort() |
372 | 409 | inlines.append(TextBlock(text=f"Owners: {', '.join(owners)}")) |
373 | 410 |
|
|
0 commit comments