diff --git a/agent/ui_endpoint.go b/agent/ui_endpoint.go index 6e5c042506..376cf8df49 100644 --- a/agent/ui_endpoint.go +++ b/agent/ui_endpoint.go @@ -12,6 +12,7 @@ import ( // ServiceSummary is used to summarize a service type ServiceSummary struct { + Kind structs.ServiceKind `json:",omitempty"` Name string Tags []string Nodes []string @@ -150,6 +151,7 @@ func summarizeServices(dump structs.NodeDump) []*ServiceSummary { sum := getService(service.Service) sum.Tags = service.Tags sum.Nodes = append(sum.Nodes, node.Node) + sum.Kind = service.Kind nodeServices[idx] = sum } for _, check := range node.Checks { diff --git a/agent/ui_endpoint_test.go b/agent/ui_endpoint_test.go index b01613118e..dc7f1783fd 100644 --- a/agent/ui_endpoint_test.go +++ b/agent/ui_endpoint_test.go @@ -155,10 +155,12 @@ func TestSummarizeServices(t *testing.T) { Address: "127.0.0.1", Services: []*structs.NodeService{ &structs.NodeService{ + Kind: structs.ServiceKindTypical, Service: "api", Tags: []string{"tag1", "tag2"}, }, &structs.NodeService{ + Kind: structs.ServiceKindConnectProxy, Service: "web", Tags: []string{}, }, @@ -183,6 +185,7 @@ func TestSummarizeServices(t *testing.T) { Address: "127.0.0.2", Services: []*structs.NodeService{ &structs.NodeService{ + Kind: structs.ServiceKindConnectProxy, Service: "web", Tags: []string{}, }, @@ -212,6 +215,7 @@ func TestSummarizeServices(t *testing.T) { } expectAPI := &ServiceSummary{ + Kind: structs.ServiceKindTypical, Name: "api", Tags: []string{"tag1", "tag2"}, Nodes: []string{"foo"}, @@ -224,6 +228,7 @@ func TestSummarizeServices(t *testing.T) { } expectCache := &ServiceSummary{ + Kind: structs.ServiceKindTypical, Name: "cache", Tags: []string{}, Nodes: []string{"zip"}, @@ -236,6 +241,7 @@ func TestSummarizeServices(t *testing.T) { } expectWeb := &ServiceSummary{ + Kind: structs.ServiceKindConnectProxy, Name: "web", Tags: []string{}, Nodes: []string{"bar", "foo"},