console_conf/ui/views: sort recovery systems, indicate which is the current one

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
This commit is contained in:
Maciej Borzecki 2020-04-01 16:00:34 +02:00
parent d7e03cd5a8
commit 6ae155faf7
1 changed files with 7 additions and 1 deletions

View File

@ -57,13 +57,18 @@ class ChooserView(BaseView):
heading_table = TablePile([ heading_table = TablePile([
TableRow([ TableRow([
Color.info_minor(Text(header)) for header in [ Color.info_minor(Text(header)) for header in [
"LABEL", "MODEL", "PUBLISHER", "LABEL", "MODEL", "PUBLISHER", ""
] ]
]) ])
], ],
spacing=2) spacing=2)
trows = [] trows = []
systems = sorted(systems,
key=lambda s: (s.brand.display_name,
s.model.display_name,
s.current,
s.label))
for s in systems: for s in systems:
actions = [] actions = []
log.debug('actions: %s', s.actions) log.debug('actions: %s', s.actions)
@ -77,6 +82,7 @@ class ChooserView(BaseView):
Text(s.label), Text(s.label),
Text(s.model.display_name), Text(s.model.display_name),
Text(s.brand.display_name), Text(s.brand.display_name),
Text("(current)" if s.current else ""),
menu, menu,
], menu) ], menu)
trows.append(srow) trows.append(srow)