Fix all integrations
This commit is contained in:
@@ -32,35 +32,93 @@ def settings_hierarchy_nav(request):
|
||||
translation_href = reverse("translation_settings")
|
||||
availability_href = reverse("availability_settings")
|
||||
|
||||
general_routes = {
|
||||
"notifications_settings",
|
||||
"notifications_update",
|
||||
"system_settings",
|
||||
"accessibility_settings",
|
||||
}
|
||||
security_routes = {
|
||||
"security_settings",
|
||||
"encryption_settings",
|
||||
"permission_settings",
|
||||
"security_2fa",
|
||||
}
|
||||
ai_routes = {
|
||||
"ai_settings",
|
||||
"ai_models",
|
||||
"ais",
|
||||
"ai_create",
|
||||
"ai_update",
|
||||
"ai_delete",
|
||||
"ai_execution_log",
|
||||
}
|
||||
modules_routes = {
|
||||
"modules_settings",
|
||||
"command_routing",
|
||||
"business_plan_inbox",
|
||||
"business_plan_editor",
|
||||
"tasks_settings",
|
||||
"translation_settings",
|
||||
"availability_settings",
|
||||
categories = {
|
||||
"general": {
|
||||
"routes": {
|
||||
"notifications_settings",
|
||||
"notifications_update",
|
||||
"system_settings",
|
||||
"accessibility_settings",
|
||||
},
|
||||
"title": "General",
|
||||
"tabs": [
|
||||
(
|
||||
"Notifications",
|
||||
notifications_href,
|
||||
lambda: path == notifications_href,
|
||||
),
|
||||
("System", system_href, lambda: path == system_href),
|
||||
(
|
||||
"Accessibility",
|
||||
accessibility_href,
|
||||
lambda: path == accessibility_href,
|
||||
),
|
||||
],
|
||||
},
|
||||
"security": {
|
||||
"routes": {
|
||||
"security_settings",
|
||||
"encryption_settings",
|
||||
"permission_settings",
|
||||
"security_2fa",
|
||||
},
|
||||
"title": "Security",
|
||||
"tabs": [
|
||||
("Encryption", encryption_href, lambda: path == encryption_href),
|
||||
("Permissions", permissions_href, lambda: path == permissions_href),
|
||||
(
|
||||
"2FA",
|
||||
security_2fa_href,
|
||||
lambda: path == security_2fa_href or namespace == "two_factor",
|
||||
),
|
||||
],
|
||||
},
|
||||
"ai": {
|
||||
"routes": {
|
||||
"ai_settings",
|
||||
"ai_models",
|
||||
"ais",
|
||||
"ai_create",
|
||||
"ai_update",
|
||||
"ai_delete",
|
||||
"ai_execution_log",
|
||||
},
|
||||
"title": "AI",
|
||||
"tabs": [
|
||||
("Models", ai_models_href, lambda: path == ai_models_href),
|
||||
("Traces", ai_traces_href, lambda: path == ai_traces_href),
|
||||
],
|
||||
},
|
||||
"modules": {
|
||||
"routes": {
|
||||
"modules_settings",
|
||||
"command_routing",
|
||||
"business_plan_inbox",
|
||||
"business_plan_editor",
|
||||
"tasks_settings",
|
||||
"translation_settings",
|
||||
"translation_preview",
|
||||
"availability_settings",
|
||||
"codex_settings",
|
||||
"codex_approval",
|
||||
},
|
||||
"title": "Modules",
|
||||
"tabs": [
|
||||
("Commands", commands_href, lambda: path == commands_href),
|
||||
(
|
||||
"Business Plans",
|
||||
business_plans_href,
|
||||
lambda: url_name in {"business_plan_inbox", "business_plan_editor"},
|
||||
),
|
||||
("Task Automation", tasks_href, lambda: path == tasks_href),
|
||||
(
|
||||
"Translation",
|
||||
translation_href,
|
||||
lambda: url_name in {"translation_settings", "translation_preview"},
|
||||
),
|
||||
("Availability", availability_href, lambda: path == availability_href),
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
two_factor_security_routes = {
|
||||
@@ -72,55 +130,29 @@ def settings_hierarchy_nav(request):
|
||||
"phone_delete",
|
||||
}
|
||||
|
||||
if url_name in general_routes:
|
||||
settings_nav = {
|
||||
"title": "General",
|
||||
"tabs": [
|
||||
_tab("Notifications", notifications_href, path == notifications_href),
|
||||
_tab("System", system_href, path == system_href),
|
||||
_tab("Accessibility", accessibility_href, path == accessibility_href),
|
||||
],
|
||||
}
|
||||
elif url_name in security_routes or (
|
||||
if url_name in categories["general"]["routes"]:
|
||||
category = categories["general"]
|
||||
elif url_name in categories["security"]["routes"] or (
|
||||
namespace == "two_factor" and url_name in two_factor_security_routes
|
||||
):
|
||||
settings_nav = {
|
||||
"title": "Security",
|
||||
"tabs": [
|
||||
_tab("Encryption", encryption_href, path == encryption_href),
|
||||
_tab("Permissions", permissions_href, path == permissions_href),
|
||||
_tab(
|
||||
"2FA",
|
||||
security_2fa_href,
|
||||
path == security_2fa_href or namespace == "two_factor",
|
||||
),
|
||||
],
|
||||
}
|
||||
elif url_name in ai_routes:
|
||||
settings_nav = {
|
||||
"title": "AI",
|
||||
"tabs": [
|
||||
_tab("Models", ai_models_href, path == ai_models_href),
|
||||
_tab("Traces", ai_traces_href, path == ai_traces_href),
|
||||
],
|
||||
}
|
||||
elif url_name in modules_routes:
|
||||
settings_nav = {
|
||||
"title": "Modules",
|
||||
"tabs": [
|
||||
_tab("Commands", commands_href, path == commands_href),
|
||||
_tab(
|
||||
"Business Plans",
|
||||
business_plans_href,
|
||||
url_name in {"business_plan_inbox", "business_plan_editor"},
|
||||
),
|
||||
_tab("Task Automation", tasks_href, path == tasks_href),
|
||||
_tab("Translation", translation_href, path == translation_href),
|
||||
_tab("Availability", availability_href, path == availability_href),
|
||||
],
|
||||
}
|
||||
category = categories["security"]
|
||||
elif url_name in categories["ai"]["routes"]:
|
||||
category = categories["ai"]
|
||||
elif url_name in categories["modules"]["routes"]:
|
||||
category = categories["modules"]
|
||||
else:
|
||||
category = None
|
||||
|
||||
if category is None:
|
||||
settings_nav = None
|
||||
else:
|
||||
settings_nav = {
|
||||
"title": str(category.get("title") or "Settings"),
|
||||
"tabs": [
|
||||
_tab(label, href, bool(is_active()))
|
||||
for label, href, is_active in category.get("tabs", [])
|
||||
],
|
||||
}
|
||||
|
||||
if not settings_nav:
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user