-
Notifications
You must be signed in to change notification settings - Fork 42
feat: export Audit logs page as a component and consume it in apps/admin #1374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/export-products-page
Are you sure you want to change the base?
feat: export Audit logs page as a component and consume it in apps/admin #1374
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR restructures the admin application from a container-based architecture to a page-based routing pattern. It moves utility functions (pagination, query transformation, timestamps) to a centralized Changes
Sequence Diagram(s)sequenceDiagram
participant Router as React Router
participant Page as ProductsPage
participant View as ProductsView
participant API as FrontierServiceQueries
Router->>Page: Render with :productId param
Page->>Page: useParams() → productId<br/>useNavigate() → navigate
Page->>View: Render with navigation callbacks
View->>API: useQuery(listProducts)
API-->>View: Product list data
View->>View: Build product map by ID
View->>View: Render DataTable with products
Router->>View: User clicks product row
View->>Page: onRowClick(id)
Page->>Page: navigate(`/products/${id}`)
Router->>Page: Update route, re-render
Page->>View: Pass onNavigateToPrices callback
Router->>View: User clicks "View Prices"
View->>Page: onNavigateToPrices(productId)
Page->>Page: navigate(`/products/${productId}/prices`)
Router->>Page: Route to ProductPricesPage
sequenceDiagram
participant Page as AuditLogsPage
participant View as AuditLogsView
participant Navbar as Navbar
participant Admin as AdminClient
participant Helper as exportCsvFromStream
Page->>Page: Create adminClient with binary export
Page->>Page: Define onExportCsv callback (memoized)
Page->>View: Render with onExportCsv prop
View->>Navbar: Pass onExportCsv handler
Navbar->>Navbar: Query state updated
Router->>Navbar: User clicks "Export CSV"
Navbar->>Page: Call onExportCsv(query)
Page->>Admin: adminClient.exportAuditRecords(mappedQuery)
Admin-->>Helper: Stream response
Helper->>Helper: Accumulate chunks as Blob
Helper-->>Browser: Trigger download as CSV file
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Pull Request Test Coverage Report for Build 21901112133Details
💛 - Coveralls |
Summary
apps/admin/src/pages/audit-logs/list/tolib/admin/views/audit-logs/(usinggit mvto preserve history)AuditLogsViewfrom@raystack/frontier/adminas a router-agnostic view component with optionalappNameandonExportCsvpropsAuditLogsPagewrapper inapps/adminthat provides app-specific dependencies (CSV export via admin client).svg?reactimportsreact-router-domresolve alias invite.config.tsand as an optional peer dependency in the lib@raystack/apsarain lib to0.56.2foruseDebouncedStateandCodeBlocktype supportlocalsConvention: 'camelCase') in tsup config to preserve kebab-case class name accessTest plan
pnpm buildinweb/lib)pnpm buildinweb/apps/admin)