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

Sort and Filter indicators for the Experiments Table #1760

Merged
merged 10 commits into from
Jun 9, 2022

Conversation

wolmir
Copy link
Contributor

@wolmir wolmir commented May 24, 2022

Solves (#1708)

This PR adds sorting and filtering indicators in the form of icons to the experiments table headers.
It also changes the direction of the ellipsis truncation to left-side only and reduces the font-size of the leaf headers.

Specs

Figma

Resulting

Screen.Recording.2022-05-24.at.11.20.51.mov

@wolmir wolmir requested review from rogermparent, mattseddon, sroy3 and maxagin and removed request for rogermparent May 24, 2022 14:22
@wolmir wolmir self-assigned this May 24, 2022
@maxagin
Copy link
Contributor

maxagin commented May 24, 2022

@wolmir great job! Just a few comments:

  1. Let's have the arrow on the left side for the right aligned cell content and on right side for the left aligned (timestamp)
  2. Can we use an arrow/symbol from the SORT BY section?

Please let me know if you need an example. Thank you !

Super quick draft:
Screen Shot 2022-05-24 at 10 35 20 AM

@maxagin maxagin self-assigned this May 24, 2022
@wolmir wolmir force-pushed the exp-table-sort-by-left-click branch from 8ea80ba to a8e2eb3 Compare May 24, 2022 14:54
@maxagin
Copy link
Contributor

maxagin commented May 24, 2022

I have built a quick spec . Please see here and let me know if you have any comments.

@maxagin
Copy link
Contributor

maxagin commented May 24, 2022

@wolmir no animation when toggling. Thank you !

@wolmir wolmir force-pushed the exp-table-sort-by-left-click branch from a8e2eb3 to d0f37af Compare May 24, 2022 15:23
@maxagin maxagin removed their assignment May 24, 2022
Copy link
Contributor

@rogermparent rogermparent left a comment

Choose a reason for hiding this comment

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

Agreed with @maxagin's comments, but even as it is this is a good improvement!

@mattseddon mattseddon added the product PR that affects product label May 24, 2022
@shcheklein
Copy link
Member

@wolmir good stuff, thanks! 🙏

@maxagin
Copy link
Contributor

maxagin commented May 25, 2022

Hey @wolmir, just wanted to share with you my arguments in relation to the initial comments, sorry I was in rush to share feedback before you push :) , so will do it now:

Arrow on the left side for the right aligned cell content …

The main reason is that, when the symbol is on the right side (for right align content) it will push the text, which will create unwanted movement and the focus will be also on the text instead of just indicator, when the label is actually not changing.

Use an arrow/symbol from the SORT BY section

The symbol ↑ is more compact and better describes the direction. Same time the caret icon arrow is typically meant to indicate that an accordion will open.

No animation when toggling

It is natural to have animation for the caret icon arrow and this is exactly what you have created! However for the direction arrow, spin animation won’t really work. The direction arrow can use linear animation instead.

@wolmir
Copy link
Contributor Author

wolmir commented May 25, 2022

Hey @wolmir, just wanted to share with you my arguments in relation to the initial comments, sorry I was in rush to share feedback before you push :) , so will do it now:

Arrow on the left side for the right aligned cell content …

The main reason is that, when the symbol is on the right side (for right align content) it will push the text, which will create unwanted movement and the focus will be also on the text instead of just indicator, when the label is actually not changing.

Use an arrow/symbol from the SORT BY section

The symbol ↑ is more compact and better describes the direction. Same time the caret icon arrow is typically meant to indicate that an accordion will open.

No animation when toggling

It is natural to have animation for the caret icon arrow and this is exactly what you have created! However for the direction arrow, spin animation won’t really work. The direction arrow can use linear animation instead.

Thanks @maxagin !

@wolmir wolmir force-pushed the exp-table-sort-by-left-click branch from bffb6b1 to 94f1411 Compare May 30, 2022 17:48
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.

Thanks for doing this. I have left some feedback on the code. Definitely need to fix the on resize issue before we merge. Also need some. design feedback re: the icon not being visible.

@@ -24,6 +24,7 @@
"dependencies": {
"@tippyjs/react": "^4.2.6",
"@vscode/webview-ui-toolkit": "^1.0.0",
"@vscode/codicons": "^0.0.30",
Copy link
Contributor

Choose a reason for hiding this comment

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

[C] We now have this as a dependency here and as a dev dependency in the root package.

const DEFAULT_COLUMN_WIDTH = 75
const MINIMUM_COLUMN_WIDTH = 50
const DEFAULT_COLUMN_WIDTH = 100
const MINIMUM_COLUMN_WIDTH = 90
Copy link
Contributor

Choose a reason for hiding this comment

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

[I] There are a couple of issues here.

  1. The icon can still be hidden (not sure what to do about this cc @maxagin).
Screen.Recording.2022-05-31.at.8.54.34.am.mov
  1. On resize is causing the sort direction to change.
Screen.Recording.2022-05-31.at.8.52.01.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.

For 1. That is one of the reasons that the old style was so effective.

Copy link
Contributor

Choose a reason for hiding this comment

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

[Q] Can we revert to the previous style so that we can get this in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mattseddon By previous style do you mean the top and bottom borders?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. More of a question for @maxagin & @shcheklein.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something like this @mattseddon @shcheklein

Screen.Recording.2022-06-02.at.18.46.07.mov

Copy link
Member

Choose a reason for hiding this comment

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

@wolmir got it, I like it! :)

