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

[OneDiscover][Extension] DataTable Row Actions #188762

Merged
merged 54 commits into from
Aug 7, 2024

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented Jul 19, 2024

Summary

  • Extend UnifiedDataTable with a new rowAdditionalLeadingControls prop to render additional leading controls
  • In case of many actions, collapse the rest of them under "More" button
  • New OneDiscover extension
  • Convert from customControlColumnsConfiguration to the new prop. Refactor actions format in Log Explorer.
  • Swap the default "select" and "expand" control columns if custom row actions are specified
  • Add to example OneDiscover profile
  • Add functional and units tests
Screenshot 2024-07-26 at 16 00 17 Screenshot 2024-07-26 at 16 00 47

Testing

For testing the example profile:

  • add discover.experimental.enabledProfiles: ['example-root-profile', 'example-data-source-profile', 'example-document-profile'] to kibana.dev.yml
  • start kibana
  • make sure to have an index with my-example-logs name or create an alias to an existing index:
POST _aliases
{
  "actions": [
    {
      "add": {
        "index": "kibana_sample_data_logs",
        "alias": "my-example-logs"
      }
    }
  ]
}
  • create a data view for my-example-logs index

Follow up for Security solution

The following items would require deprecation/refactoring in components on Security Solution pages to have consistent UX (can result in 500+ lines of code changes):

Checklist

@jughosta jughosta added release_note:enhancement Feature:Discover Discover Application backport:skip This commit does not require backporting Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) Project:OneDiscover Enrich Discover with contextual awareness / Merge with Logs Explorer labels Jul 19, 2024
@jughosta jughosta self-assigned this Jul 19, 2024
@jughosta
Copy link
Contributor Author

/ci

@jughosta
Copy link
Contributor Author

/ci

@jughosta
Copy link
Contributor Author

/ci

@jughosta
Copy link
Contributor Author

/ci

@jughosta
Copy link
Contributor Author

/ci

@jughosta
Copy link
Contributor Author

jughosta commented Aug 1, 2024

Swapped the default row controls in this PR via 154eeac and closed #188908

@kertal
Copy link
Member

kertal commented Aug 1, 2024

Should we swap the default controls in this PR? I'm asking again as we are not continuing with #186808

I'd be ok with swapping them in this PR, but there were some concerns raised last time we planned to make changes to these controls. I think we should either get O11y and Security to confirm they're ok with it or make the change in a followup.

+1 one from my end, I also thing we should swap them in the PR, but raising awareness about this is a good strategy

asking here: #188908 (comment) we can of course discuss in the sync, in necessary

as discussed async and in sync, no objections to permanently swap the positions

@jughosta jughosta requested a review from a team as a code owner August 1, 2024 15:57
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.

Did a quick test of the latest changes to update control column order and it's working as expected, thanks! 🙏

Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

Update to embed mode screenshot test baseline LGTM 👍 I scanned the PR, and I think that is the only change owned by the @elastic/kibana-presentation team... For some reason the codeowners file filter isn't available 🙈

…extension

# Conflicts:
#	src/plugins/discover/public/context_awareness/profile_providers/example_data_source_profile/profile.tsx
#	src/plugins/discover/public/context_awareness/types.ts
Copy link
Contributor

@tonyghiani tonyghiani left a comment

Choose a reason for hiding this comment

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

Overall LGTM, although I noticed from the screenshot of the Logs Explorer in the description that the actions label disappeared from the column header.

Screenshot 2024-08-05 at 14 36 07

The question mark icon alone feels a bit off, is this made on purpose?

@jughosta
Copy link
Contributor Author

jughosta commented Aug 5, 2024

Hi @tonyghiani,
Thanks for the review!

The new actions are positioned each in its own grid control cell now. This allows for better keyboard navigation between them but yes, the header cell does not have enough space for the label now. Is it problematic if we drop it?

Copy link
Contributor

@logeekal logeekal 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 these changes. Left a question/comment regarding trailingControlColumn which I think should be not be deprected.

Use getRowIndicator prop on UnifiedDataTable instead of border-left style

This change is helpful. But I think it might conflict ( will have to test ) with Security solution's Event Renderers which needs color indicators in 2 lines for one row as shown below

grafik

Currently it is simply a css based border styling and in my opinion, making it a seperate cell, makes it somewhat difficult for us to add color to the extra Event Rendered row.

May i know what was reason it is not a style (eg, border-left) but a seperate cell?

