From edcf42eff72f9e5cadcf64c3410711ee35d0cbab Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Date: Thu, 17 Jan 2019 09:47:41 +0100 Subject: [PATCH] Fix display for networks without common name --- manager/views.py | 2 +- static/js/devices.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manager/views.py b/manager/views.py index 43ba08d..33d0574 100644 --- a/manager/views.py +++ b/manager/views.py @@ -234,7 +234,7 @@ def ping(request, device_id): ajax += ',\n "network": {' ajax += '\n "intip": "%s"' % device[0].network.intip ajax += ',\n "extip": "%s"' % device[0].network.extip - ajax += ',\n "name": "%s"' % device[0].network.name + ajax += ',\n "name": "%s"' % (device[0].network.name if device[0].network.name else "") ajax += '\n }' except Exception as e: diff --git a/static/js/devices.js b/static/js/devices.js index b1abfe0..8cf1549 100644 --- a/static/js/devices.js +++ b/static/js/devices.js @@ -30,7 +30,7 @@ function styleStatus(msg, device) { }; if (msg.hasOwnProperty("network")) { - device_network.text(msg.network.intip + " (" + msg.network.name + ")"); + device_network.text(msg.network.intip + (msg.network.name ? (" (" + msg.network.name + ")") : "")); }; if (msg.hasOwnProperty("reboot")) {