Commit graph

13 commits

Author SHA1 Message Date
Vadym Samoilenko
0165622f3d Fix date range filter ignoring messages without Timestamp
The filter was using fail-open logic (skipping the date check when
msg.Timestamp was falsy), so messages missing a Timestamp bypassed
the filter entirely. Per-User Report aggregates all filtered messages,
making the bug visible as all-time totals regardless of selected range.

Changed both the message and conversation date filter blocks to
fail-closed: when a date range is active, records without a parseable
timestamp are excluded. Also added a backend warning log to surface
any enriched messages that still lack a Timestamp after the
StartTime fallback (commit 421961a).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 14:58:57 +01:00
Vadym Samoilenko
46ccccc3dd Add Per-User Report tab with bar chart, table, and CSV export
New tab in Dashboard switches between the existing Volume Report and a
Per-User view showing message counts aggregated by User_ID. Reuses
existing filteredMessages, processedUserData, date/org filters.
CSV export matches the format Michael sends to the BAIC UK client.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-06 13:12:49 +01:00
michael
2a50d15b14 Update deploy script to restart backend service instead of start
Changed systemctl start to systemctl restart to ensure backend code changes are always picked up during deployment, even when the service is already running.

Previous behavior: systemctl start would do nothing if service was running
New behavior: systemctl restart always stops and starts the service with fresh code

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 09:17:19 -06:00
michael
4b62ca68ae Remove window global dependencies and pass assistant mapping via props
Fixed bug where filtering by assistant caused errors due to window.assistantDisplayToIdMap being undefined. Removed all window global variable usage for assistant mappings.

Changes:
- VolumeGraph: Now accepts assistantDisplayToIdMap as prop instead of window global
- Dashboard: Passes assistantDisplayToIdMap to VolumeGraph and ExportButton
- ExportButton: Accepts and forwards assistantDisplayToIdMap to dataAggregation
- dataAggregation: Accepts assistantDisplayToIdMap as parameter
- Cleaned up debug logging that referenced window globals

This completes the migration from window globals to React state for all assistant mapping data, fixing the TypeError when selecting assistants from the filter dropdown.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 09:11:18 -06:00
michael
882cd4dc0d Update assistant friendly names with current production assistants
Updated assistantMapping.js with friendly names for all active assistants:
- Banner & Ad Server Assistant (updated from Copy Assistant)
- Social Assistant
- SEM Assistant
- Email Assistant
- Free Chat

This improves UX by showing descriptive names in the assistant filter dropdown instead of raw IDs.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:56:13 -06:00
michael
421961afc3 Add Timestamp field to enriched messages using conversation StartTime fallback
Messages from Make.com webhook have blank timestamp fields, preventing graph aggregation. This fix adds a Timestamp field during message enrichment using the parent conversation's StartTime as a fallback.

Logic:
- First checks if message has native Timestamp field from webhook
- If missing/blank, falls back to parent conversation's StartTime
- Ensures all messages have timestamps for proper date aggregation in VolumeGraph

This fixes the issue where messages mode shows blank graph despite 2473 messages being filtered successfully.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:50:16 -06:00
michael
83451212da Add debug logging to inspect raw message structure from webhook
Added logging to output a sample raw message from Make.com webhook to verify if messages have native timestamp fields (Timestamp, Created_At, etc.). This will help identify the correct field name for message timestamps.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:42:33 -06:00
michael
908053def2 Fix data filtering race condition and allow all assistants to display
This fixes the critical bug where all conversations and messages were being filtered out (0 results) despite successfully fetching data from the API.

Root causes fixed:
1. Race condition: window.validAssistantIds was undefined when filtering logic ran
2. Overly restrictive filtering: Only assistants with friendly names were shown
3. Assistant ID mismatch: Hardcoded IDs didn't match actual data

Changes in Dashboard.jsx:
- Replaced window global variables with React state (validAssistantIds, assistantDisplayToIdMap, etc.)
- Added guard to prevent filtering until validAssistantIds is initialized
- Removed filter that required friendly names - now all assistants display
- Use raw Assistant_ID as fallback if no friendly name exists
- Fixed useEffect dependencies to properly track state changes

Changes in assistantMapping.js:
- Added mapping for asst_eECsc64ZG3t6HHuvqR9FvoPt (Copy Assistant)
- Kept existing mappings for backwards compatibility

Result: All 469 conversations and 2471 messages now display correctly in the dashboard.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:32:12 -06:00
michael
a5c0e86927 Fix authentication redirect handling for popup-based login
Added proper MSAL initialization and redirect handling to ensure popup authentication works correctly. The app now:
- Initializes MSAL instance before rendering
- Handles redirect responses from popup authentication
- Properly processes authentication tokens and updates state

This fixes the issue where users were redirected back to login after successful authentication.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 09:44:46 -06:00
michael
4d918ed037 Fix Vite environment variable loading during production build
Updated deploy.sh to copy .env file to frontend directory before building, ensuring Vite can access environment variables (including VITE_REDIRECT_URI) during the production build process. The temporary .env is cleaned up after build completes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 09:30:44 -06:00
michael
117a68a223 Configure MSAL redirect URI explicitly via environment variables
Added VITE_REDIRECT_URI and VITE_REDIRECT_URI_DEV environment variables to provide explicit control over Azure AD redirect URIs. Updated authConfig.js to use these variables with automatic environment detection (development vs production).

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 09:27:13 -06:00
michael
bd857ae015 extracted all domains, URLS, secrets, etc. to .env and wrote a deploy script to deploy on server 2025-11-12 16:27:59 -06:00
michael
b972f024db initial commit 2025-11-12 15:55:59 -06:00