From fa5170d0e0989b060ccb69b7427c07bc0ccbe9b1 Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 11 Apr 2019 11:59:48 +0100 Subject: [PATCH] show sensors alias in web interface sensor aliases currently work in the curses interface, but not in the web one fixes #1456 --- glances/plugins/glances_sensors.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/glances/plugins/glances_sensors.py b/glances/plugins/glances_sensors.py index 3b9456ac..36c18ad7 100644 --- a/glances/plugins/glances_sensors.py +++ b/glances/plugins/glances_sensors.py @@ -122,6 +122,12 @@ class Plugin(GlancesPlugin): pass + # Set the alias for each stat + for stat in stats: + alias = self.has_alias(stat["label"].lower()) + if alias: + stat["label"] = alias + # Update the stats self.stats = stats @@ -182,11 +188,7 @@ class Plugin(GlancesPlugin): continue # New line ret.append(self.curse_new_line()) - # Alias for the lable name ? - label = self.has_alias(i['label'].lower()) - if label is None: - label = i['label'] - msg = '{:{width}}'.format(label[:name_max_width], + msg = '{:{width}}'.format(i["label"][:name_max_width], width=name_max_width) ret.append(self.curse_add_line(msg)) if i['value'] in (b'ERR', b'SLP', b'UNK', b'NOS'):