Skip to content
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

Implement checkbox selection #1964

Merged
merged 3 commits into from
Jul 3, 2022
Merged

Implement checkbox selection #1964

merged 3 commits into from
Jul 3, 2022

Conversation

wolmir
Copy link
Contributor

@wolmir wolmir commented Jul 1, 2022

#1924 and #1960

This PR will add checkboxes for row selection to the Experiments table webview.
It will also allow batch selection of rows by shift-clicking a range of them (see demo)

Screen.Recording.2022-06-30.at.17.48.50.mov

TODO

  • Add specific tests for the checkboxes and batch selection

@wolmir wolmir marked this pull request as ready for review July 1, 2022 04:29
@wolmir wolmir added the product PR that affects product label Jul 1, 2022
@wolmir wolmir requested review from rogermparent, sroy3, maxagin and shcheklein and removed request for sroy3 and rogermparent July 1, 2022 04:29
@wolmir
Copy link
Contributor Author

wolmir commented Jul 3, 2022

@rogermparent @mattseddon Can you take a look at this, please?

@codeclimate
Copy link

codeclimate bot commented Jul 3, 2022

Code Climate has analyzed commit d94de1d and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

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.5% (0.0% change).

View more on Code Climate.

Copy link
Contributor

@mattseddon mattseddon left a comment

Choose a reason for hiding this comment

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

A couple of items to follow up on. Will merge this now.

const toggleRowSelection = React.useCallback<HandlerFunc<HTMLElement>>(
args => {
if (!isWorkspace) {
if (args?.mouse?.shiftKey) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[Q] How do we implement the reverse? After doing a bulk selection I am unable to bulk unselect. Instead, I have to unclick every row manually.

Screen.Recording.2022-07-04.at.8.50.28.am.mov

Copy link
Contributor

Choose a reason for hiding this comment

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

I may be doing it wrong but I could not work it out.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, get some weird bulk select behavior when the row is collapsed:

Screen.Recording.2022-07-04.at.8.55.46.am.mov

For the first collapsed experiment the first checkpoint is selected and for the last experiment, no checkpoints are selected. I would expect none or all of the checkpoints to be selected when I perform this action. For our particular checkbox use case, I would expect none of the checkpoints to be selected.

Copy link
Contributor

Choose a reason for hiding this comment

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

[Q] How do we implement the reverse? After doing a bulk selection I am unable to bulk unselect. Instead, I have to unclick every row manually.

Good point. I have commented this here: #1924 (comment)

In the case of multiple selections, should not we have Unselect All option in the menu?

Copy link
Member

Choose a reason for hiding this comment

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

It can be Esc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the Esc option, it's the first key I tried to hit as well.

I discussed an idea with Matt yesterday, but I didn't like it in the end.

@@ -43,6 +50,7 @@ export const ExperimentGroup: React.FC<RowProp & InstanceProp> = ({
instance={instance}
contextMenuDisabled={contextMenuDisabled}
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we are still suppressing the full context menu whenever an experiment is running. Perhaps we need to now do this on an action-by-action basis as there is nothing to stop a user from "starring" multiple experiments on the fly whilst an experiment is running.

jest.advanceTimersByTime(100)
const menuitems = screen.getAllByRole('menuitem')
const itemLabels = menuitems.map(item => item.textContent)
expect(itemLabels).toContain('Star Experiments')
Copy link
Contributor

Choose a reason for hiding this comment

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

[C] Could click the button and check the correct message is fired here.

@mattseddon
Copy link
Contributor

I would also have at least one row selected and one row starred in the storybook for snapshot testing. You should be able to use the play functionality to achieve that.

@mattseddon mattseddon merged commit 31eafdd into main Jul 3, 2022
@mattseddon mattseddon deleted the checkbox-selection branch July 3, 2022 23:07
@wolmir wolmir mentioned this pull request Jul 5, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants