From 2b5bc80b8d83e0cab0690a4d09ba660603f59f53 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Fri, 24 Nov 2017 15:05:44 +0000 Subject: [PATCH] always apply ColorConnected in process renderers This eliminates the awkward distinction between ProcessRenderer and ColorConnectedProcessRenderer. It also ensures that processes resulting from direct rendering of the process topology (/api/topology/processes is invoking ProcessWithContainerNameRenderer and /api/topology/processes-by-name is invoking ProcessNameRenderer) are colored and hence summarising them correctly sets the 'linkable' property. This was the behaviour prior to the revamping of the rendering pipeline. However, it doesn't actually make a practical difference since process detail panels only show other processes as connection endpoints, and these are always marked linkable anyway. --- render/container.go | 2 +- render/host.go | 2 +- render/process.go | 11 ++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/render/container.go b/render/container.go index 0dda442866..1c3eb044e3 100644 --- a/render/container.go +++ b/render/container.go @@ -33,7 +33,7 @@ var ContainerRenderer = Memoise(MakeFilter( MakeReduce( MakeMap( MapProcess2Container, - ColorConnectedProcessRenderer, + ProcessRenderer, ), ConnectionJoin(MapContainer2IP, SelectContainer), ), diff --git a/render/host.go b/render/host.go index 4f00356f32..3d7ceccbcc 100644 --- a/render/host.go +++ b/render/host.go @@ -10,7 +10,7 @@ import ( // not memoised var HostRenderer = MakeReduce( endpoints2Hosts{}, - CustomRenderer{RenderFunc: nodes2Hosts, Renderer: ColorConnectedProcessRenderer}, + CustomRenderer{RenderFunc: nodes2Hosts, Renderer: ProcessRenderer}, CustomRenderer{RenderFunc: nodes2Hosts, Renderer: ContainerRenderer}, CustomRenderer{RenderFunc: nodes2Hosts, Renderer: ContainerImageRenderer}, CustomRenderer{RenderFunc: nodes2Hosts, Renderer: PodRenderer}, diff --git a/render/process.go b/render/process.go index b69586e211..9dfde7d130 100644 --- a/render/process.go +++ b/render/process.go @@ -25,14 +25,11 @@ func renderProcesses(rpt report.Report) bool { var EndpointRenderer = SelectEndpoint // ProcessRenderer is a Renderer which produces a renderable process -// graph by merging the endpoint graph and the process topology. -var ProcessRenderer = Memoise(endpoints2Processes{}) - -// ColorConnectedProcessRenderer colors connected nodes from -// ProcessRenderer. Since the process topology views only show -// connected processes, we need this info to determine whether +// graph by merging the endpoint graph and the process topology. It +// also colors connected nodes. Since the process topology views only +// show connected processes, we need this info to determine whether // processes appearing in a details panel are linkable. -var ColorConnectedProcessRenderer = Memoise(ColorConnected(ProcessRenderer)) +var ProcessRenderer = Memoise(ColorConnected(endpoints2Processes{})) // processWithContainerNameRenderer is a Renderer which produces a process // graph enriched with container names where appropriate