Merge pull request #1124 from YunoHost/domain-remove-apps-ux

[mod] also display app label on remove_domain with apps
This commit is contained in:
Alexandre Aubin 2021-01-01 20:44:22 +01:00 committed by GitHub
commit aacb269b0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -277,7 +277,7 @@
"domain_dyndns_root_unknown": "Unknown DynDNS root domain",
"domain_exists": "The domain already exists",
"domain_hostname_failed": "Unable to set new hostname. This might cause an issue later (it might be fine).",
"domain_uninstall_app_first": "Those applications are still installed on your domain: {apps}. Please uninstall them before proceeding to domain removal",
"domain_uninstall_app_first": "Those applications are still installed on your domain:\n{apps}\n\nPlease uninstall them using 'yunohost app remove the_app_id' or move them to another domain using 'yunohost app change-url the_app_id' before proceeding to domain removal",
"domain_name_unknown": "Domain '{domain}' unknown",
"domain_unknown": "Unknown domain",
"domains_available": "Available domains:",

View file

@ -182,7 +182,7 @@ def domain_remove(operation_logger, domain, force=False):
"""
from yunohost.hook import hook_callback
from yunohost.app import app_ssowatconf
from yunohost.app import app_ssowatconf, app_info
from yunohost.utils.ldap import _get_ldap_interface
if not force and domain not in domain_list()['domains']:
@ -204,11 +204,12 @@ def domain_remove(operation_logger, domain, force=False):
for app in _installed_apps():
settings = _get_app_settings(app)
label = app_info(app)["name"]
if settings.get("domain") == domain:
apps_on_that_domain.append("%s (on https://%s%s)" % (app, domain, settings["path"]) if "path" in settings else app)
apps_on_that_domain.append(" - %s \"%s\" on https://%s%s" % (app, label, domain, settings["path"]) if "path" in settings else app)
if apps_on_that_domain:
raise YunohostError('domain_uninstall_app_first', apps=", ".join(apps_on_that_domain))
raise YunohostError('domain_uninstall_app_first', apps="\n".join(apps_on_that_domain))
operation_logger.start()
ldap = _get_ldap_interface()