-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(dashboard): add additional context for paginated logs in dashboard, add empty state when selected cell has no data #1719
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
Conversation
…d, add empty state when selected cell has no data
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
Enhanced the dashboard logs view with multi-segment selection capabilities and improved user experience. Refactored duplicated log mapping logic into reusable utility functions to improve maintainability.
Key Changes:
- Multi-segment selection: Added support for cmd-click (discontinuous) and shift-click (continuous range) segment selection, allowing users to select segments across multiple workflows
- Empty state handling: Added informative message when selected time segments contain no execution logs
- Code consolidation: Extracted duplicated log mapping logic (~70+ lines repeated 3x) into shared utility functions (
mapToExecutionLog,mapToExecutionLogAlt,parseDuration,extractOutput) - Import path consistency: Consolidated
formatDatefunction into main utils file and updated all imports to use absolute path aliases - Multi-workflow view: Implemented aggregated view (
__multi__) when segments from multiple workflows are selected
Impact:
The refactoring significantly reduces code duplication while adding powerful multi-selection capabilities that improve the user's ability to analyze logs across different workflows and time segments.
Confidence Score: 4/5
- This PR is generally safe to merge with low risk, though the complex selection logic should be tested thoroughly
- The refactoring improves code quality by eliminating significant duplication. The multi-selection feature adds complexity but follows React patterns appropriately. The main concern is the intricate state management with
selectedSegmentsas a Record and the special__multi__mode, which introduces edge cases that should be well-tested. The empty state fix is straightforward and correct. - Pay close attention to
apps/sim/app/workspace/[workspaceId]/logs/dashboard.tsxfor the complex selection state logic and edge cases in multi-workflow aggregation
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/workspace/[workspaceId]/logs/utils.ts | 5/5 | Refactored duplicated log mapping logic into reusable utility functions (parseDuration, extractOutput, mapToExecutionLog, mapToExecutionLogAlt) and consolidated formatDate from separate file |
| apps/sim/app/workspace/[workspaceId]/logs/dashboard.tsx | 4/5 | Enhanced multi-segment selection with cmd-click/shift-click support, added multi-workflow view (__multi__), refactored state from single array to Record keyed by workflow ID, replaced inline mapping with utility functions |
| apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/workflow-details.tsx | 5/5 | Added empty state message when no logs found in time segment, improved loading indicator logic to only show when logs exist, updated chart label from "Workflow Duration" to "Duration", updated import paths |
Sequence Diagram
sequenceDiagram
participant User
participant Dashboard
participant WorkflowsList
participant WorkflowDetails
participant API
participant Utils
User->>Dashboard: Click segment (with cmd/shift)
Dashboard->>Dashboard: handleSegmentClick(mode: toggle/range/single)
alt Toggle Mode (cmd-click)
Dashboard->>Dashboard: Add/remove segment from selectedSegments[workflowId]
Dashboard->>Dashboard: Check if multiple workflows selected
alt Multiple workflows
Dashboard->>Dashboard: Set expandedWorkflowId = '__multi__'
else Single workflow
Dashboard->>Dashboard: Set expandedWorkflowId to workflow
end
else Range Mode (shift-click)
Dashboard->>Dashboard: Expand selection using lastAnchorIndices[workflowId]
Dashboard->>Dashboard: Update selectedSegments[workflowId]
else Single Mode (regular click)
Dashboard->>Dashboard: Clear all selections
Dashboard->>Dashboard: Set selectedSegments = {[workflowId]: [index]}
end
Dashboard->>API: Fetch workflow details if not loaded
API-->>Dashboard: Return logs data
Dashboard->>Utils: mapToExecutionLog(rawLog)
Utils-->>Dashboard: ExecutionLog[]
Dashboard->>WorkflowsList: Pass selectedSegments
WorkflowsList->>WorkflowsList: Render segments with selections
alt Multi-workflow mode
Dashboard->>Dashboard: Aggregate logs from all selected workflows
Dashboard->>Dashboard: Build combined charts
Dashboard->>WorkflowDetails: Render multi-workflow view
else Single workflow mode
Dashboard->>Dashboard: Filter logs by selected segments
Dashboard->>WorkflowDetails: Render single workflow view
alt No logs in selection
WorkflowDetails->>User: Show "No executions found in this time segment"
else Has logs
WorkflowDetails->>User: Display logs table
end
end
No files reviewed, no comments
* fix(debug-mode): remove duplicate debug mode flag (#1714) * feat(i18n): update translations (#1709) * improvement(condition): added variable and envvar highlighting for condition input (#1718) * fix(dashboard): add additional context for paginated logs in dashboard, add empty state when selected cell has no data (#1719) * fix(dashboard): add additional context for paginated logs in dashboard, add empty state when selected cell has no data * apps/sim * renaming * remove relative import * feat(tools): added webflow OAuth + tools (#1720) * feat(tools): added webflow OAuth + tools * remove itemId from delete item * remove siteId * added webhook triggers + oauth scopes + site/collection selector * update sample payload for webflow triggers * cleanup * fix discord color * feat(i18n): update translations (#1721) * improvement(schedule): fix UI bug with schedule modal (#1722)
Summary
Type of Change
Testing
Tested manually.
Checklist