Merge pull request #94 from weaveworks/stabilize-detail-pane-order

Stabilize order of rows in origin node
This commit is contained in:
Peter Bourgon
2015-05-22 16:10:44 +02:00

View File

@@ -33,13 +33,13 @@ func originNodeForProcess(node report.NodeMetadata) OriginNode {
{Key: "PID", ValueMajor: node["pid"], ValueMinor: ""},
{Key: "Process name", ValueMajor: node["name"], ValueMinor: ""},
}
for key, human := range map[string]string{
"docker_id": "Container ID",
"docker_name": "Container name",
"cgroup": "cgroup",
for _, tuple := range []struct{ key, human string }{
{"docker_id", "Container ID"},
{"docker_name", "Container name"},
{"cgroup", "cgroup"},
} {
if val, ok := node[key]; ok {
rows = append(rows, report.Row{Key: human, ValueMajor: val, ValueMinor: ""})
if val, ok := node[tuple.key]; ok {
rows = append(rows, report.Row{Key: tuple.human, ValueMajor: val, ValueMinor: ""})
}
}
return OriginNode{