Skip to content

Commit

Permalink
multisite settings only on services done
Browse files Browse the repository at this point in the history
  • Loading branch information
syrk4web committed Aug 8, 2024
1 parent 65dc538 commit cf9e046
Show file tree
Hide file tree
Showing 12 changed files with 21,098 additions and 33 deletions.
10 changes: 9 additions & 1 deletion src/ui/builder/easy_mode.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
from .utils.form import get_forms, get_service_settings


def easy_mode_builder(templates: list[dict], plugins: list, global_config: dict, total_config: dict, service_name: str, is_new: bool = False) -> str:
def easy_mode_builder(
templates: list[dict],
plugins: list,
global_config: dict,
total_config: dict,
service_name: str,
is_new: bool = False,
) -> str:
"""Render forms with global config data.
ATM we don't need templates but we need to pass at least one to the function (it will simply not override anything).
"""

# We need
settings = get_service_settings(service_name, global_config, total_config)

builder = [
{
"type": "card",
Expand Down
16 changes: 14 additions & 2 deletions src/ui/builder/utils/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_plugins_multisite(plugins: list) -> list:
plugin_multisite["settings"] = multisite_settings
plugins_multisite.append(plugin_multisite)

return plugins
return plugins_multisite


def get_forms(
Expand All @@ -61,7 +61,19 @@ def get_forms(
"""
# Copy of the plugins, and get the plugins by context if needed
# In services page, we want only multisite settings, but in global config we want both
plugins_base = get_plugins_multisite(plugins) if only_multisite else copy.deepcopy(plugins)
plugins_base = get_plugins_multisite(plugins) if only_multisite else plugins

# This template will be used to show default value or value if exists
TEMPLATE_DEFAULT = [
{
"name": "default",
"steps": [],
"configs": {},
"settings": {},
}
]

templates = TEMPLATE_DEFAULT + templates

# Update SERVER_NAME to be empty if new
if is_new and "SERVER_NAME" in settings:
Expand Down
6,912 changes: 6,912 additions & 0 deletions src/ui/client/tests/advanced.json

Large diffs are not rendered by default.

Loading

0 comments on commit cf9e046

Please sign in to comment.