-
Notifications
You must be signed in to change notification settings - Fork 124
Show Active Cluster Selection Policy on Workflow Summary page #1006
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
Merged
adhityamamallan
merged 6 commits into
cadence-workflow:master
from
adhityamamallan:active-cluster-policy-summary
Sep 3, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0418c96
Add active cluster selection policy
adhityamamallan d6b4130
Add active cluster selection policy to workflow summary page
adhityamamallan a671ccc
Remove unnecessary type casting from test case
adhityamamallan 742649b
Merge branch 'master' into active-cluster-policy-summary
adhityamamallan 8661fe4
Merge branch 'master' into active-cluster-policy-summary
adhityamamallan 83b3f64
Merge branch 'master' into active-cluster-policy-summary
adhityamamallan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/views/workflow-summary/__fixtures__/formatted-first-history-event.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import formatWorkflowHistoryEvent from '@/utils/data-formatters/format-workflow-history-event'; | ||
| import { startWorkflowExecutionEvent } from '@/views/workflow-history/__fixtures__/workflow-history-single-events'; | ||
|
|
||
| import { type FormattedFirstHistoryEvent } from '../workflow-summary-details/workflow-summary-details.types'; | ||
|
|
||
| export const mockFormattedFirstEvent = formatWorkflowHistoryEvent( | ||
| startWorkflowExecutionEvent | ||
| ) as FormattedFirstHistoryEvent; |
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
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
60 changes: 60 additions & 0 deletions
60
...ry/workflow-summary-details/helpers/__tests__/get-active-cluster-selection-policy.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { type ActiveClusterSelectionPolicy } from '@/__generated__/proto-ts/uber/cadence/api/v1/ActiveClusterSelectionPolicy'; | ||
| import { mockDescribeWorkflowResponse } from '@/views/workflow-page/__fixtures__/describe-workflow-response'; | ||
| import { mockFormattedFirstEvent } from '@/views/workflow-summary/__fixtures__/formatted-first-history-event'; | ||
|
|
||
| import getActiveClusterSelectionPolicy from '../get-active-cluster-selection-policy'; | ||
|
|
||
| const mockRegionStickyPolicy: ActiveClusterSelectionPolicy = { | ||
| strategyConfig: 'activeClusterStickyRegionConfig', | ||
| strategy: 'ACTIVE_CLUSTER_SELECTION_STRATEGY_REGION_STICKY', | ||
| activeClusterStickyRegionConfig: { | ||
| stickyRegion: 'us-west-1', | ||
| }, | ||
| }; | ||
|
|
||
| const mockExternalEntityPolicy: ActiveClusterSelectionPolicy = { | ||
| strategyConfig: 'activeClusterExternalEntityConfig', | ||
| strategy: 'ACTIVE_CLUSTER_SELECTION_STRATEGY_EXTERNAL_ENTITY', | ||
| activeClusterExternalEntityConfig: { | ||
| externalEntityType: 'customer', | ||
| externalEntityKey: 'customer-123', | ||
| }, | ||
| }; | ||
|
|
||
| describe(getActiveClusterSelectionPolicy.name, () => { | ||
| it('returns policy from workflowDetails when available', () => { | ||
| const result = getActiveClusterSelectionPolicy({ | ||
| workflowDetails: { | ||
| ...mockDescribeWorkflowResponse, | ||
| workflowExecutionInfo: { | ||
| ...mockDescribeWorkflowResponse.workflowExecutionInfo, | ||
| activeClusterSelectionPolicy: mockRegionStickyPolicy, | ||
| }, | ||
| }, | ||
| formattedFirstEvent: mockFormattedFirstEvent, | ||
| }); | ||
|
|
||
| expect(result).toEqual(mockRegionStickyPolicy); | ||
| }); | ||
|
|
||
| it('returns policy from formattedFirstEvent when workflowDetails has no policy', () => { | ||
| const formattedFirstEvent = Object.assign({}, mockFormattedFirstEvent); | ||
| formattedFirstEvent.activeClusterSelectionPolicy = mockExternalEntityPolicy; | ||
|
|
||
| const result = getActiveClusterSelectionPolicy({ | ||
| workflowDetails: mockDescribeWorkflowResponse, | ||
| formattedFirstEvent, | ||
| }); | ||
|
|
||
| expect(result).toEqual(mockExternalEntityPolicy); | ||
| }); | ||
|
|
||
| it('returns null when no policy is available in either source', () => { | ||
| const result = getActiveClusterSelectionPolicy({ | ||
| workflowDetails: mockDescribeWorkflowResponse, | ||
| formattedFirstEvent: mockFormattedFirstEvent, | ||
| }); | ||
|
|
||
| expect(result).toBeNull(); | ||
| }); | ||
| }); |
17 changes: 17 additions & 0 deletions
17
.../workflow-summary/workflow-summary-details/helpers/get-active-cluster-selection-policy.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { type ActiveClusterSelectionPolicy } from '@/__generated__/proto-ts/uber/cadence/api/v1/ActiveClusterSelectionPolicy'; | ||
|
|
||
| import { type WorkflowSummaryFieldArgs } from '../workflow-summary-details.types'; | ||
|
|
||
| export default function getActiveClusterSelectionPolicy({ | ||
| workflowDetails, | ||
| formattedFirstEvent, | ||
| }: Pick< | ||
| WorkflowSummaryFieldArgs, | ||
| 'workflowDetails' | 'formattedFirstEvent' | ||
| >): ActiveClusterSelectionPolicy | null { | ||
| const policy = | ||
| workflowDetails.workflowExecutionInfo?.activeClusterSelectionPolicy || | ||
| formattedFirstEvent?.activeClusterSelectionPolicy; | ||
|
|
||
| return policy ?? null; | ||
| } |
7 changes: 7 additions & 0 deletions
7
src/views/workflow-summary/workflow-summary-details/workflow-summary-details.constants.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { type ActiveClusterSelectionStrategy } from '@/__generated__/proto-ts/uber/cadence/api/v1/ActiveClusterSelectionStrategy'; | ||
|
|
||
| export const ACTIVE_CLUSTER_SELECTION_STRATEGY_LABEL_MAP = { | ||
| ACTIVE_CLUSTER_SELECTION_STRATEGY_INVALID: 'Invalid', | ||
| ACTIVE_CLUSTER_SELECTION_STRATEGY_REGION_STICKY: 'Region Sticky', | ||
| ACTIVE_CLUSTER_SELECTION_STRATEGY_EXTERNAL_ENTITY: 'External Entity', | ||
| } as const satisfies Record<ActiveClusterSelectionStrategy, string>; |
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
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.
Uh oh!
There was an error while loading. Please reload this page.