Merge pull request #1466 from sentriz/webintfsensorsalias

show sensors alias in web interface
pull/1467/head
Nicolas Hennion 2019-04-11 13:32:21 +02:00 committed by GitHub
commit b9dacd1e98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -122,6 +122,12 @@ class Plugin(GlancesPlugin):
pass 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 # Update the stats
self.stats = stats self.stats = stats
@ -182,11 +188,7 @@ class Plugin(GlancesPlugin):
continue continue
# New line # New line
ret.append(self.curse_new_line()) ret.append(self.curse_new_line())
# Alias for the lable name ? msg = '{:{width}}'.format(i["label"][:name_max_width],
label = self.has_alias(i['label'].lower())
if label is None:
label = i['label']
msg = '{:{width}}'.format(label[:name_max_width],
width=name_max_width) width=name_max_width)
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
if i['value'] in (b'ERR', b'SLP', b'UNK', b'NOS'): if i['value'] in (b'ERR', b'SLP', b'UNK', b'NOS'):