Draft
Conversation
Adds comprehensive PDF export functionality for playbook run reports,
allowing users to generate professional documentation of completed runs.
**Backend Changes:**
- Add /runs/{id}/export-data API endpoint with permissions check
- Implement GetPlaybookRunExportData service method
- Create PlaybookRunExportData struct with run metadata, status updates,
participants, owner, channel, and team information
**Frontend Changes:**
- Add @react-pdf/renderer dependency for PDF generation
- Create modular report components (cover page, executive summary,
timeline, status updates, checklists, retrospective)
- Add export options modal for section selection
- Integrate export menu item in run context menu
- Add client API method for fetching export data
**UI Components:**
- ExportOptionsModal: Section selection interface
- ReportDocument: Main PDF layout orchestrator
- Multiple section components with consistent styling
- Support for customizable section inclusion
**Technical Details:**
- Fix ChunkLoadError by removing lazy loading
- Add eslint override for error logging
- Handle null data gracefully during async fetch
- Comprehensive error handling and logging
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
**Bug Fix:** - Fix retrospective section accessing wrong data structure - Changed from `retrospective.text` to `run.retrospective` (string) - Changed from `retrospective.metrics` to `run.metrics_data` (array) - Add null handling for metric values with String() conversion **Enhancement:** - Add professional table of contents page after cover page - TOC dynamically lists enabled sections only - Clean design with Mattermost branding - Includes sub-items for retrospective (Summary, Metrics) - Consistent styling with divider lines and indentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Implements full channel chat log export for run reports with proper permission checks and pagination. **Backend Changes:** - Add ChatPosts field to PlaybookRunExportData struct - Update GetPlaybookRunExportData signature to include userID parameter - Implement channel member permission check before fetching posts - Add paginated fetching of all channel posts (200 per page) - Gracefully handle permission errors (returns empty array) **Frontend Changes:** - Create ChatLogSection component with chronological post display - Show user display names (first/last name fallback to username) - Format timestamps in readable format - Display post type indicators for system messages - Include total post count at end - Enable chat log option in export modal (previously disabled) **Security:** - Verify user is channel member via GetMember before fetching posts - Log permission failures without breaking entire export - Respect existing RunView permission check at API level **Performance:** - Efficient pagination with 200 posts per page - Early break on API errors - Sorted chronologically (oldest first) for natural reading 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
**Chat Log Improvements:** - Group posts by threads using Post.RootId field - Show replies indented with left border (Mattermost blue) - Add reply indicator (↳) before usernames - Sort threads chronologically with replies in order - Display thread count vs reply count in footer - Update description to mention thread grouping **Checklist/Task Improvements:** - Add clear visual status indicators (☑ DONE / ☐ TODO) - Color-coded left borders (green=done, gray=todo) - Status badges with background colors - Resolve assignee IDs to display names (first/last name or username) - Show task descriptions in italic style - Add emoji icons for assignee (👤) and due date (📅) - Display completion percentage per checklist - Better spacing and visual hierarchy **Type Updates:** - Add root_id field to StatusPostComplete interface - Enables proper thread detection in frontend 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Prevents exporting posts from other runs when a channel is reused for multiple playbook runs. **Changes:** - Use GetPostsSince API with run's CreateAt timestamp for efficiency - Filter posts to only include those between run start and end - Handle ongoing runs (EndAt = 0) by using current time as end - Add logging for post count and time range **Before:** Exported ALL posts from channel history **After:** Only posts created during the specific run's lifetime **Time Range:** - Start: playbookRun.CreateAt - End: playbookRun.EndAt (or current time if run still active) **Benefits:** - Accurate conversation history per run - Prevents mixing conversations from different runs - More efficient API usage with GetPostsSince - Better performance on long-lived channels 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…atText utility Adds proper markdown rendering to PDF exports using Mattermost's existing formatText utility, then converting HTML to PDF components. **Markdown Support:** - Uses `formatText` from webapp_globals (Mattermost's markdown parser) - Converts HTML output to @react-pdf/renderer components - Supports: **bold**, *italic*, `code`, links, code blocks, line breaks **Applied To:** - Chat log messages - Status update messages - Retrospective summaries - Task descriptions **Implementation:** - Created MarkdownText component that wraps formatText - HTML-to-PDF converter handles common tags (strong, em, code, a, pre) - HTML entity decoding (<, >, &, ") - Code blocks with monospace font and styled background - Inline code with Mattermost red color (#e01e5a) - Links with Mattermost blue (#1c58d9) and underline **Benefits:** - Consistent markdown parsing with main Mattermost app - Properly formatted messages in PDF exports - Rich text content preserved from markdown source 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Status: POC with very rough edges
Incident_ Test Incident-report-2025-11-05 (1).pdf
Comprehensive PDF export functionality for playbook run reports, allowing users to generate professional documentation of completed runs for post-mortems, compliance, or stakeholder communication.
Key Features
📄 Flexible Export Options
📊 Professional Formatting
✅ Enhanced Task Presentation
💬 Chat Log with Threading
Backend Implementation
API Endpoints
GET /runs/{id}/export-datawith permission checksData Fetching
GetPlaybookRunExportDataservice method aggregates data from multiple sourcesGetPostsSinceAPIstartTime <= post.CreateAt <= endTimeSecurity & Permissions
Frontend Implementation
Components Structure
Key Improvements
run.retrospectivestring,run.metrics_dataarray)root_idto type definitions for proper threadingTechnical Details
PDF Generation
Performance
GetPostsSincefor time-range queriesBug Fixes
isLoadingstateTesting Checklist
Future Enhancements
Migration Notes
GetPlaybookRunExportDatasignature now includesuserIDparameter@react-pdf/rendererv4.2.0ChatPostsinPlaybookRunExportDatastructroot_idinStatusPostCompleteinterface🤖 Generated with Claude Code