Panels — contribuir un módulo¶
Un plugin de negocio no crea un panel nuevo: contribuye un módulo a un panel host existente.
Cuándo aplica¶
- Tu dominio es booking, clientes, pagos, etc.
- La UI debe aparecer bajo
/panel/...,/accounting/...u otro panel ya registrado. - Usas
register_resource(registry, panel_id, module_id, ...).
Panels disponibles (repo)¶
panel_id | Ruta UI | Uso |
|---|---|---|
panel | /panel/ | Operación — módulos de dominio |
client | / | Portal cliente |
trainer | /trainer/ | Portal entrenador |
accounting | /accounting/ | Contabilidad |
control | /control/ | Control de plugins |
samples | /samples/ | Ejemplos (reference) |
Activa hosts con CORTEX_ENABLED_PANELS.
Montar un módulo¶
register_resource(registry, "panel", "clients", configure_clients)
# ^panel ^module_id en nav y rutas
El manifest emitido incluye:
panelId:panelmoduleId:clientsmodulePath: segmento URL (clients→/panel/clients/...)screens[]: pantallas condashboardId,navGroup,navSort
Módulo sin ResourceBuilder (legacy)¶
def register_dashboards(registry: DashboardRegistrar) -> None:
registry.register_module(
"panel",
"booking",
manifest_dict,
dashboards_dict,
)
Deprecado para CRUD estándar
Prefiere register_resources cuando el flujo sea list/create/edit.
Pitfalls de manifests manuales¶
Si registras manifest_dict a mano:
| Regla | Motivo |
|---|---|
Declara path: "create" si hay acción CREATE | Evita que :id capture la ruta create |
Orden recomendado: "" → create → :id/edit → :id | Refuerzo; el shell prioriza por especificidad (ADR 018) |
Usa emit_dashboard(..., hide_title=True) en listados | El shell shadcn muestra screens[].title en el header |
| No dupliques títulos en dashboard y widgets | Deja config.title vacío en tabla/infolist si el shell asume el título |
Multi-módulo en un panel¶
Varios plugins pueden registrar módulos en el mismo panel_id. La navegación los ordena por navGroup y navSort.
Siguiente paso¶
¿Necesitas un panel producto nuevo (ruta y shell propios)? Lee Panel hosts.