mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
app questions in config panel: handle choices with nice display names for webadmin
This commit is contained in:
parent
8836fdeeaa
commit
fde01fafd7
1 changed files with 9 additions and 2 deletions
|
@ -1127,6 +1127,7 @@ class DomainQuestion(Question):
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
class AppQuestion(Question):
|
class AppQuestion(Question):
|
||||||
argument_type = "app"
|
argument_type = "app"
|
||||||
|
|
||||||
|
@ -1139,9 +1140,15 @@ class AppQuestion(Question):
|
||||||
|
|
||||||
apps = app_list(full=True)["apps"]
|
apps = app_list(full=True)["apps"]
|
||||||
for _filter in self.filters:
|
for _filter in self.filters:
|
||||||
apps = [ app for app in apps if _filter in app and app[_filter] ]
|
apps = [app for app in apps if _filter in app and app[_filter]]
|
||||||
|
|
||||||
|
def _app_display(app):
|
||||||
|
domain_path = f" ({app['domain_path']})" if 'domain_path' in app else ""
|
||||||
|
return app["label"] + domain_path
|
||||||
|
|
||||||
|
self.choices = {"_none": "---"}
|
||||||
|
self.choices.update({app['id']: _app_display(app) for app in apps})
|
||||||
|
|
||||||
self.choices = ["_none"] + [app['id'] for app in apps]
|
|
||||||
|
|
||||||
class UserQuestion(Question):
|
class UserQuestion(Question):
|
||||||
argument_type = "user"
|
argument_type = "user"
|
||||||
|
|
Loading…
Add table
Reference in a new issue