Module: check_mk
Branch: master
Commit: 23714d061f5920270453cdb82f5aaccca24ac336
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=23714d061f5920…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 28 07:30:00 2018 +0200
Improved rendering of docker container and image labels in inventory data
Change-Id: I4b23b122a247f0635b3fd593c68d6b957a7be533
---
web/plugins/views/inventory.py | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index e2e526f..6f223db 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -413,6 +413,13 @@ def inv_paint_timestamp_as_age_days(timestamp):
return css_class, "%d %s ago" % (int(age_days), _("days"))
+@decorate_inv_paint
+def inv_paint_docker_labels(labels):
+ if labels is None:
+ return "", ""
+
+ return "labels", html.render_br().join(sorted(labels.split(",
")))
+
#.
# .--display hints-------------------------------------------------------.
# | _ _ _ _ _ _ |
@@ -775,8 +782,15 @@ inventory_displayhints.update({
"keyorder": ["repository", "tag", "id",
"creation", "size", "labels",
"amount_containers"],
"view" : "invdockerimages_of_host",
},
- ".software.applications.docker.images:*.id" : { "title" :
_("ID"), },
- ".software.applications.docker.images:*.amount_containers" : {
"title" : _("# Containers"), },
+ ".software.applications.docker.images:*.id": {
+ "title" : _("ID"),
+ },
+ ".software.applications.docker.images:*.labels": {
+ "paint" : "docker_labels",
+ },
+ ".software.applications.docker.images:*.amount_containers" : {
+ "title" : _("# Containers"),
+ },
# Node containers
".software.applications.docker.containers:": {
@@ -784,7 +798,12 @@ inventory_displayhints.update({
"keyorder": ["id", "repository", "tag",
"creation", "name", "creation", "labels",
"status"],
"view" : "invdockercontainers_of_host",
},
- ".software.applications.docker.containers:*.id" : {
"title" : _("ID"), },
+ ".software.applications.docker.containers:*.id": {
+ "title" : _("ID"),
+ },
+ ".software.applications.docker.containers:*.labels": {
+ "paint" : "docker_labels",
+ },
".software.applications.docker.networks.*.": {
"title": "Network %s",