Skip to content

Commit 0e02946

Browse files
improved deploy visuals
1 parent 0c4647f commit 0e02946

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

client/testui/client.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,14 @@ func (c *Client) DeployAccounts(ctx context.Context, accountIds ...client.Accoun
353353

354354
checkContextCanceled := func(accountId client.AccountId, deployProgress client.DeployProgressAccounts) bool {
355355
if ctx.Err() != nil {
356-
deployProgress.Accounts[accountId].Status = "error"
357356
deployProgress.Accounts[accountId].Progress = 1
358-
deployProgress.Accounts[accountId].Err = ctx.Err()
357+
if errors.Is(ctx.Err(), context.Canceled) {
358+
deployProgress.Accounts[accountId].Status = "canceled"
359+
deployProgress.Accounts[accountId].Err = errors.New("canceled")
360+
} else {
361+
deployProgress.Accounts[accountId].Status = "error"
362+
deployProgress.Accounts[accountId].Err = ctx.Err()
363+
}
359364
return true
360365
}
361366
return false
@@ -485,7 +490,8 @@ func (c *Client) VerifyAccounts(ctx context.Context, accountIds ...client.Accoun
485490
// simulate getting deployCache from remote
486491
deployCache := c.accountDeployCache(account, deployDatas[i])
487492

488-
if c.accounts[_i].DeployCache != deployCache {
493+
if c.accountDeployCache(account, deployDatas[i]) != deployCache {
494+
c.accounts[_i].DeployCache = deployCache // update local DeployCache to reflect the remotes state
489495
verifyProgress.Accounts[account.Id].Status = "error"
490496
verifyProgress.Accounts[account.Id].Err = errors.New("account is out of sync")
491497
} else {

ui/tui/models/helpers/deploy/deploy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func DeployMany(ctx context.Context, c client.Client, accounts ...client.Account
7979
strings.Join(
8080
slicest.Map(ids, func(id client.AccountId) string {
8181
if dp.Accounts[id].Err != nil {
82-
return fmt.Sprintf("%s %s", accountNameRenderer.Render(accountNamesMap[id]), dp.Accounts[id].Err.Error())
82+
return fmt.Sprintf("%s Error: %s", accountNameRenderer.Render(accountNamesMap[id]), dp.Accounts[id].Err.Error())
8383
}
8484
return fmt.Sprintf("%s Success", accountNameRenderer.Render(accountNamesMap[id]))
8585
}),

0 commit comments

Comments
 (0)