Skip to content

Allow truncating long activity names#918

Merged
Assem-Uber merged 8 commits intocadence-workflow:masterfrom
adhityamamallan:fix-long-activity-names
May 26, 2025
Merged

Allow truncating long activity names#918
Assem-Uber merged 8 commits intocadence-workflow:masterfrom
adhityamamallan:fix-long-activity-names

Conversation

@adhityamamallan
Copy link
Member

@adhityamamallan adhityamamallan commented May 22, 2025

Summary

Since we currently show the full activity names in the Workflow History view (unlike previous versions of cadence-web), this PR adds changes to allow shortening names for display.

The shortened name is derived by cutting everything off before the last period/slash, which may not always be accurate or complete. Therefore, we have made this behaviour opt-in using the WORKFLOW_HISTORY_SHOULD_SHORTEN_GROUP_LABELS_CONFIG flag.

Misc

  • Fix an issue with spacing in the "Export JSON" button

Test plan

Updated unit tests + ran locally.

With the flag disabled:
Screenshot 2025-05-23 at 10 50 59 AM

With the flag enabled:
Screenshot 2025-05-23 at 10 46 22 AM
Screenshot 2025-05-23 at 10 46 27 AM

Export JSON button (before/after):
Screenshot 2025-05-23 at 10 50 42 AM
Screenshot 2025-05-23 at 10 50 37 AM

@adhityamamallan adhityamamallan force-pushed the fix-long-activity-names branch from 97f8075 to 8bf4d7b Compare May 22, 2025 13:24
@adhityamamallan adhityamamallan changed the title Truncate long activity names if flag is enabled Truncate long activity names May 23, 2025
@adhityamamallan adhityamamallan changed the title Truncate long activity names Allow truncating long activity names May 23, 2025
@adhityamamallan adhityamamallan marked this pull request as ready for review May 23, 2025 09:00
@adhityamamallan adhityamamallan requested a review from Copilot May 23, 2025 09:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds optional truncation of long activity names in the Workflow History view behind a config flag, with full names available via tooltip, and tightens up the Export JSON button styling.

  • Introduce a new fullName field and wrap labels in a tooltip component when shortening is enabled
  • Update the activity-group helper to cut names after the last . or / based on WORKFLOW_HISTORY_SHOULD_SHORTEN_GROUP_LABELS_CONFIG
  • Refactor WorkflowHistoryExportJsonButton to avoid passing a boolean to endEnhancer

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/views/workflow-history/helpers/get-history-group-from-events/get-activity-group-from-events.ts Add fullName, conditional short/long label logic, import config
src/views/workflow-history/config/workflow-history-should-shorten-group-labels.config.ts New config flag definition
src/views/workflow-history/workflow-history-group-label/* New component and types to render label with optional tooltip
src/views/workflow-history/workflow-history-timeline-group/* and compact-event-card/* Propagate and render fullName via new WorkflowHistoryGroupLabel
src/views/workflow-history/workflow-history-export-json-button/workflow-history-export-json-button.tsx Refactor conditional endEnhancer prop
+ tests in corresponding __tests__ folders Updated mocks and new tests for grouping logic
Comments suppressed due to low confidence (2)

src/views/workflow-history/helpers/get-history-group-from-events/tests/get-activity-group-from-events.test.ts:20

  • The mock path uses the @/views/... alias but the code imports the config via a relative path (../../config/...). This mismatch prevents Jest from mocking the module. Update the mock to use the same relative import specifier (e.g. jest.mock('../../config/workflow-history-should-shorten-group-labels.config', ...)) so the mock takes effect.
jest.mock('@/views/workflow-history/config/workflow-history-should-shorten-group-labels.config',

src/views/workflow-history/helpers/get-history-group-from-events/get-activity-group-from-events.ts:51

  • [nitpick] There are tests for shortened vs. full label, but none checking that fullName is correctly set or omitted. Consider adding a unit test to verify fullName is populated when shortening is enabled and remains undefined when disabled.
if (WORKFLOW_HISTORY_SHOULD_SHORTEN_GROUP_LABELS_CONFIG) {

@Assem-Uber Assem-Uber merged commit c51031a into cadence-workflow:master May 26, 2025
1 check passed
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.

3 participants