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

[UnifiedDocViewer] Redesign header and make actions responsive #173780

Merged
merged 32 commits into from
Jan 10, 2024

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented Dec 20, 2023

Summary

  • large screen and max 3 items => it will render an icon and a label for each action:
Screenshot 2024-01-03 at 18 02 23
  • otherwise: max 3 icons and the rest in a context menu:
Screenshot 2024-01-03 at 18 02 07
  • small screen: all items are in the context menu
Screenshot 2024-01-03 at 18 01 39

I also extended "Discover customization" example plugin to showcase more actions. For testing you can run kibana with yarn start --run-examples and update number of additional actions locally via https://github.com/jughosta/kibana/blob/690c38e689d8fb802cce8155c1a300f5ca9cb94f/examples/discover_customization_examples/public/plugin.tsx#L411

Checklist

@jughosta jughosta added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) Feature:UnifiedDocViewer Issues relating to the unified doc viewer component labels Dec 20, 2023
@jughosta jughosta self-assigned this Dec 20, 2023
@jughosta jughosta changed the title [UnifiedDocViewer] Responsive actions [UnifiedDocViewer] Redesign Actions to be responsive Dec 20, 2023
@jughosta
Copy link
Contributor Author

/ci

@jughosta
Copy link
Contributor Author

/ci

@jughosta
Copy link
Contributor Author

/ci

@jughosta jughosta marked this pull request as ready for review December 21, 2023 17:53
@jughosta jughosta requested a review from a team as a code owner December 21, 2023 17:53
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

Thanks @jughosta ! Sending some design feedback below:

  1. Show EuiTooltip with the action text for the icon-only version.
image
  1. These buttons should wrap instead of getting cutoff
image

