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

Show middle state badges for running, starred and checked sub-rows #2004

Merged
merged 2 commits into from
Jul 18, 2022

Conversation

wolmir
Copy link
Contributor

@wolmir wolmir commented Jul 8, 2022

This PR will introduce indicators for the state of sub-rows in the experiments table.

There will an indicator for selected, starred and running sub-rows.

See #1714 for context on the issue.

Screen.Recording.2022-07-18.at.10.34.09.mov

@wolmir wolmir marked this pull request as ready for review July 11, 2022 19:33
@wolmir wolmir requested review from maxagin and shcheklein July 11, 2022 20:05
@wolmir wolmir added the product PR that affects product label Jul 11, 2022
@mattseddon
Copy link
Member

[Q] Why are we not showing the middle state for experiments that have been selected for plotting?

@wolmir
Copy link
Contributor Author

wolmir commented Jul 11, 2022

[Q] Why are we not showing the middle state for experiments that have been selected for plotting?

I missed it, but it's a relatively simple change now. I can include them in this PR

)} ${actionAppliedLabel}.`
}
>
{children}
Copy link
Member

Choose a reason for hiding this comment

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

[I] At the moment only the direct children are being aggregated. Here is a screen recording of an example:

Screen.Recording.2022-07-12.at.8.30.37.pm.mov

When we aggregate from checkpoints to experiments and then up to the current commit we are not taking the cumulative total into account.

Another example:

Screen.Recording.2022-07-12.at.8.35.31.pm.mov

I would not even try to include the top level indicator until we have more than one commit/branch in the table. Until that time we will be catering to an edge case.

However, if you feel that they are needed then they need to reflect the totals including all children.

Copy link
Member

Choose a reason for hiding this comment

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

More complicated aggregation behaviour will also need some tests.

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'll add some tests for this current use-case now, but I want to defer this total aggregation for later if it's currently an edge case.

@wolmir wolmir force-pushed the middle-states-poc branch from 8d7c020 to 4a4e427 Compare July 12, 2022 14:43
@wolmir
Copy link
Contributor Author

wolmir commented Jul 12, 2022

I just added the plots indicator and will add some tests for all of them now

@wolmir wolmir force-pushed the middle-states-poc branch 3 times, most recently from 81af148 to c2fd5b1 Compare July 12, 2022 19:49
webview/src/test/tableDataFixture.ts Outdated Show resolved Hide resolved
webview/src/test/tableDataFixture.ts Show resolved Hide resolved
webview/src/test/tableDataFixture.ts Outdated Show resolved Hide resolved
webview/src/test/tableDataFixture.ts Show resolved Hide resolved
webview/src/test/tableDataFixture.ts Show resolved Hide resolved
@wolmir wolmir force-pushed the middle-states-poc branch from 614ff4a to 6f0e69f Compare July 12, 2022 20:47
@wolmir
Copy link
Contributor Author

wolmir commented Jul 12, 2022

This pull request will bring the total coverage in the repository to 96.6% (0.0% change).

It was 96.7% before I added more tests. Go figure

@wolmir wolmir requested a review from mattseddon July 12, 2022 22:17
@wolmir wolmir force-pushed the middle-states-poc branch from f8f8882 to bc9fb31 Compare July 13, 2022 16:40
@wolmir wolmir requested a review from julieg18 as a code owner July 13, 2022 16:40
@wolmir wolmir force-pushed the middle-states-poc branch from a6742b3 to 08b2e56 Compare July 14, 2022 14:50
@wolmir wolmir requested a review from mattseddon July 14, 2022 16:10
userEvent.click(collapseButtons()[1])
userEvent.click(collapseButtons()[2])
userEvent.click(collapseButtons()[3])
}
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 thought this warranted its own storybook story

selected: true
}))
}
export const setExperimentsAsRunning = setRowPropertyAsTrue('running')
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 added these helpers to remove some of the friction I had with adding new tests. Hopefully this will make it way easier to setup table data scenarios for new tests.

}
}

.bullet {
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 need to remove this, they are not used anymore

Copy link
Member

Choose a reason for hiding this comment

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

Please remove this before merging

@@ -672,3 +714,26 @@ $badge-size: 0.85rem;
.cellTooltip {
padding: 2px 6px;
}

.indicatorCount {
&[aria-label='0'] {
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 tried using only this style to not show the counter when the number is 0, because it would save a conditional test in the component and reduce its complexity.

It works on VSCode and Storybook, but for some reason these styles are not applied when running the jest tests.
So I kept the conditionals in the end.

subRows: experiment.subRows?.map(checkpoint => ({
...checkpoint,
running: checkpoint.running || checkpoint.label === '23250b3'
running: checkpoint.running || checkpoint.label === '23250b3',
starred: checkpoint.starred || checkpoint.label === '22e40e1'
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 can simplify this by using the helpers I mentioned above

Copy link
Member

Choose a reason for hiding this comment

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

👍🏻

Copy link
Member

@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.

Just one thing that I would recommend doing before you merge this. Adding an updated video in description would be handy for future reference too.

@@ -372,6 +373,129 @@ describe('App', () => {
})
})

describe('Sub-rows middle states indicators', () => {
const renderWithAllRowsExpanded = () => {
Copy link
Member

Choose a reason for hiding this comment

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

[I] A more central location for these util will be helpful.

Copy link
Member

Choose a reason for hiding this comment

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

Splitting out utils will help to start reducing the size of this file and would give a central location for people to look for test building blocks.

Copy link
Member

Choose a reason for hiding this comment

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

fine to create a separate PR for that

role={'marquee'}
aria-label={`${count ?? 0}`}
>
{count ?? 0}
Copy link
Member

Choose a reason for hiding this comment

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

[Q] How is ?? needed here when it can only be a truthy value?. Could you use a type guard here?

}
}

.bullet {
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this before merging

subRows: experiment.subRows?.map(checkpoint => ({
...checkpoint,
running: checkpoint.running || checkpoint.label === '23250b3'
running: checkpoint.running || checkpoint.label === '23250b3',
starred: checkpoint.starred || checkpoint.label === '22e40e1'
Copy link
Member

Choose a reason for hiding this comment

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

👍🏻

@wolmir wolmir force-pushed the middle-states-poc branch from 08b2e56 to 84d777c Compare July 18, 2022 13:42
@codeclimate
Copy link

codeclimate bot commented Jul 18, 2022

Code Climate has analyzed commit 84d777c and detected 0 issues on this pull request.

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

View more on Code Climate.

@wolmir wolmir merged commit 53f21f3 into main Jul 18, 2022
@wolmir wolmir deleted the middle-states-poc branch July 18, 2022 14:14
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.

2 participants