This patch sorts the host partitions list returned by backend by
partition path. Then UI is going to show paths sorted, improving
the user experience.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/control/host.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
index cfc24bd..ee9fe7b 100644
--- a/src/kimchi/control/host.py
+++ b/src/kimchi/control/host.py
@@ -64,6 +64,12 @@ class Partitions(Collection):
super(Partitions, self).__init__(model)
self.resource = Partition
+ # Defining get_resources in order to return list of partitions in UI
+ # sorted by their path
+ def _get_resources(self, flag_filter):
+ res_list = super(Partitions, self)._get_resources(flag_filter)
+ res_list.sort(key=lambda x: x.info['path'])
+ return res_list
class Partition(Resource):
def __init__(self, model, id):
--
1.8.5.3
Show replies by date