summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2024-01-20 17:40:26 +0100
committernicolargo <nicolas@nicolargo.com>2024-01-20 17:40:26 +0100
commit0a555866e371f084103cda1afdb9f3a9ccbd7652 (patch)
treee6f31f736342901bcf57edb06ef978e052f88f4a
parent92db000a753bf2b5fa66428ab173e8aa00624a72 (diff)
TODO - WebUI
-rw-r--r--glances/outputs/glances_sparklines.py15
-rw-r--r--glances/plugins/quicklook/__init__.py5
2 files changed, 15 insertions, 5 deletions
diff --git a/glances/outputs/glances_sparklines.py b/glances/outputs/glances_sparklines.py
index 742f9944..29c0fbf0 100644
--- a/glances/outputs/glances_sparklines.py
+++ b/glances/outputs/glances_sparklines.py
@@ -34,7 +34,9 @@ class Sparkline(object):
"""Manage sparklines (see https://pypi.org/project/sparklines/)."""
- def __init__(self, size, pre_char='[', post_char=']', empty_char=' ', with_text=True):
+ def __init__(self, size,
+ pre_char='[', post_char=']', empty_char=' ',
+ display_value=True):
# If the sparklines python module available ?
self.__available = sparklines_module
# Sparkline size
@@ -45,7 +47,7 @@ class Sparkline(object):
self.__pre_char = pre_char
self.__post_char = post_char
self.__empty_char = empty_char
- self.__with_text = with_text
+ self.__display_value = display_value
@property
def available(self):
@@ -56,7 +58,7 @@ class Sparkline(object):
# Return the sparkline size, with or without decoration
if with_decoration:
return self.__size
- if self.__with_text:
+ if self.__display_value:
return self.__size - 6
@property
@@ -78,11 +80,14 @@ class Sparkline(object):
def get(self, overwrite=''):
"""Return the sparkline."""
ret = sparklines(self.percents, minimum=0, maximum=100)[0]
- if self.__with_text:
+ if self.__display_value:
percents_without_none = [x for x in self.percents if x is not None]
if len(percents_without_none) > 0:
ret = '{}{:5.1f}%'.format(ret, percents_without_none[-1])
- return nativestr(ret)
+ ret = nativestr(ret)
+ if overwrite and len(overwrite) < len(ret) - 6:
+ ret = overwrite + ret[len(overwrite):]
+ return ret
def __str__(self):
"""Return the sparkline."""
diff --git a/glances/plugins/quicklook/__init__.py b/glances/plugins/quicklook/__init__.py
index e9570678..1cfd5682 100644
--- a/glances/plugins/quicklook/__init__.py
+++ b/glances/plugins/quicklook/__init__.py
@@ -37,6 +37,10 @@ fields_description = {
'description': 'SWAP percent usage',
'unit': 'percent',
},
+ 'load': {
+ 'description': 'LOAD percent usage',
+ 'unit': 'percent',
+ },
'cpu_name': {
'description': 'CPU name',
},
@@ -57,6 +61,7 @@ items_history_list = [
{'name': 'percpu', 'description': 'PERCPU percent usage', 'y_unit': '%'},
{'name': 'mem', 'description': 'MEM percent usage', 'y_unit': '%'},
{'name': 'swap', 'description': 'SWAP percent usage', 'y_unit': '%'},
+ {'name': 'load', 'description': 'LOAD percent usage', 'y_unit': '%'},
]