-
Notifications
You must be signed in to change notification settings - Fork 124
feat: Add buttons to toggle between legacy and new views in Workflow History #1133
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 10 commits into
cadence-workflow:master
from
adhityamamallan:history-v2-toggle-buttons
Jan 16, 2026
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7687468
Modify flag for history v2
adhityamamallan 0f43fec
changes to config value
adhityamamallan 36d8d77
Implement using local storage and restructure code
adhityamamallan cd73c76
Add docstring for hook
adhityamamallan 0dee3ce
add comment
adhityamamallan 207f6eb
Rename enabled hook to selected
adhityamamallan dfaa203
Base impl for toggle buttons
adhityamamallan f751b45
Fix mobile styles and update tooltip content
adhityamamallan 0c7f0ba
add unit tests
adhityamamallan 6f0b9b5
Use new flag
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
Base impl for toggle buttons
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
- Loading branch information
commit dfaa203be6d3b9e6c80630fed6a62c19fda439d9
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...workflow-history-v2/config/workflow-history-switch-to-v1-button-tooltip-content.config.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,24 @@ | ||
| import { MdOutlineChat } from 'react-icons/md'; | ||
|
|
||
| import { type ViewToggleTooltipContentConfig } from '../workflow-history-view-toggle-button/workflow-history-view-toggle-button.types'; | ||
|
|
||
| const workflowHistorySwitchToV1ButtonTooltipContentConfig: ViewToggleTooltipContentConfig = | ||
| { | ||
| content: [ | ||
| `The purpose of the new History view is to provide a more compact and | ||
| informative overview, including previews, flexible grouped and ungrouped | ||
| layouts, deeplinking, and several additional enhancements for | ||
| improved navigation and usability.`, | ||
| `Please feel free to share any feedback if you encounter anything | ||
| that seems suboptimal in the new History view.`, | ||
| ], | ||
| linkButtons: [ | ||
| { | ||
| label: 'Provide feedback', | ||
| startEnhancer: MdOutlineChat, | ||
| href: 'https://cloud-native.slack.com/archives/C09J2FQ7XU3', | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export default workflowHistorySwitchToV1ButtonTooltipContentConfig; | ||
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
26 changes: 26 additions & 0 deletions
26
...-history-v2/workflow-history-switch-to-v1-button/workflow-history-switch-to-v1-button.tsx
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,26 @@ | ||
| import { useContext } from 'react'; | ||
|
|
||
| import useConfigValue from '@/hooks/use-config-value/use-config-value'; | ||
| import { WorkflowHistoryContext } from '@/views/workflow-history/workflow-history-context-provider/workflow-history-context-provider'; | ||
|
|
||
| import workflowHistorySwitchToV1ButtonTooltipContentConfig from '../config/workflow-history-switch-to-v1-button-tooltip-content.config'; | ||
| import WorkflowHistoryViewToggleButton from '../workflow-history-view-toggle-button/workflow-history-view-toggle-button'; | ||
|
|
||
| export default function WorkflowHistorySwitchToV1Button() { | ||
| const { data: historyPageV2Config } = useConfigValue( | ||
| 'HISTORY_PAGE_V2_ENABLED' | ||
| ); | ||
|
|
||
| const { setIsWorkflowHistoryV2Enabled } = useContext(WorkflowHistoryContext); | ||
|
|
||
| if (historyPageV2Config === 'ENABLED') return null; | ||
|
|
||
| return ( | ||
| <WorkflowHistoryViewToggleButton | ||
| kind="secondary" | ||
| label="Switch to the legacy History view" | ||
| onClick={() => setIsWorkflowHistoryV2Enabled(false)} | ||
| tooltipContent={workflowHistorySwitchToV1ButtonTooltipContentConfig} | ||
| /> | ||
| ); | ||
| } |
76 changes: 76 additions & 0 deletions
76
...tory-v2/workflow-history-view-toggle-button/workflow-history-view-toggle-button.styles.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,76 @@ | ||
| import { type Theme, styled as createStyled } from 'baseui'; | ||
| import { type ButtonOverrides } from 'baseui/button'; | ||
| import { type PopoverOverrides } from 'baseui/popover'; | ||
| import { type StyleObject } from 'styletron-react'; | ||
|
|
||
| export const styled = { | ||
| TooltipContentContainer: createStyled('div', ({ $theme }) => ({ | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| alignItems: 'stretch', | ||
| rowGap: $theme.sizing.scale600, | ||
| padding: $theme.sizing.scale600, | ||
| })), | ||
| TooltipText: createStyled('div', ({ $theme }) => ({ | ||
| ...$theme.typography.ParagraphXSmall, | ||
| lineHeight: '16px', | ||
| })), | ||
| TooltipLinkButtons: createStyled('div', ({ $theme }) => ({ | ||
| display: 'flex', | ||
| flexDirection: 'row', | ||
| columnGap: $theme.sizing.scale300, | ||
| })), | ||
| }; | ||
|
|
||
| export const overrides = { | ||
| buttonPrimary: { | ||
| BaseButton: { | ||
| style: ({ $theme }: { $theme: Theme }): StyleObject => ({ | ||
| height: $theme.sizing.scale900, | ||
| padding: $theme.sizing.scale300, | ||
| color: $theme.colors.contentInversePrimary, | ||
| backgroundColor: $theme.colors.backgroundAccent, | ||
| ':hover': { | ||
| backgroundColor: $theme.colors.accent500, | ||
| }, | ||
| ':active': { | ||
| backgroundColor: $theme.colors.accent500, | ||
| }, | ||
| }), | ||
| }, | ||
| } satisfies ButtonOverrides, | ||
| buttonSecondary: { | ||
| BaseButton: { | ||
| style: ({ $theme }: { $theme: Theme }): StyleObject => ({ | ||
| height: $theme.sizing.scale900, | ||
| padding: $theme.sizing.scale300, | ||
| color: $theme.colors.contentAccent, | ||
| backgroundColor: $theme.colors.backgroundAccentLight, | ||
| ':hover': { | ||
| backgroundColor: $theme.colors.accent100, | ||
| }, | ||
| ':active': { | ||
| backgroundColor: $theme.colors.accent100, | ||
| }, | ||
| }), | ||
| }, | ||
| } satisfies ButtonOverrides, | ||
| popover: { | ||
| Body: { | ||
| style: ({ $theme }) => ({ | ||
| margin: $theme.sizing.scale600, | ||
| }), | ||
| }, | ||
| Inner: { | ||
| style: ({ $theme }: { $theme: Theme }): StyleObject => ({ | ||
| backgroundColor: $theme.colors.backgroundPrimary, | ||
| maxWidth: '400px', | ||
| }), | ||
| }, | ||
| Arrow: { | ||
| style: ({ $theme }: { $theme: Theme }): StyleObject => ({ | ||
| backgroundColor: $theme.colors.backgroundPrimary, | ||
| }), | ||
| }, | ||
| } satisfies PopoverOverrides, | ||
| }; |
72 changes: 72 additions & 0 deletions
72
...ow-history-v2/workflow-history-view-toggle-button/workflow-history-view-toggle-button.tsx
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,72 @@ | ||
| import { Button } from 'baseui/button'; | ||
| import { StatefulPopover } from 'baseui/popover'; | ||
| import Link from 'next/link'; | ||
| import { MdOutlineInfo } from 'react-icons/md'; | ||
|
|
||
| import { | ||
| overrides, | ||
| styled, | ||
| } from './workflow-history-view-toggle-button.styles'; | ||
| import { type Props } from './workflow-history-view-toggle-button.types'; | ||
|
|
||
| export default function WorkflowHistoryViewToggleButton({ | ||
| kind, | ||
| label, | ||
| onClick, | ||
| tooltipContent, | ||
| }: Props) { | ||
| const { content, linkButtons } = tooltipContent; | ||
|
|
||
| return ( | ||
| <StatefulPopover | ||
| content={() => ( | ||
| <styled.TooltipContentContainer> | ||
| {content.map((paragraph, index) => ( | ||
| <styled.TooltipText key={`tooltip_paragraph_${index}`}> | ||
| {paragraph} | ||
| </styled.TooltipText> | ||
| ))} | ||
| {linkButtons && linkButtons.length > 0 && ( | ||
| <styled.TooltipLinkButtons> | ||
| {linkButtons.map(({ label, href, startEnhancer }) => ( | ||
| <Button | ||
| key={label} | ||
| size="mini" | ||
| kind="secondary" | ||
| $as={Link} | ||
| href={href} | ||
| target="_blank" | ||
| rel="noreferrer" | ||
| startEnhancer={startEnhancer} | ||
| > | ||
| {label} | ||
| </Button> | ||
| ))} | ||
| </styled.TooltipLinkButtons> | ||
| )} | ||
| </styled.TooltipContentContainer> | ||
| )} | ||
| placement="auto" | ||
| accessibilityType="tooltip" | ||
| triggerType="hover" | ||
| showArrow | ||
| popoverMargin={4} | ||
| overrides={overrides.popover} | ||
| > | ||
| <div> | ||
| <Button | ||
| size="compact" | ||
| onClick={onClick} | ||
| overrides={ | ||
| kind === 'primary' | ||
| ? overrides.buttonPrimary | ||
| : overrides.buttonSecondary | ||
| } | ||
| endEnhancer={<MdOutlineInfo size={16} />} | ||
| > | ||
| {label} | ||
| </Button> | ||
| </div> | ||
| </StatefulPopover> | ||
| ); | ||
| } |
17 changes: 17 additions & 0 deletions
17
...story-v2/workflow-history-view-toggle-button/workflow-history-view-toggle-button.types.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 ButtonProps } from 'baseui/button'; | ||
|
|
||
| export type ViewToggleTooltipContentConfig = { | ||
| content: Array<string>; | ||
| linkButtons?: Array<{ | ||
| label: string; | ||
| href: string; | ||
| startEnhancer: ButtonProps['startEnhancer']; | ||
| }>; | ||
| }; | ||
|
|
||
| export type Props = { | ||
| kind: 'primary' | 'secondary'; | ||
| label: string; | ||
| onClick: () => void; | ||
| tooltipContent: ViewToggleTooltipContentConfig; | ||
| }; |
13 changes: 13 additions & 0 deletions
13
...ws/workflow-history/config/workflow-history-switch-to-v2-button-tooltip-content.config.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,13 @@ | ||
| import { type ViewToggleTooltipContentConfig } from '@/views/workflow-history-v2/workflow-history-view-toggle-button/workflow-history-view-toggle-button.types'; | ||
|
|
||
| const workflowHistorySwitchToV2ButtonTooltipContentConfig: ViewToggleTooltipContentConfig = | ||
| { | ||
| content: [ | ||
| `The new Workflow History UI provides a more compact and informative | ||
| overview of your workflow's history, with several enhancements for | ||
| improved navigation and usability.`, | ||
| `Click to try it out!`, | ||
| ], | ||
| }; | ||
|
|
||
| export default workflowHistorySwitchToV2ButtonTooltipContentConfig; |
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
26 changes: 26 additions & 0 deletions
26
...low-history/workflow-history-switch-to-v2-button/workflow-history-switch-to-v2-button.tsx
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,26 @@ | ||
| import { useContext } from 'react'; | ||
|
|
||
| import useConfigValue from '@/hooks/use-config-value/use-config-value'; | ||
| import WorkflowHistoryViewToggleButton from '@/views/workflow-history-v2/workflow-history-view-toggle-button/workflow-history-view-toggle-button'; | ||
|
|
||
| import workflowHistorySwitchToV2ButtonTooltipContentConfig from '../config/workflow-history-switch-to-v2-button-tooltip-content.config'; | ||
| import { WorkflowHistoryContext } from '../workflow-history-context-provider/workflow-history-context-provider'; | ||
|
|
||
| export default function WorkflowHistorySwitchToV2Button() { | ||
| const { data: historyPageV2Config } = useConfigValue( | ||
| 'HISTORY_PAGE_V2_ENABLED' | ||
| ); | ||
|
|
||
| const { setIsWorkflowHistoryV2Enabled } = useContext(WorkflowHistoryContext); | ||
|
|
||
| if (historyPageV2Config === 'DISABLED') return null; | ||
|
|
||
| return ( | ||
| <WorkflowHistoryViewToggleButton | ||
| kind="primary" | ||
| label="Switch to the new History view" | ||
| onClick={() => setIsWorkflowHistoryV2Enabled(true)} | ||
| tooltipContent={workflowHistorySwitchToV2ButtonTooltipContentConfig} | ||
| /> | ||
| ); | ||
| } |
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.
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.
The tooltip content contains excessive leading whitespace. Consider using a template literal without indentation or using array join to maintain clean formatting without extra whitespace.