title: 'Example custom flyout',
actions: {
getActionItems: () =>
Array.from({ length: 5 }, (_, i) => {
Copy link
Contributor Author

@jughosta jughosta Jan 3, 2024

Choose a reason for hiding this comment

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

You can update this number of extra items (2 default ones are always present) during testing to check how it works inside Discover Customization example plugin.

@jughosta jughosta changed the title [UnifiedDocViewer] Redesign Actions to be responsive [UnifiedDocViewer] Redesign header and make actions responsive Jan 3, 2024
@andreadelrio andreadelrio self-assigned this Jan 3, 2024
@andreadelrio andreadelrio self-requested a review January 3, 2024 20:18
Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

@jughosta Design changes LGTM! Thanks for addressing all the feedback. Amazing job here!

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Looks and works great! A nice improvement over the previous design which always bugged me when it overflowed on smaller screens. Just a minor bit of feedback about CMD + click not working for popover menu items, and a question about the removal of the surrounding documents help text.

My only other extremely minor nit is that the spacing on the fullscreen buttons look ever so slightly uneven to me. Personally I'd suggest making EuiButtonEmpty flush on both sides and bumping the flex gap to 12px to even out the spacing on fullscreen, but this is just me being nit picky and it's certainly not blocking 😅

Uneven (current):
uneven

Even:
even

Comment on lines -124 to -135
<EuiIconTip
content={i18n.translate('discover.grid.tableRow.viewSurroundingDocumentsHover', {
defaultMessage:
'Inspect documents that occurred before and after this document. Only pinned filters remain active in the Surrounding documents view.',
})}
type="questionInCircle"
color="subdued"
position="right"
iconProps={{
className: 'eui-alignTop',
}}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

With this PR we lose the help tooltip for surrounding documents, which might be worth preserving for new users. It was added in a dedicated PR #123890, so I'm guessing there was a reason/need for it, although there's no issue linked so it's not really clear why. Do you think it would be worth adding something like a helpText prop to FlyoutActionItem? Or maybe @andreadelrio has some input on this since she was around for the original PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andreadelrio Should we add the help icon back?

Copy link
Contributor

@andreadelrio andreadelrio Jan 10, 2024

Choose a reason for hiding this comment

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

Unfortunately, I don't have specific context for why this tooltip was added. @davismcphee how do you envision helpText prop working?

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries, figured it was worth a shot to ask. I was thinking the helpText prop would allow passing help text that would show the info icon next to the button, but I'm now realizing that might look out of place with the icon-only buttons. I'd be happy to merge this as is if no one feels strongly about the help icon, and maybe we could consider another way to present the information to users as a followup.

cc @kertal in case you have thoughts or context around the help icon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@davismcphee @andreadelrio

We could add it to tooltips:

Screenshot 2024-01-10 at 10 54 09 Screenshot 2024-01-10 at 10 53 59

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea, I hadn't thought of that 👍 This works for me if it seems all good to @andreadelrio on the design side.

Copy link
Member

Choose a reason for hiding this comment

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

Looking good, thx!

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't love this from a design point of view for the icon-only version but since this is an optional prop I think it should be ok.

}

export function DiscoverGridFlyoutActions({ flyoutActions }: DiscoverGridFlyoutActionsProps) {
const [isMoreFlyoutActionsPopoverOpen, setIsMoreFlyoutActionsPopover] = useState<boolean>(false);

This comment was marked as resolved.

key={action.id}
icon={action.iconType as EuiContextMenuItemIcon}
data-test-subj={action.dataTestSubj}
onClick={action.onClick}

This comment was marked as resolved.

Copy link
Contributor

@davismcphee davismcphee 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 the latest changes! My nitpicks are satisfied, and the only blocking issue IMO was the CMD + click which is now working. I'll leave @andreadelrio to decide if we still need the help icon, or maybe there's another way we could communicate this to users in a followup PR. So in that case, great work and LGTM 👍

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Just another quick review to test the help text popover, and it's working as intended 👍

jughosta and others added 2 commits January 10, 2024 19:59
…scover_grid_flyout_actions.tsx

Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
@jughosta jughosta enabled auto-merge (squash) January 10, 2024 19:21
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 689 690 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cloudSecurityPosture 413.6KB 413.3KB -240.0B
discover 556.3KB 557.7KB +1.4KB
total +1.1KB
Unknown metric groups

ESLint disabled line counts

id before after diff
discover 23 24 +1

Total ESLint disabled count

id before after diff
discover 23 24 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jughosta @andreadelrio

@jughosta jughosta merged commit 1181251 into elastic:main Jan 10, 2024
19 checks passed
@jughosta jughosta deleted the 163239-doc-viewer-actions branch January 10, 2024 20:46
delanni pushed a commit to delanni/kibana that referenced this pull request Jan 11, 2024
…ic#173780)

- Resolves elastic#163239
- Resolves elastic#164660
- Related PR elastic#173765

## Summary

- large screen and max 3 items => it will render an icon and a label for
each action:
<img width="500" alt="Screenshot 2024-01-03 at 18 02 23"
src="https://github.com/elastic/kibana/assets/1415710/f125a544-59c2-4ac9-aa87-9e72dd2c6deb">

- otherwise: max 3 icons and the rest in a context menu:
<img width="400" alt="Screenshot 2024-01-03 at 18 02 07"
src="https://github.com/elastic/kibana/assets/1415710/942b5cdb-2774-401a-9c68-daeb01b5d459">

- small screen: all items are in the context menu
<img width="678" alt="Screenshot 2024-01-03 at 18 01 39"
src="https://github.com/elastic/kibana/assets/1415710/52b9fb2a-b022-4a56-ad3c-e022b6876c0a">


I also extended "Discover customization" example plugin to showcase more
actions. For testing you can run kibana with `yarn start --run-examples`
and update number of additional actions locally via
https://github.com/jughosta/kibana/blob/690c38e689d8fb802cce8155c1a300f5ca9cb94f/examples/discover_customization_examples/public/plugin.tsx#L411

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…ic#173780)

- Resolves elastic#163239
- Resolves elastic#164660
- Related PR elastic#173765

## Summary

- large screen and max 3 items => it will render an icon and a label for
each action:
<img width="500" alt="Screenshot 2024-01-03 at 18 02 23"
src="https://github.com/elastic/kibana/assets/1415710/f125a544-59c2-4ac9-aa87-9e72dd2c6deb">

- otherwise: max 3 icons and the rest in a context menu:
<img width="400" alt="Screenshot 2024-01-03 at 18 02 07"
src="https://github.com/elastic/kibana/assets/1415710/942b5cdb-2774-401a-9c68-daeb01b5d459">

- small screen: all items are in the context menu
<img width="678" alt="Screenshot 2024-01-03 at 18 01 39"
src="https://github.com/elastic/kibana/assets/1415710/52b9fb2a-b022-4a56-ad3c-e022b6876c0a">


I also extended "Discover customization" example plugin to showcase more
actions. For testing you can run kibana with `yarn start --run-examples`
and update number of additional actions locally via
https://github.com/jughosta/kibana/blob/690c38e689d8fb802cce8155c1a300f5ca9cb94f/examples/discover_customization_examples/public/plugin.tsx#L411

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:UnifiedDocViewer Issues relating to the unified doc viewer component release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UnifiedDocViewer] Redesign Header Title [UnifiedDocViewer] Redesign Actions to be responsive
7 participants