mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-27 12:05:26 +00:00
feat: print tags in nodes list
This commit is contained in:
parent
4fcc5e253c
commit
4651c44dde
@ -311,6 +311,7 @@ func nodesToPtables(
|
|||||||
"Last seen",
|
"Last seen",
|
||||||
"Online",
|
"Online",
|
||||||
"Expired",
|
"Expired",
|
||||||
|
"Tags",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +357,22 @@ func nodesToPtables(
|
|||||||
expired = pterm.LightRed("yes")
|
expired = pterm.LightRed("yes")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tags string
|
||||||
|
for _, tag := range machine.ForcedTags {
|
||||||
|
tags += "," + tag
|
||||||
|
}
|
||||||
|
for _, tag := range machine.InvalidTags {
|
||||||
|
if !containsString(machine.ForcedTags, tag) {
|
||||||
|
tags += "," + pterm.LightRed(tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, tag := range machine.ValidTags {
|
||||||
|
if !containsString(machine.ForcedTags, tag) {
|
||||||
|
tags += "," + pterm.LightGreen(tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tags = strings.TrimLeft(tags, ",")
|
||||||
|
|
||||||
var namespace string
|
var namespace string
|
||||||
if currentNamespace == "" || (currentNamespace == machine.Namespace.Name) {
|
if currentNamespace == "" || (currentNamespace == machine.Namespace.Name) {
|
||||||
namespace = pterm.LightMagenta(machine.Namespace.Name)
|
namespace = pterm.LightMagenta(machine.Namespace.Name)
|
||||||
@ -375,6 +392,7 @@ func nodesToPtables(
|
|||||||
lastSeenTime,
|
lastSeenTime,
|
||||||
online,
|
online,
|
||||||
expired,
|
expired,
|
||||||
|
tags,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user