export const getAdditionalRowControlColumns = (
rowControlColumns: RowControlColumn[]
): EuiDataGridControlColumn[] => {
if (rowControlColumns.length <= 2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It is a nit but Do we need a configuration on how many controls are visible? I will add @paulewing to this conversation because security uses 2 controls before shifting others in the popover menu.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The implementation is according to the provided design. For consistency, I would not introduce a custom configuration for items visible/hidden. We can still increase this number of visible actions as a follow up if becomes necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure. Thanks for your response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to clarify, here is the current design where we have space for 3 controls (including the default expand control):

Screenshot 2024-08-07 at 14 26 19 Screenshot 2024-08-07 at 14 26 45

normal = 'normal',
}

export const DataTableRowControl: React.FC<{ size?: Size }> = ({ size, children }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't size default to Size.normal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. I think for now it makes sense to apply a fixed size only for actions we provide via UnifiedDataTable and keep the default as it was before. In Security, there are larger control cells.

@tonyghiani
Copy link
Contributor

The new actions are positioned each in its own grid control cell now. This allows for better keyboard navigation between them but yes, the header cell does not have enough space for the label now. Is it problematic if we drop it?

Not a big problem, but only the icon feels a bit confusing, I'd rather say we go without any icon/header label at this point.

Copy link
Contributor

@tonyghiani tonyghiani left a comment

Choose a reason for hiding this comment

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

LGTM

@jughosta
Copy link
Contributor Author

jughosta commented Aug 6, 2024

Hi @logeekal,

Thanks for the review!

May i know what was reason it is not a style (eg, border-left) but a seperate cell?

There are several reasons:

  • border-left affects cells dimension and pushes the content to the side, it's noticeable on your screenshot too
  • for setting custom styles we would have to use rowClasses prop on EuiDataGrid. Defining this value would require iterating through all rows at once. From performance perspective, separate cell control allows to determine current row color only if row becomes visible when scrolling. So it scales better regardless how much data was fetched.
  • getRowIndicator provides a convenient way for consumers of UnifiedDataTable to dynamically assign colors to row indicators.

But I think it might conflict ( will have to test ) with Security solution's Event Renderers which needs color indicators in 2 lines for one row as shown below

Please let us know whether it would conflict or not. It might be possible to reuse ColorIndicatorCell as additional control on the second line or assign a border for the second line only. Also, Summary column could be more suitable when having a custom event renderer row. I don't see it being a blocker for this PR.

Copy link
Contributor

@logeekal logeekal left a comment

Choose a reason for hiding this comment

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

Thank you @jughosta for all the clarifications. PR Looks great and I have desk tested as well. As you already said that if at a later stage, changes are needed we can do so at that point.

@jughosta jughosta enabled auto-merge (squash) August 7, 2024 12:31
@logeekal
Copy link
Contributor

logeekal commented Aug 7, 2024

Please let us know whether it would conflict or not. It might be possible to reuse ColorIndicatorCell as additional control on the second line or assign a border for the second line only. Also, Summary column could be more suitable when having a custom event renderer row. I don't see it being a blocker for this PR.

Honestly, I do not know yet. But I think we can tackle it later if that problem arises. Thanks for explaining the reasoning.

@kibana-ci
Copy link
Collaborator

kibana-ci commented Aug 7, 2024

💚 Build Succeeded

  • Buildkite Build
  • Commit: e8f6fb8
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-188762-e8f6fb81871b

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cloudSecurityPosture 694 699 +5
discover 976 981 +5
esqlDataGrid 408 413 +5
lens 1495 1500 +5
logsExplorer 610 612 +2
securitySolution 5610 5615 +5
slo 889 894 +5
total +32

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/unified-data-table 81 92 +11

Async chunks

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

id before after diff
cloudSecurityPosture 464.4KB 467.2KB +2.8KB
discover 835.5KB 839.0KB +3.6KB
esqlDataGrid 122.5KB 125.2KB +2.8KB
logsExplorer 247.2KB 223.5KB -23.7KB
securitySolution 20.5MB 20.5MB +13.8KB
slo 908.8KB 911.6KB +2.8KB
total +1.9KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/unified-data-table 1 2 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
logsExplorer 28.2KB 27.7KB -455.0B
Unknown metric groups

API count

id before after diff
@kbn/unified-data-table 154 166 +12

async chunk count

id before after diff
logsExplorer 6 5 -1

References to deprecated APIs

id before after diff
cloudSecurityPosture 5 6 +1
securitySolution 473 474 +1
total +2

History

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

cc @jughosta

@jughosta jughosta merged commit 1c4b5c7 into elastic:main Aug 7, 2024
22 checks passed
tonyghiani added a commit that referenced this pull request Sep 11, 2024
## 📓 Summary

Closes #190457 

This change extracts the logic around the logs document
controls/indicator from Logs Explorer and registers the same controls in
Discover through the extension point added in #188762.

The controls are registered only for the `logs-data-source-profile`
contextual profile.


https://github.com/user-attachments/assets/40adfb19-357f-46e1-9d69-fc9c0860c832

## 👣 Next steps
- [ ] #190670
- [ ] #190460

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
gergoabraham pushed a commit to gergoabraham/kibana that referenced this pull request Sep 13, 2024
## 📓 Summary

Closes elastic#190457 

This change extracts the logic around the logs document
controls/indicator from Logs Explorer and registers the same controls in
Discover through the extension point added in elastic#188762.

The controls are registered only for the `logs-data-source-profile`
contextual profile.


https://github.com/user-attachments/assets/40adfb19-357f-46e1-9d69-fc9c0860c832

## 👣 Next steps
- [ ] elastic#190670
- [ ] elastic#190460

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
markov00 pushed a commit to markov00/kibana that referenced this pull request Sep 18, 2024
## 📓 Summary

Closes elastic#190457 

This change extracts the logic around the logs document
controls/indicator from Logs Explorer and registers the same controls in
Discover through the extension point added in elastic#188762.

The controls are registered only for the `logs-data-source-profile`
contextual profile.


https://github.com/user-attachments/assets/40adfb19-357f-46e1-9d69-fc9c0860c832

## 👣 Next steps
- [ ] elastic#190670
- [ ] elastic#190460

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.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 ci:project-deploy-observability Create an Observability project Feature:Discover Discover Application Project:OneDiscover Enrich Discover with contextual awareness / Merge with Logs Explorer release_note:enhancement Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.16.0
Projects
None yet