mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-19 04:16:21 +00:00
render: Maintain a list of 'primary' api topologies for each report topology
This gives us a single source of truth in a variety of situations where we want to know what view to direct a user to in order to 'open' a particular node. I wanted to put this in app/api_topologies where the views are defined, but that creates a circular import.
This commit is contained in:
@@ -81,6 +81,19 @@ var templates = map[string]struct{ Label, LabelMinor string }{
|
||||
render.OutgoingInternetID: {render.OutboundMajor, render.OutboundMinor},
|
||||
}
|
||||
|
||||
// For each report.Topology, map to a 'primary' API topology. This can then be used in a variety of places.
|
||||
var primaryAPITopology = map[string]string{
|
||||
report.Container: "containers",
|
||||
report.ContainerImage: "containers-by-image",
|
||||
report.Pod: "pods",
|
||||
report.ReplicaSet: "replica-sets",
|
||||
report.Deployment: "deployments",
|
||||
report.Service: "services",
|
||||
report.ECSTask: "ecs-tasks",
|
||||
report.ECSService: "ecs-services",
|
||||
report.Host: "hosts",
|
||||
}
|
||||
|
||||
// MakeNodeSummary summarizes a node, if possible.
|
||||
func MakeNodeSummary(r report.Report, n report.Node) (NodeSummary, bool) {
|
||||
if renderer, ok := renderers[n.Topology]; ok {
|
||||
|
||||
Reference in New Issue
Block a user