[TASK] Reduce network depth in meshviewer output
This commit is contained in:
parent
573a5ee184
commit
918b279b23
|
@ -30,7 +30,8 @@ type Node struct {
|
|||
GatewayIPv4 string `json:"gateway,omitempty"`
|
||||
GatewayIPv6 string `json:"gateway6,omitempty"`
|
||||
NodeID string `json:"node_id"`
|
||||
Network Network `json:"network"`
|
||||
MAC string `json:"mac"`
|
||||
Addresses []string `json:"addresses"`
|
||||
SiteCode string `json:"site_code,omitempty"`
|
||||
Hostname string `json:"hostname"`
|
||||
Owner string `json:"owner,omitempty"`
|
||||
|
@ -54,11 +55,6 @@ type Autoupdater struct {
|
|||
Branch string `json:"branch,omitempty"`
|
||||
}
|
||||
|
||||
// Network struct
|
||||
type Network struct {
|
||||
MAC string `json:"mac"`
|
||||
Addresses []string `json:"addresses"`
|
||||
}
|
||||
|
||||
// Location struct
|
||||
type Location struct {
|
||||
|
@ -88,10 +84,8 @@ func NewNode(nodes *runtime.Nodes, n *runtime.Node) *Node {
|
|||
|
||||
if nodeinfo := n.Nodeinfo; nodeinfo != nil {
|
||||
node.NodeID = nodeinfo.NodeID
|
||||
node.Network = Network{
|
||||
MAC: nodeinfo.Network.Mac,
|
||||
Addresses: nodeinfo.Network.Addresses,
|
||||
}
|
||||
node.MAC = nodeinfo.Network.Mac
|
||||
node.Addresses = nodeinfo.Network.Addresses
|
||||
node.SiteCode = nodeinfo.System.SiteCode
|
||||
node.Hostname = nodeinfo.Hostname
|
||||
if owner := nodeinfo.Owner; owner != nil {
|
||||
|
|
|
@ -47,7 +47,7 @@ func TestRegister(t *testing.T) {
|
|||
})
|
||||
assert.NotNil(node)
|
||||
assert.Equal("whoami", node.Owner)
|
||||
assert.Equal("blub", node.Network.MAC)
|
||||
assert.Equal("blub", node.MAC)
|
||||
assert.Equal(13.3, node.Location.Longtitude)
|
||||
assert.Equal(8.7, node.Location.Latitude)
|
||||
assert.Equal(0.74, *node.MemoryUsage)
|
||||
|
|
Loading…
Reference in New Issue