Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • add additional context for paginated logs in dashboard, add empty state when selected cell has no data
  • add ability to cmd-click for discontinuous segment selection, shift-click for continuous selections

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 22, 2025 8:59pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 formatDate function 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 selectedSegments as 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.tsx for 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
Loading

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit ec034f3 into staging Oct 22, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/dashboard branch October 22, 2025 21:07
waleedlatif1 added a commit that referenced this pull request Oct 23, 2025
* 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)
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.

2 participants