mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
configpanel: misc fix + add section visible evaluation
This commit is contained in:
parent
9a3d65c313
commit
3d4909bbf5
3 changed files with 9 additions and 10 deletions
|
@ -107,7 +107,6 @@ i18n = "domain_config"
|
|||
style = "success"
|
||||
visible = "issuer != 'letsencrypt'"
|
||||
enabled = "acme_eligible || cert_no_checks"
|
||||
args = ["cert_no_checks"]
|
||||
|
||||
[cert.cert.cert_renew]
|
||||
ask = "Renew Let's Encrypt certificate"
|
||||
|
|
|
@ -1539,7 +1539,7 @@ ynh_app_config_run $1
|
|||
if ret != 0:
|
||||
if action == "show":
|
||||
raise YunohostError("app_config_unable_to_read")
|
||||
elif action == "show":
|
||||
elif action == "apply":
|
||||
raise YunohostError("app_config_unable_to_apply")
|
||||
else:
|
||||
raise YunohostError("app_action_failed", action=action)
|
||||
|
|
|
@ -49,6 +49,7 @@ from yunohost.log import OperationLogger
|
|||
logger = getActionLogger("yunohost.config")
|
||||
CONFIG_PANEL_VERSION_SUPPORTED = 1.0
|
||||
|
||||
|
||||
# Those js-like evaluate functions are used to eval safely visible attributes
|
||||
# The goal is to evaluate in the same way than js simple-evaluate
|
||||
# https://github.com/shepherdwind/simple-evaluate
|
||||
|
@ -675,6 +676,11 @@ class ConfigPanel:
|
|||
|
||||
for panel, section, obj in self._iterate(["panel", "section"]):
|
||||
|
||||
if section and section.get("visible") and not evaluate_simple_js_expression(
|
||||
section["visible"], context=self.new_values
|
||||
):
|
||||
continue
|
||||
|
||||
# Ugly hack to skip action section ... except when when explicitly running actions
|
||||
if not for_action:
|
||||
if section and section["is_action_section"]:
|
||||
|
@ -878,7 +884,8 @@ class Question:
|
|||
text_for_user_input_in_cli = self._format_text_for_user_input_in_cli()
|
||||
if self.readonly:
|
||||
Moulinette.display(text_for_user_input_in_cli)
|
||||
return {}
|
||||
self.value = self.values[self.name] = self.current_value
|
||||
return self.values
|
||||
elif self.value is None:
|
||||
self._prompt(text_for_user_input_in_cli)
|
||||
|
||||
|
@ -1459,13 +1466,6 @@ class FileQuestion(Question):
|
|||
class ButtonQuestion(Question):
|
||||
argument_type = "button"
|
||||
|
||||
#def __init__(
|
||||
# self, question, context: Mapping[str, Any] = {}, hooks: Dict[str, Callable] = {}
|
||||
#):
|
||||
# super().__init__(question, context, hooks)
|
||||
|
||||
|
||||
|
||||
|
||||
ARGUMENTS_TYPE_PARSERS = {
|
||||
"string": StringQuestion,
|
||||
|
|
Loading…
Add table
Reference in a new issue