mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #1546 from YunoHost/fix-configpanel-hotspot
[fix] hotspot config panel fails in webadmin
This commit is contained in:
commit
15dd9a6115
1 changed files with 11 additions and 1 deletions
|
@ -651,11 +651,21 @@ class ConfigPanel:
|
||||||
raw_msg=True,
|
raw_msg=True,
|
||||||
)
|
)
|
||||||
value = self.values[option["name"]]
|
value = self.values[option["name"]]
|
||||||
|
|
||||||
|
# Allow to use value instead of current_value in app config script.
|
||||||
|
# e.g. apps may write `echo 'value: "foobar"'` in the config file (which is more intuitive that `echo 'current_value: "foobar"'`
|
||||||
|
# For example hotspot used it...
|
||||||
|
# See https://github.com/YunoHost/yunohost/pull/1546
|
||||||
|
if isinstance(value, dict) and "value" in value and "current_value" not in value:
|
||||||
|
value["current_value"] = value["value"]
|
||||||
|
|
||||||
# In general, the value is just a simple value.
|
# In general, the value is just a simple value.
|
||||||
# Sometimes it could be a dict used to overwrite the option itself
|
# Sometimes it could be a dict used to overwrite the option itself
|
||||||
value = value if isinstance(value, dict) else {"current_value": value}
|
value = value if isinstance(value, dict) else {"current_value": value}
|
||||||
option.update(value)
|
option.update(value)
|
||||||
|
|
||||||
|
self.values[option["id"]] = value.get("current_value")
|
||||||
|
|
||||||
return self.values
|
return self.values
|
||||||
|
|
||||||
def _ask(self, action=None):
|
def _ask(self, action=None):
|
||||||
|
@ -682,7 +692,7 @@ class ConfigPanel:
|
||||||
section
|
section
|
||||||
and section.get("visible")
|
and section.get("visible")
|
||||||
and not evaluate_simple_js_expression(
|
and not evaluate_simple_js_expression(
|
||||||
section["visible"], context=self.new_values
|
section["visible"], context=self.future_values
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Reference in a new issue