mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 21:15:41 +00:00
feat(freight-backoffice): render reports from the server-driven catalog
Drop reportConfigs.ts (per-report FE config duplicating the backend) and the chart-drawing ReportPage. Replace with ReportView: one engine that renders any report the GET /reports catalog describes — filters, KPI strip, sortable/paginated DataTable, xlsx/pdf export via blob download. ReportSection embeds a report inline on any page, scoped by idKey, and renders nothing if the caller lacks that report's permission. Sidebar Reports submenu is now built from the live catalog (sidebar-sections.tsx + App.tsx) instead of a hand-listed key — no FE edit needed to add or hide a report.
This commit is contained in:
@@ -51,7 +51,10 @@ import { getCategorySidebarChildren } from "@/pages/ruleEngine/config/resources"
|
||||
* a user's first reachable route without importing the route tree (App.tsx
|
||||
* imports RequirePermission, which imports landing — that would cycle).
|
||||
*/
|
||||
export const buildSidebarSections = (demoItems: SidebarItem[]): SidebarSection[] => [
|
||||
export const buildSidebarSections = (
|
||||
demoItems: SidebarItem[],
|
||||
reportItems: SidebarItem[] = [],
|
||||
): SidebarSection[] => [
|
||||
{
|
||||
title: "Main menu",
|
||||
items: [
|
||||
@@ -66,6 +69,9 @@ export const buildSidebarSections = (demoItems: SidebarItem[]): SidebarSection[]
|
||||
href: "/dashboard/reports",
|
||||
icon: <BarChart3 />,
|
||||
permission: FREIGHT_PERMS.reports.view,
|
||||
// Populated from the live GET /reports catalog (already permission-
|
||||
// filtered server-side) — no report key is ever hand-listed here.
|
||||
...(reportItems.length ? { children: reportItems } : {}),
|
||||
},
|
||||
{
|
||||
label: "Customers",
|
||||
|
||||
Reference in New Issue
Block a user