-
Notifications
You must be signed in to change notification settings - Fork 33
feat: DH-19382: Add actions and timing info on console history hover #2526
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
Open
jnumainville
wants to merge
19
commits into
deephaven:main
Choose a base branch
from
jnumainville:19382_duration_tooltip
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a0b42e2
wip for refinement
jnumainville 5cccfaf
most functionality generally working
jnumainville 890fc3d
fixed tooltip
jnumainville 0974c71
working refactor
jnumainville 0c796d5
cleanup
jnumainville 185792f
refactoring and test fixes
jnumainville 722e417
fix problems
jnumainville 8dcd4b8
yet another refactor
jnumainville 1fa31f8
fix issues
jnumainville bdf308c
cleanup and test
jnumainville 737f413
new test fixes
jnumainville 8275dff
some review comments
jnumainville 36af036
fix comment
jnumainville 2ba12ef
some commments
jnumainville e79e0ce
remaining comments
jnumainville e63efd6
lint fixes
jnumainville 6122e9c
fix nullable
jnumainville ad0883f
comments
jnumainville 7ef0a27
fix bugs
jnumainville 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
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
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
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
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ import ConsoleHistoryResultInProgress from './ConsoleHistoryResultInProgress'; | |||||
| import ConsoleHistoryResultErrorMessage from './ConsoleHistoryResultErrorMessage'; | ||||||
| import './ConsoleHistoryItem.scss'; | ||||||
| import { type ConsoleHistoryActionItem } from './ConsoleHistoryTypes'; | ||||||
| import ConsoleHistoryItemActions from './ConsoleHistoryItemActions'; | ||||||
|
|
||||||
| const log = Log.module('ConsoleHistoryItem'); | ||||||
|
|
||||||
|
|
@@ -24,11 +25,16 @@ interface ConsoleHistoryItemProps { | |||||
| // eslint-disable-next-line react/no-unused-prop-types | ||||||
| supportsType: (type: string) => boolean; | ||||||
| iconForType: (type: string) => ReactElement; | ||||||
| onCommandSubmit: (command: string) => void; | ||||||
| } | ||||||
|
|
||||||
| interface ConsoleHistoryItemState { | ||||||
| isTooltipVisible: boolean; | ||||||
| } | ||||||
|
|
||||||
| class ConsoleHistoryItem extends PureComponent< | ||||||
| ConsoleHistoryItemProps, | ||||||
| Record<string, never> | ||||||
| ConsoleHistoryItemState | ||||||
| > { | ||||||
| static defaultProps = { | ||||||
| disabled: false, | ||||||
|
|
@@ -37,8 +43,13 @@ class ConsoleHistoryItem extends PureComponent< | |||||
| constructor(props: ConsoleHistoryItemProps) { | ||||||
| super(props); | ||||||
|
|
||||||
| this.state = { | ||||||
| isTooltipVisible: false, | ||||||
| }; | ||||||
|
|
||||||
| this.handleCancelClick = this.handleCancelClick.bind(this); | ||||||
| this.handleObjectClick = this.handleObjectClick.bind(this); | ||||||
| this.consoleHistoryItemClasses = this.consoleHistoryItemClasses.bind(this); | ||||||
| } | ||||||
|
|
||||||
| handleObjectClick(object: dh.ide.VariableDefinition): void { | ||||||
|
|
@@ -56,18 +67,35 @@ class ConsoleHistoryItem extends PureComponent< | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| consoleHistoryItemClasses(): string { | ||||||
| const { isTooltipVisible } = this.state; | ||||||
| const classes = ['console-history-item-command']; | ||||||
| // console history items should stay highlighted if the tooltip is opened | ||||||
| if (isTooltipVisible) { | ||||||
| classes.push('console-history-item-command-tooltip-active'); | ||||||
| } | ||||||
| return classes.join(' '); | ||||||
| } | ||||||
|
|
||||||
| render(): ReactElement { | ||||||
| const { disabled, item, language, iconForType } = this.props; | ||||||
| const { disabled, item, language, iconForType, onCommandSubmit } = | ||||||
| this.props; | ||||||
| const { disabledObjects, result } = item; | ||||||
| const hasCommand = item.command != null && item.command !== ''; | ||||||
|
|
||||||
| let commandElement = null; | ||||||
| if (hasCommand) { | ||||||
| commandElement = ( | ||||||
| <div className="console-history-item-command"> | ||||||
| <div className={this.consoleHistoryItemClasses()}> | ||||||
|
||||||
| <div className={this.consoleHistoryItemClasses()}> | |
| <div className={classNames('console-history-item-command', { 'console-history-item-command-tooltip-active': isTootipVisible })> |
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.
fixed
25 changes: 25 additions & 0 deletions
25
packages/console/src/console-history/ConsoleHistoryItemActions.test.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,25 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
| import userEvent from '@testing-library/user-event'; | ||
| import ConsoleHistoryItemActions from './ConsoleHistoryItemActions'; | ||
|
|
||
| describe('clicking calls functionality', () => { | ||
| const user = userEvent.setup(); | ||
| const handleCommandSubmit = jest.fn(); | ||
|
|
||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| return render( | ||
| <ConsoleHistoryItemActions | ||
| item={{ command: 'Test command' }} | ||
| onCommandSubmit={handleCommandSubmit} | ||
| handleTooltipVisible={jest.fn()} | ||
| /> | ||
| ); | ||
| }); | ||
|
|
||
| it('should render and rerun on click', async () => { | ||
| const button = screen.getAllByRole('button'); | ||
| await user.click(button[1]); | ||
| expect(handleCommandSubmit).toHaveBeenCalledTimes(1); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.