-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fix checkbox selection issues #1986
Conversation
Do we have somewhere documented list of the supported hotkeys? How the users will know about this option? |
I'll add the option to the context-menu as well What about showing the keyboard shortcut (Esc) in that option @maxagin ? |
Unselect selected + the keyboard shortcut (Esc) for the context menu. Good idea @wolmir I think! |
@maxagin I updated the video above with the menu option |
47e0607
to
18e908d
Compare
@maxagin https://code.visualstudio.com/docs/getstarted/keybindings |
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.
Have gone through and left some comments, IMO we will want to suppress the selection of checkpoints on collapsed experiments before merging:
Screen.Recording.2022-07-06.at.11.46.28.am.mov
|
||
const selectedRows = () => | ||
screen.queryAllByRole('row', { selected: true }) | ||
expect(selectedRows().length).toBe(4) |
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.
[N] I think you can use toHaveLength
here.
@@ -67,7 +70,8 @@ const getMultiSelectMenuOptions = (selectedRowsList: RowProp[]) => { | |||
.filter(value => value.row.depth === 1) | |||
.map(value => value.row.values.id) | |||
|
|||
const hideRemoveOption = removableRowIds.length !== selectedRowsList.length | |||
const hideRemoveOption = | |||
removableRowIds.length !== selectedRowsList.length || hasRunningExperiment |
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.
[C] IMO if one of the selected rows is removable we should offer the remove option and remove only the ones we can.
!hideVaryAndRun | ||
), | ||
withId( | ||
'Modify, Reset and Run', |
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.
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 reason being "Reset and Run" is the most likely candidate for the next action.
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.
Yes, that seems like a simple change
|
||
return [ | ||
withId( | ||
'Apply to Workspace', | ||
MessageFromWebviewType.APPLY_EXPERIMENT_TO_WORKSPACE, | ||
canApplyOrCreateBranch | ||
hideApplyAndCreateBranch |
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.
[Q] The name would suggest the logic has been reversed here (but it looks like the same condition). Was the name wrong before and the logic correct or has something else happened?
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.
Yes, because the property is called hidden
, so these are assertions that will hide the option when true. It was wrong before
withId( | ||
projectHasCheckpoints ? 'Modify and Resume' : 'Modify and Run', | ||
MessageFromWebviewType.VARY_EXPERIMENT_PARAMS_AND_RUN, | ||
!isNotCheckpoint, |
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.
[C] Might be easier to read if you change the condition to isCheckpoint
instead of the double negative.
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.
try and simplify this boolean logic wherever you can, it is getting pretty difficult to understand at first glance.
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.
I don't like it either, but I have a feeling this refactoring will take some time. I can tackle it in the next PR, if that's ok.
] | ||
} | ||
|
||
const getWorkspaceOptions = ( |
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.
[C] Doesn't appear that this only applies to the workspace.
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.
Thanks, I'll correct the name
@@ -139,29 +147,37 @@ export const Table: React.FC<TableProps & WithChanges> = ({ | |||
useClickOutside(tableRef, clickOutsideHandler) | |||
|
|||
const batchRowSelection = React.useCallback( |
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.
[Q] Can we further test this?
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.
Sure, I think I can add some more tests today
Thanks @mattseddon ! But my question was more related to how and when we decided to use the ESC. |
25eedbf
to
4aa3583
Compare
Code Climate has analyzed commit 40c4f56 and detected 7 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 100.0% (85% is the threshold). This pull request will bring the total coverage in the repository to 96.6% (0.0% change). View more on Code Climate. |
context-menu-esc-demo.mp4I think it'd be best to make the tooltips dismiss on esc (maybe even for all our interactive tooltips). I don't think it's a blocker but warrants a follow-up or an issue. |
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.
I think this comment is both important and simple enough to be considered before merging, but I don't see any other showstoppers right now. Nice work!
@wolmir good stuff! 😎 please create a housekeeping / followup ticket for the comments / improvements we need to address still. |
This PR will fix some issues with the current checkbox selection of rows in the experiments table.
It will also be possible to clear the selection with the Esc key.
Screen.Recording.2022-07-05.at.16.21.31.mov
TODO