fix(labels): format adding new labels in service plan with + modifier

This commit is contained in:
Pasha Sviderski
2026-11-03 18:46:45 +10:00
parent 7b48ac5a4d
commit 78facdfcc6
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -332,6 +332,8 @@ func formatLabelsDiff(attribute string, oldLabels, newLabels map[string]string,
switch { switch {
case isNewService: case isNewService:
blockMod = " " blockMod = " "
case len(oldLabels) == 0:
blockMod = tui.Green.Render("+")
case len(newLabels) == 0: case len(newLabels) == 0:
blockMod = tui.Red.Render("-") blockMod = tui.Red.Render("-")
} }
+1 -1
View File
@@ -205,7 +205,7 @@ func TestServicePlan_Format(t *testing.T) {
expected: []string{ expected: []string{
"~ update service web", "~ update service web",
" │ image: nginx:1.25", " │ image: nginx:1.25",
" │ ~ labels:", " │ + labels:",
" │ + a=1", " │ + a=1",
" │", " │",
" ╰── ~ update container web/0f6df6593e1b on machine-1 (in place)", " ╰── ~ update container web/0f6df6593e1b on machine-1 (in place)",