Skip to content

Commit

Permalink
fix: Roller run status services render always in the same order (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItayLevyOfficial authored Jul 6, 2023
1 parent 9ad3320 commit b338898
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/run/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package run
import (
"fmt"
"log"
"sort"
"strings"

"github.com/dymensionxyz/roller/config"
Expand Down Expand Up @@ -35,11 +36,15 @@ func NewServiceStatusTable(termWidth int) *widgets.Table {

func updateUITable(serviceData []servicemanager.UIData, table *widgets.Table) {
table.Rows = [][]string{{"Name", "Balance", "Status"}}
sort.Slice(serviceData, func(i, j int) bool {
return serviceData[i].Name < serviceData[j].Name
})
for _, service := range serviceData {
balances := []string{}
for _, account := range service.Accounts {
balances = append(balances, account.Balance.String())
}

table.Rows = append(table.Rows, []string{service.Name, strings.Join(balances, ","), service.Status})
}
}

0 comments on commit b338898

Please sign in to comment.