[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"`
 | 
						GatewayIPv4    string        `json:"gateway,omitempty"`
 | 
				
			||||||
	GatewayIPv6    string        `json:"gateway6,omitempty"`
 | 
						GatewayIPv6    string        `json:"gateway6,omitempty"`
 | 
				
			||||||
	NodeID         string        `json:"node_id"`
 | 
						NodeID         string        `json:"node_id"`
 | 
				
			||||||
	Network        Network       `json:"network"`
 | 
						MAC            string        `json:"mac"`
 | 
				
			||||||
 | 
						Addresses      []string      `json:"addresses"`
 | 
				
			||||||
	SiteCode       string        `json:"site_code,omitempty"`
 | 
						SiteCode       string        `json:"site_code,omitempty"`
 | 
				
			||||||
	Hostname       string        `json:"hostname"`
 | 
						Hostname       string        `json:"hostname"`
 | 
				
			||||||
	Owner          string        `json:"owner,omitempty"`
 | 
						Owner          string        `json:"owner,omitempty"`
 | 
				
			||||||
@ -54,11 +55,6 @@ type Autoupdater struct {
 | 
				
			|||||||
	Branch  string `json:"branch,omitempty"`
 | 
						Branch  string `json:"branch,omitempty"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Network struct
 | 
					 | 
				
			||||||
type Network struct {
 | 
					 | 
				
			||||||
	MAC       string   `json:"mac"`
 | 
					 | 
				
			||||||
	Addresses []string `json:"addresses"`
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Location struct
 | 
					// Location struct
 | 
				
			||||||
type Location struct {
 | 
					type Location struct {
 | 
				
			||||||
@ -88,10 +84,8 @@ func NewNode(nodes *runtime.Nodes, n *runtime.Node) *Node {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if nodeinfo := n.Nodeinfo; nodeinfo != nil {
 | 
						if nodeinfo := n.Nodeinfo; nodeinfo != nil {
 | 
				
			||||||
		node.NodeID = nodeinfo.NodeID
 | 
							node.NodeID = nodeinfo.NodeID
 | 
				
			||||||
		node.Network = Network{
 | 
							node.MAC = nodeinfo.Network.Mac
 | 
				
			||||||
			MAC:       nodeinfo.Network.Mac,
 | 
							node.Addresses = nodeinfo.Network.Addresses
 | 
				
			||||||
			Addresses: nodeinfo.Network.Addresses,
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		node.SiteCode = nodeinfo.System.SiteCode
 | 
							node.SiteCode = nodeinfo.System.SiteCode
 | 
				
			||||||
		node.Hostname = nodeinfo.Hostname
 | 
							node.Hostname = nodeinfo.Hostname
 | 
				
			||||||
		if owner := nodeinfo.Owner; owner != nil {
 | 
							if owner := nodeinfo.Owner; owner != nil {
 | 
				
			||||||
 | 
				
			|||||||
@ -47,7 +47,7 @@ func TestRegister(t *testing.T) {
 | 
				
			|||||||
	})
 | 
						})
 | 
				
			||||||
	assert.NotNil(node)
 | 
						assert.NotNil(node)
 | 
				
			||||||
	assert.Equal("whoami", node.Owner)
 | 
						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(13.3, node.Location.Longtitude)
 | 
				
			||||||
	assert.Equal(8.7, node.Location.Latitude)
 | 
						assert.Equal(8.7, node.Location.Latitude)
 | 
				
			||||||
	assert.Equal(0.74, *node.MemoryUsage)
 | 
						assert.Equal(0.74, *node.MemoryUsage)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user