display tags instead of user

This commit is contained in:
Johan Siebens
2022-05-10 14:00:25 +02:00
parent c55a956507
commit ee262b1a35
4 changed files with 19 additions and 7 deletions
+3 -2
View File
@@ -7,6 +7,7 @@ import (
"github.com/muesli/coral"
"github.com/nleeper/goment"
"github.com/rodaine/table"
"strings"
)
func machineCommands() *coral.Command {
@@ -88,7 +89,7 @@ func listMachinesCommand() *coral.Command {
return err
}
tbl := table.New("ID", "TAILNET", "NAME", "IPv4", "IPv6", "EPHEMERAL", "LAST_SEEN", "USER")
tbl := table.New("ID", "TAILNET", "NAME", "IPv4", "IPv6", "EPHEMERAL", "LAST_SEEN", "TAGS")
for _, m := range resp.Machines {
var lastSeen = "N/A"
if m.Connected {
@@ -99,7 +100,7 @@ func listMachinesCommand() *coral.Command {
lastSeen = mom.FromNow()
}
}
tbl.AddRow(m.Id, m.Tailnet.Name, m.Name, m.Ipv4, m.Ipv6, m.Ephemeral, lastSeen, m.User.Name)
tbl.AddRow(m.Id, m.Tailnet.Name, m.Name, m.Ipv4, m.Ipv6, m.Ephemeral, lastSeen, strings.Join(m.Tags, ","))
}
tbl.Print()
+1
View File
@@ -40,6 +40,7 @@ func (s *Service) ListMachines(ctx context.Context, req *api.ListMachinesRequest
Ipv4: m.IPv4,
Ipv6: m.IPv6,
Ephemeral: m.Ephemeral,
Tags: m.Tags,
LastSeen: lastSeen,
Connected: online,
Tailnet: &api.Ref{