mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-22 16:51:35 +03:00
Merge pull request #1229 from Thomaash/develop
Implement number and alias aware diskio sorting
This commit is contained in:
commit
f1bd304f79
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
"""Disk I/O plugin."""
|
"""Disk I/O plugin."""
|
||||||
|
|
||||||
import operator
|
import re
|
||||||
|
|
||||||
from glances.timer import getTimeSinceLastUpdate
|
from glances.timer import getTimeSinceLastUpdate
|
||||||
from glances.plugins.glances_plugin import GlancesPlugin
|
from glances.plugins.glances_plugin import GlancesPlugin
|
||||||
@ -180,7 +180,10 @@ class Plugin(GlancesPlugin):
|
|||||||
msg = '{:>7}'.format('W/s')
|
msg = '{:>7}'.format('W/s')
|
||||||
ret.append(self.curse_add_line(msg))
|
ret.append(self.curse_add_line(msg))
|
||||||
# Disk list (sorted by name)
|
# Disk list (sorted by name)
|
||||||
for i in sorted(self.stats, key=operator.itemgetter(self.get_key())):
|
for i in sorted(self.stats, key=lambda stat: tuple(map(
|
||||||
|
lambda part: int(part) if part.isdigit() else part.lower(),
|
||||||
|
re.split(r"(\d+|\D+)", stat.get('alias') or stat['disk_name'])
|
||||||
|
))):
|
||||||
# Is there an alias for the disk name ?
|
# Is there an alias for the disk name ?
|
||||||
disk_real_name = i['disk_name']
|
disk_real_name = i['disk_name']
|
||||||
disk_name = self.has_alias(i['disk_name'])
|
disk_name = self.has_alias(i['disk_name'])
|
||||||
|
Loading…
Reference in New Issue
Block a user