Skip to content

Module dashboard

Deux tableaux de bord distincts, a ne pas confondre :

  • Dashboard JEMA (frontend) : statistiques d'inscriptions, expose hors backoffice sur /dashboard (voir plus bas).
  • Dashboard "Systeme" (backoffice Umbraco 17) : version de build, environnement, support et journal des nouveautes (voir tout en bas).

Dashboard JEMA (frontend)

Tableau de bord de statistiques JEMA, expose hors backoffice sur la route /dashboard, protege par autorisation et token chiffre. Code : Controllers/DashboardController.cs, Services/DashboardDataService.cs (IDashboardService + DashboardService), Services/DashboardEncryptionService.cs, vues Views/Dashboard/.

Routes (DashboardController, [Route("dashboard")])

RouteRole
GET /dashboardVue principale (stats par localite/ville/exposant, stats globales, inscriptions cumulees), avec selecteur d'edition (editionId)
GET /dashboard/searchRecherche de participants (JSON)
POST /dashboard/tools/recalculate-registrationsRecalcule les compteurs d'inscriptions

Toute action verifie IsAuthorizedAsync(HttpContext) ; sinon retourne la page 404 (NotFoundPage) ou Unauthorized.

Autorisation & vue restreinte

  • L'acces s'appuie sur DashboardSecurityOptions (section DashboardSecurity) et IBackOfficeSecurityAccessor (un utilisateur backoffice connecte est autorise).
  • Un acces "ville" est possible via un token : HttpContext.Items["CityJemaFilter"] filtre les donnees a une ville. Si present, la vue restreinte Views/Dashboard/Index-restricted.cshtml est rendue (sinon Index.cshtml).
  • DashboardEncryptionService (IDashboardEncryptionService, enregistre en Singleton) chiffre/dechiffre les tokens d'acces (liens partageables par ville/canton).

Service de donnees (IDashboardService)

Agrege le contenu JEMA (participants, creneaux, exposants) en statistiques. Records retournes : DashboardLocalityStat, DashboardStateStat, DashboardExhibitorStat, DashboardCityStat, DashboardOverallStats, DashboardDailyRegistration, DashboardEditionInfo, ParticipantSearchResult.

Principales operations :

  • statistiques par localite / canton / ville / exposant, taux de remplissage (FillRate) ;
  • inscriptions quotidiennes cumulees ;
  • liste des editions (GetAllEditionsAsync, edition courante via IsCurrent) ;
  • recherche de participants ;
  • recalcul des compteurs (RecalculateAllRegistrationsAsync) ;
  • exports CSV (GenerateFullParticipantsExportAsync, par canton, tous les artisans, participants avec ville/exposant).

Tous les exports/filtres acceptent editionId et un cityFilter optionnels.

A retenir

  • Les donnees proviennent du contenu Umbraco (noeuds JEMA), pas d'une base custom.
  • L'enregistrement DI est dans Program.cs : IDashboardService -> DashboardService (Scoped), IDashboardEncryptionService -> DashboardEncryptionService (Singleton).
  • Si on ajoute une stat ou un export, l'ajouter a IDashboardService + DashboardService + la vue correspondante.

Dashboard "Systeme" (backoffice Umbraco 17)

Onglet de dashboard dans la section Content du backoffice (nouveau backoffice web components, pas AngularJS). Affiche : la version de build (derivee de git), l'environnement et le hostname, une carte support, une carte "A propos" (coordonnees Spektrum) et un journal des nouveautes (changelog) sous forme d'accordeon.

Frontend (src/Web/App_Plugins/MdaDashboard/)

  • umbraco-package.json : declare l'extension type: "dashboard" (alias Mda.Dashboard.System, element -> dashboard.js, meta.label "Systeme", condition Umb.Condition.SectionAlias sur Umb.Section.Content).
  • dashboard.js : web component Lit (extends UmbLitElement, JS pur servi tel quel, pas de build Vite). Imports via l'importmap backoffice (@umbraco-cms/backoffice/lit-element, .../external/lit, .../auth). Custom element mda-system-dashboard.
  • changelog.json : tableau JSON du journal des nouveautes (rédige a la main, voir skill updating-changelog). Charge en fetch statique, echec non bloquant.

Backend

  • Controllers/DashboardInfoController.cs : ManagementApiControllerBase, [VersionedApiBackOfficeRoute("dashboard-info")], [Authorize(Policy = AuthorizationPolicies.BackOfficeAccess)]. Route reelle : /umbraco/management/api/v1/dashboard-info/info. Le dashboard l'appelle avec un Bearer token recupere via UMB_AUTH_CONTEXT.getLatestToken().
  • Services/DashboardInfoService.cs (IDashboardInfoService) : construit le DashboardInfo (version, derniere modif, commit, version Umbraco, environnement, hostname). Serialisation System.Text.Json camelCase.
  • DI dans Program.cs : IDashboardInfoService -> DashboardInfoService (Singleton).

Version de build (git)

sourceVersion est calcule depuis GIT_COMMIT_COUNT (nombre de commits git), injecte au build. La CI GitLab (GIT_DEPTH: 0 + git rev-list --count / rev-parse / log) passe GIT_COMMIT_COUNT/SHA/DATE en --build-arg ; le hosting/Dockerfile (stage runtime) les expose en ENV. En local sans build CI -> 1.0.0.dev.

Contributors

No contributors

Changelog

No recent changes