diff options
author | Nicolas Hennion <nicolashennion@gmail.com> | 2019-04-11 13:32:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 13:32:21 +0200 |
commit | b9dacd1e98dd9e074df7b697ecd34616926dadab (patch) | |
tree | cef1788969e9f844baa63ee20ce3690ce10ab400 | |
parent | 9b7e7f1ba7ad0477d38ae6462e95e0d7f8b63008 (diff) | |
parent | fa5170d0e0989b060ccb69b7427c07bc0ccbe9b1 (diff) |
Merge pull request #1466 from sentriz/webintfsensorsalias
show sensors alias in web interface
-rw-r--r-- | glances/plugins/glances_sensors.py | 12 |
1 files 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'): |