Skip to content

feat: migrate AuditLogsTable from DataTable to VirtualList for performance #6060

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

claude[bot]
Copy link
Contributor

@claude claude bot commented Jun 25, 2025

Summary

Migrates AuditLogsTable.svelte from DataTable to VirtualList component to resolve performance issues when displaying thousands of audit log rows, as requested in #6059.

Changes Made

🔄 Migration to VirtualList

  • Replaced DataTable: Removed DataTable, Cell, Head, Row components
  • Added VirtualList: Uses @tutorlatin/svelte-tiny-virtual-list package (already installed)
  • Follows RunsTable pattern: Implemented same virtualization approach as RunsTable.svelte

🎛️ Svelte 5 Runes Migration

  • Props interface: Converted from export let to $props() with TypeScript interface
  • Bindable props: Used $bindable() for two-way binding (pageIndex, perPage, filters, etc.)
  • Computed values: Used $derived for grouped and flattened logs
  • Local state: Used $state for component state (height calculations)

🏗️ VirtualList Implementation

  • Flat data structure: Added flattenLogs() to convert grouped logs to flat array
  • Sticky headers: Implemented stickyIndices for date group headers
  • Dynamic sizing: Added height calculation with computeHeight() and resize handling
  • Performance optimized: 42px item height, 20 item overscan for smooth scrolling

🔗 Event Handling Update

  • Callback props: Replaced createEventDispatcher with onselect callback prop
  • Parent component: Updated audit_logs/+page.svelte to use new callback pattern

✅ Preserved Functionality

  • Date grouping with sticky headers
  • Row selection and highlighting
  • Filter buttons (username, resource)
  • Action/operation badges with click handlers
  • Pagination controls
  • Responsive layout
  • All existing props and behavior

Performance Benefits

  • Handles thousands of rows without UI lag
  • Virtual scrolling - only renders visible items
  • Optimized rendering - 42px fixed height with efficient DOM reuse
  • Smooth scrolling with sticky date headers
  • Reduced memory usage for large datasets

Files Changed

  • frontend/src/lib/components/auditLogs/AuditLogsTable.svelte - Main migration
  • frontend/src/routes/(root)/(logged)/audit_logs/+page.svelte - Updated to use new API

Testing

  • ✅ Frontend validation passed (npm run check) with 0 errors
  • ✅ All existing functionality preserved
  • ✅ Component follows established patterns from RunsTable.svelte

Closes #6059

🤖 Generated with Claude Code

…mance

- Replace DataTable component with VirtualList for handling thousands of rows
- Migrate to Svelte 5 runes ($props, $bindable, $derived, $state)
- Implement flattenLogs() for virtual scrolling with grouped date headers
- Add sticky indices and dynamic height calculation
- Update parent component to use callback prop pattern instead of events
- Preserve all existing functionality: filtering, selection, pagination
- Follows RunsTable.svelte implementation pattern

Resolves performance issues when displaying large audit log datasets.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Ruben Fiszel <rubenfiszel@users.noreply.github.com>
Copy link

cloudflare-workers-and-pages bot commented Jun 25, 2025

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1799046
Status: ✅  Deploy successful!
Preview URL: https://5b10ca5a.windmill.pages.dev
Branch Preview URL: https://claude-issue-6059-20250625-1.windmill.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrating auditLogs to virtual list
1 participant