Declare notification View surfaces

This commit is contained in:
2026-07-28 21:04:54 +02:00
parent 9c2dc3efbf
commit 992d2ca533
2 changed files with 42 additions and 1 deletions

View File

@@ -4,8 +4,18 @@ from pathlib import Path
from govoplan_core.core.access import CAPABILITY_AUTH_PERMISSION_EVALUATOR, CAPABILITY_AUTH_PRINCIPAL_RESOLVER from govoplan_core.core.access import CAPABILITY_AUTH_PERMISSION_EVALUATOR, CAPABILITY_AUTH_PRINCIPAL_RESOLVER
from govoplan_core.core.module_guards import drop_table_retirement_provider, persistent_table_uninstall_guard from govoplan_core.core.module_guards import drop_table_retirement_provider, persistent_table_uninstall_guard
from govoplan_core.core.modules import MigrationSpec, ModuleContext, ModuleInterfaceProvider, ModuleManifest, PermissionDefinition, RoleTemplate from govoplan_core.core.modules import (
FrontendModule,
FrontendRoute,
MigrationSpec,
ModuleContext,
ModuleInterfaceProvider,
ModuleManifest,
PermissionDefinition,
RoleTemplate,
)
from govoplan_core.core.notifications import CAPABILITY_NOTIFICATIONS_DISPATCH from govoplan_core.core.notifications import CAPABILITY_NOTIFICATIONS_DISPATCH
from govoplan_core.core.views import ViewSurface
from govoplan_core.db.base import Base from govoplan_core.db.base import Base
from govoplan_notifications.backend.db import models as notification_models # noqa: F401 - populate Notifications ORM metadata from govoplan_notifications.backend.db import models as notification_models # noqa: F401 - populate Notifications ORM metadata
@@ -82,6 +92,27 @@ manifest = ModuleManifest(
role_templates=ROLE_TEMPLATES, role_templates=ROLE_TEMPLATES,
route_factory=_notifications_router, route_factory=_notifications_router,
tenant_summary_providers=(_tenant_summary,), tenant_summary_providers=(_tenant_summary,),
frontend=FrontendModule(
module_id=MODULE_ID,
package_name="@govoplan/notifications-webui",
routes=(
FrontendRoute(
path="/notifications",
component="NotificationCenterPage",
required_any=(READ_SCOPE,),
order=59,
),
),
view_surfaces=(
ViewSurface(
id="notifications.settings.preferences",
module_id=MODULE_ID,
kind="section",
label="Notification preferences",
order=40,
),
),
),
migration_spec=MigrationSpec( migration_spec=MigrationSpec(
module_id=MODULE_ID, module_id=MODULE_ID,
metadata=Base.metadata, metadata=Base.metadata,

View File

@@ -12,6 +12,7 @@ const notificationSettingsSections: SettingsSectionsUiCapability = {
sections: [ sections: [
{ {
id: "notifications", id: "notifications",
surfaceId: "notifications.settings.preferences",
label: "Notifications", label: "Notifications",
group: "ui", group: "ui",
order: 40, order: 40,
@@ -28,6 +29,15 @@ export const notificationsModule: PlatformWebModule = {
dependencies: [], dependencies: [],
optionalDependencies: ["mail", "tasks", "portal", "workflow", "calendar", "scheduling"], optionalDependencies: ["mail", "tasks", "portal", "workflow", "calendar", "scheduling"],
translations: generatedTranslations, translations: generatedTranslations,
viewSurfaces: [
{
id: "notifications.settings.preferences",
moduleId: "notifications",
kind: "section",
label: "Notification preferences",
order: 40
}
],
routes: [ routes: [
{ path: "/notifications", anyOf: notificationRead, order: 59, render: ({ settings, auth }) => createElement(NotificationCenterPage, { settings, auth }) } { path: "/notifications", anyOf: notificationRead, order: 59, render: ({ settings, auth }) => createElement(NotificationCenterPage, { settings, auth }) }
], ],