Skip to content

Commit a5a243b

Browse files
committed
Array children rendering fixes and misc refactors.
1 parent aeedf29 commit a5a243b

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/azure-cli/azure/cli/command_modules/resource/_stacks_formatters.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,10 @@ def _format_resource_changes(
198198
last_group = group
199199
has_potential_changes = False
200200

201-
if str_lower_eq(change.change_certainty, StackModels.DeploymentStacksWhatIfChangeCertainty.POTENTIAL):
202-
if not has_potential_changes:
203-
self.builder.append(">> ").append_line(
204-
"Potential Resource Changes (Learn more at https://aka.ms/whatIfPotentialChanges)",
205-
Color.PURPLE)
206-
201+
if not has_potential_changes and str_lower_eq(change.change_certainty, StackModels.DeploymentStacksWhatIfChangeCertainty.POTENTIAL):
202+
self.builder.append(">> ").append_line(
203+
"Potential Resource Changes (Learn more at https://aka.ms/whatIfPotentialChanges)",
204+
Color.PURPLE)
207205
has_potential_changes = True
208206

209207
self._format_resource_change(change)
@@ -261,14 +259,11 @@ def _format_resource_deletions_summary(
261259
last_group = group
262260
has_potential_deletions = False
263261

264-
if str_lower_eq(
262+
if not has_potential_deletions and str_lower_eq(
265263
delete_change.change_certainty, StackModels.DeploymentStacksWhatIfChangeCertainty.POTENTIAL):
266-
267-
if not has_potential_deletions:
268-
self.builder.append(">> ").append_line(
269-
f"Potential Deletions {self._get_num_potential_resource_changes(delete_changes, i)} total (Learn more at https://aka.ms/whatIfPotentialChanges)",
270-
Color.RED)
271-
264+
self.builder.append(">> ").append_line(
265+
f"Potential Deletions {self._get_num_potential_resource_changes(delete_changes, i)} total (Learn more at https://aka.ms/whatIfPotentialChanges)",
266+
Color.RED)
272267
has_potential_deletions = True
273268

274269
self._format_resource_heading_line(delete_change)
@@ -406,7 +401,8 @@ def _format_array_changes(
406401

407402
for i, item_change in enumerate(sorted_children):
408403
if print_array_indices:
409-
self.builder.append_line(f"{item_change.path}:")
404+
child_symbol, child_color = self._get_change_type_formatting(item_change.change_type)
405+
self.builder.append(child_symbol, child_color).append_line(f" {item_change.path}:")
410406
self._push_indent()
411407

412408
if self._format_change(item_change, is_array_item=True) and i < len(array_change.children) - 1:

0 commit comments

Comments
 (0)