summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolashennion@gmail.com>2024-04-28 09:37:26 +0200
committernicolargo <nicolashennion@gmail.com>2024-04-28 09:37:26 +0200
commita60e8a42c74710f44353504a30eb260a29605e25 (patch)
treed5e60fab679f339ed5304abb21ac83827e8c5d02
parentc0284fbc69318b786417c3ee0b708ccaf8ff65cd (diff)
Refactor how left bar is displayed
-rw-r--r--conf/glances.conf2
-rwxr-xr-xdocker-compose/glances.conf2
-rw-r--r--glances/outputs/glances_curses.py9
-rw-r--r--glances/plugins/alert/__init__.py5
4 files changed, 11 insertions, 7 deletions
diff --git a/conf/glances.conf b/conf/glances.conf
index 412b702c..9096f513 100644
--- a/conf/glances.conf
+++ b/conf/glances.conf
@@ -27,7 +27,7 @@ history_size=1200
separator=True
# Set the the Curses and WebUI interface left menu plugin list (comma-separated)
#left_menu=network,wifi,connections,ports,diskio,fs,irq,folders,raid,smart,sensors,now
-# Limit the number of processes to display (for the WebUI)
+# Limit the number of processes to display
max_processes_display=25
# Set URL prefix for the WebUI and the API
# Example: url_prefix=/glances/ => http://localhost/glances/
diff --git a/docker-compose/glances.conf b/docker-compose/glances.conf
index 5e2b2716..d4e0a075 100755
--- a/docker-compose/glances.conf
+++ b/docker-compose/glances.conf
@@ -27,7 +27,7 @@ history_size=1200
separator=True
# Set the the Curses and WebUI interface left menu plugin list (comma-separated)
#left_menu=network,wifi,connections,ports,diskio,fs,irq,folders,raid,smart,sensors,now
-# Limit the number of processes to display (for the WebUI)
+# Limit the number of processes to display
max_processes_display=25
# Set URL prefix for the WebUI and the API
# Example: url_prefix=/glances/ => http://localhost/glances/
diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py
index a5b0e295..cd47a8c9 100644
--- a/glances/outputs/glances_curses.py
+++ b/glances/outputs/glances_curses.py
@@ -606,10 +606,9 @@ class _GlancesCurses(object):
# Compute the plugin max size
plugin_max_width = None
if p in self._left_sidebar:
- plugin_max_width = max(self._left_sidebar_min_width,
- self.term_window.getmaxyx()[1] - 105)
plugin_max_width = min(self._left_sidebar_max_width,
- plugin_max_width)
+ max(self._left_sidebar_min_width,
+ self.term_window.getmaxyx()[1] - 105))
# Get the view
ret[p] = stats.get_plugin(p).get_stats_display(args=self.args,
@@ -622,7 +621,7 @@ class _GlancesCurses(object):
The value is dynamicaly computed."""
max_processes_displayed = (
self.term_window.getmaxyx()[0]
- - 11
+ - 11 # Glances header + Top + Process header
- (0 if 'containers' not in stat_display else self.get_stats_display_height(stat_display["containers"]))
- (
0
@@ -641,7 +640,7 @@ class _GlancesCurses(object):
if max_processes_displayed < 0:
max_processes_displayed = 0
if glances_processes.max_processes is None or glances_processes.max_processes != max_processes_displayed:
- logger.debug("Set number of displayed processes to {}".format(max_processes_displayed))
+ logger.info("Set number of displayed processes to {}".format(max_processes_displayed))
glances_processes.max_processes = max_processes_displayed
def display(self, stats, cs_status=None):
diff --git a/glances/plugins/alert/__init__.py b/glances/plugins/alert/__init__.py
index 79ced119..e88c4a72 100644
--- a/glances/plugins/alert/__init__.py
+++ b/glances/plugins/alert/__init__.py
@@ -13,6 +13,7 @@ from datetime import datetime
from time import tzname
import pytz
+from glances.logger import logger
from glances.events_list import glances_events
# from glances.logger import logger
@@ -120,6 +121,10 @@ class PluginModel(GlancesPluginModel):
glances_events.set_max_events(config.get_int_value('alert', 'max_events', default=10))
glances_events.set_min_duration(config.get_int_value('alert', 'min_duration', default=6))
glances_events.set_min_interval(config.get_int_value('alert', 'min_interval', default=6))
+ else:
+ glances_events.set_max_events(10)
+ glances_events.set_min_duration(6)
+ glances_events.set_min_interval(6)
def update(self):
"""Nothing to do here. Just return the global glances_log."""