Copy link
Member

Choose a reason for hiding this comment

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

the whole column header should clickable though, right, I don't have to click the ... symbol?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's just for show

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screen Shot 2022-06-02 at 20 15 40

className={cx(
styles.sortIcon,
`codicon codicon-${
sortOrder === SortOrder.ASCENDING ? 'arrow-up' : 'arrow-down'
Copy link
Contributor

Choose a reason for hiding this comment

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

[C] There is some history here. The first time we came to add icons, @rogermparent, @sroy3 and myself all added them at roughly the same time. We came up with three different implementations. Which we then standardised to the current SVGR model. From talking to @sroy3 I think we did this because we had custom SVGs that we wanted to add to the webview(s). As this may no longer be the case we may want to change the approach but we will need to reflect that single method throughout the webview code. Please raise an issue to discuss and we can talk about it in the retro at the end of the week.

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 created one here: #1802

Copy link
Contributor

Choose a reason for hiding this comment

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

It could be a good thing to change it to classes later, it would be simpler to add new ones. Right now though, of all the "custom" icons, there is still the clock one that does not have its equivalent in codicons. Since the up and down arrows are already in the current implementation, changing this to use <Icon icon={sortOrder === SortOrder.ASCENDING ? AllIcons.UP_ARROW : AllIcons.DOWN_ARROW} /> should not be too complicated. We can review using the whole library later and use #1802 to decide what to do with the missing icon.

@rogermparent
Copy link
Contributor

I see there was recently some code added for filter indicators. It's great that you're tackling this, but I think it would be best to keep it in a separate, even if chained, PR considering this one is big and active enough as is.

@wolmir wolmir force-pushed the exp-table-sort-by-left-click branch from e0fc931 to c018383 Compare June 8, 2022 22:50
@mattseddon
Copy link
Contributor

mattseddon commented Jun 9, 2022

Everything seems to be working but I am now having issues with hot-reload of the table code in the webpack-dev-server:

image

Closing the webview, restarting the server and reloading the webview solves this issue. Looking into it now.

@mattseddon
Copy link
Contributor

Everything seems to be working but I am now having issues with hotreload of the table code in the webpack-dev-server:

image

Closing the webview, restarting the server and reloading the webview solves this issue. Looking into it now.

Seems a bit fixed:

Screen.Recording.2022-06-09.at.1.41.24.pm.mov

Let's keep an eye on it and adjust accordingly.

export enum SortOrderLabel {
ASCENDING = 'Sort Ascending',
DESCENDING = 'Sort Descending',
NONE = 'Remove Sort'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these could just go inside SortOrder instead and that would be one less enum.

content={menuContent}
disabled={menuDisabled || menuSuppressed}
onShow={() => {
return !column.isResizing
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this really need to be in a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, It was left over from when I was trying to make the left-click sort work. I believe it's not needed anymore

{
hidden: !hasFilter,
icon: AllIcons.LINES,
onClick: () => {},
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should set a property to have simple icons without actions. Currently there is a pointer cursor on the filter icon and it makes it seem as if clicking on it was going to do something and nothing happens.

type: MessageFromWebviewType.REMOVE_COLUMN_SORT
}
}
]}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we always show all options? If there is currently no sort, do we need to show "Remove Sort"? Same for when sorted ascending or descending. It does look fine now, I'm just genuinely curious about whether or not it'd be better to remove or keep options.

@rogermparent
Copy link
Contributor

I might be missing something, but nothing happens when I left-click a table header.

left-click-sort-not-working-demo.mp4

@wolmir
Copy link
Contributor Author

wolmir commented Jun 9, 2022

I might be missing something, but nothing happens when I left-click a table header.

left-click-sort-not-working-demo.mp4

Yes, that was scrapped for the moment. I'll update the PR title in a moment

@wolmir wolmir changed the title Left-click sorting in the experiment table headers Sort and Filter indicators for the Experiments Table Jun 9, 2022
@codeclimate
Copy link

codeclimate bot commented Jun 9, 2022

Code Climate has analyzed commit abeb4b8 and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Duplication 2

The test coverage on the diff in this pull request is 93.1% (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.

Copy link
Contributor

@rogermparent rogermparent left a comment

Choose a reason for hiding this comment

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

Sorry for the confusion! As far as adding indicators, I think this PR definitely fits the bill. Anything I could point out has already been pointed out before, but with the refactor of unnecessary onClick handlers I think we've crossed the threshold of mergeable.

@mattseddon mattseddon merged commit 4684af2 into main Jun 9, 2022
@mattseddon mattseddon deleted the exp-table-sort-by-left-click branch June 9, 2022 22:03
mattseddon added a commit that referenced this pull request Jun 10, 2022
* Add arrow sort indicators and filter indicators to columns

* Fix filters prop dependencies

* fix tests

* add filters to deeply nested storybook

* refactor table head for complexity

* fix dev server chaos

* Fix PR change requests

* Remove unnecessary click handlers

* Fix test imports

Co-authored-by: Matt Seddon <mattseddon@hotmail.com>
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.

6 participants