summaryrefslogtreecommitdiffstats
path: root/glances
diff options
context:
space:
mode:
authornicolargo <nicolashennion@gmail.com>2024-05-07 15:26:16 +0200
committernicolargo <nicolashennion@gmail.com>2024-05-07 15:26:16 +0200
commitfd3625826b822f145181420b7b56a927b53d8c58 (patch)
treef89f03e15c710883cfe98fea004a35db22fcfcc5 /glances
parentaf4765db8afc4e9242bb72e5b4bfb04f4cb37391 (diff)
First work done for plugin model (stats only)
Diffstat (limited to 'glances')
-rw-r--r--glances/plugins/plugin/model.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/glances/plugins/plugin/model.py b/glances/plugins/plugin/model.py
index 8857fd11..afc0b0ad 100644
--- a/glances/plugins/plugin/model.py
+++ b/glances/plugins/plugin/model.py
@@ -129,7 +129,7 @@ class GlancesPluginModel(object):
def __repr__(self):
"""Return the raw stats."""
- return self.stats
+ return str(self.stats)
def __str__(self):
"""Return the human-readable stats."""
@@ -301,6 +301,8 @@ class GlancesPluginModel(object):
def sorted_stats(self):
"""Get the stats sorted by an alias (if present) or key."""
key = self.get_key()
+ if key is None:
+ return self.stats
try:
return sorted(
self.stats,
@@ -551,6 +553,10 @@ class GlancesPluginModel(object):
"""Set the views to input_views."""
self.views = input_views
+ def reset_views(self):
+ """Reset the views to input_views."""
+ self.views = dict()
+
def get_views(self, item=None, key=None, option=None):
"""Return the views object.