Limiting env vars, docker&k8s labels, and weave net connection entries
to 20 is problematic because
- the truncation is arbitrary - there is a good chance that if you
care about a specific entry it won't be there
- the truncation is not consistent - different entries get truncated
at different times
- some of the rendering logic depends on specific labels, for example
namespace filtering of containers depends on the
`io.kubernetes.pod.namespace` label.
In practice, there should never be a huge number of labels, or Weave
Net connection entries. So there is no need to truncate them.
That leaves env vars. These are of limited use, so we now omit them by
default. If they are included they are included in full, so they are
actually useful.
Fixes#3127
We consistently
- pre-allocate in Copy()
- merge the smaller into a copy of the larger in Merge()
This doesn't make much of a difference overall, since there are
comparatively few instances of these structures. But it costs little
in the code, and the consistency alone is worth it.
Pre-allocating slices really pays dividends when we create loads of
them and they don't grow very large.
We take special care to return nil rather than 0-length slices. This
a) saves further on allocation, and b) is required for some crude
tests to pass that match on nil rather than length.
Also, a bunch of code in templates/tables used slices as Maybe's,
i.e. returning nil or a single-element slice, which is horrendously
inefficient. Eliminating these saves a lot of allocations.
This isn't going to noticeably improve performance, but enables future
optimisations, e.g. more compact representations of LatestMaps where
many/all entries share the same timestamp.
This commit makes the LatestMap type a sort of a base class, that
should not be used directly. This also adds a generator for LatestMap
"concrete" types with a specific data type in the LatestEntry.
* Show k8s labels and container env vars in the details panel.
* Add show more bar to the env vars and labels
* React key was in the wrong place; empty tables render section labels.