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

[Security Solution] Integrate Vanilla Unified Data Table in Timeline #176064

Merged
merged 76 commits into from
Apr 2, 2024

Conversation

michaelolo24
Copy link
Contributor

@michaelolo24 michaelolo24 commented Feb 1, 2024

Fixes below issues

Details

Objective

The objective of this PR is to implement basic unified data table replacing the current timeline table. It is intended to behave exactly like discover table. Below are the functionalities of the timeline table that are out of scope of this PR and will be included in the follow up PR.

Before After
after_timeline_unified.mov
before_timeline_unified.mov

This feature can be enabled with below feature flag:

xpack.securitySolution.enableExperimental:
  - unifiedComponentsInTimelineEnabled

Out of scope functionalities

Desk Testing Guide

Below are some areas which have changes and would warrant some desk testing.

One pre-requisite is to enable feature flag unifiedComponentsInTimelineEnabled which will replace traditional timeline table with the new unified timeline table.

  1. Pagination
    • If total number of events are > sample size ( default 500 ), table footer on last page should display the notification so that user can Load More on-demand.
    • Page changes should be instant, because it is just client-side pagination where we download multiple pages ( 500 events ) at once.
  2. Flyouts
    • Event Detail ( Open / Close ) - should be new old Expandable flyout - ( New Expandable fl
    • Host / User / IP details flyout ( Open / Close)
  3. Unified List
    • Add column by dragging & by clicking ⨁ control.
    • Remove columns by clicking on column header & by clicking on ❌ control
    • grafik
    • grafik
  4. Full screen mode
  5. Last updated date
  6. Columns Order
    • Change columns order from table controls
  7. Sort Order
    • timestamp
    • Any number column
    • Any string column
  8. Column Actions
    • Move Right/Left
    • Sort Asc/Desc
    • Copy Column and Column Name
    • Edit Data View Field with custom label
  9. Table Control - Display Options
    • image
    • Try different row heights and Sample sizes.

Current Observations of Unified table vis-a-vis discover UI + Issues

  • Discover has custom UI on toolbar visibility when compared to vanilla unified data table
  • Full screen behaviour of unified data table
  • column width calculation is not automatic.
    • Unsaved Timeline
    • Saved Timeline
  • Host/Network Flyout is not opening when timeline is not saved
    • Flyout is not closing after it has been opened
  • Row highlighting for building block -> Will be covered with Actions Column
  • Additional Controls
    • Row Renderer Selection
    • Last updated Date
    • Full Screen
  • Table controls tab order
  • Refactor singleton ActiveTimeline class ( Inform @PhilippeOberti )
  • Total Count not visible

Checklist

Delete any items that are not applicable to this PR.

@michaelolo24 michaelolo24 force-pushed the integrate-unified-data-table-1 branch from 2a6c95c to 258ed5d Compare February 1, 2024 13:21
@logeekal logeekal changed the title Integrate unified data table 1 [Security Solution] Integrate Vanilla Unified Data Table in Timeline Feb 9, 2024
updatedAt: number;
}

export const FixedWidthLastUpdatedContainer = React.memo<FixedWidthLastUpdatedContainerProps>(
Copy link
Contributor

@logeekal logeekal Feb 15, 2024

Choose a reason for hiding this comment

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

Reminder for @logeekal : need to check why is this needed when there is a last updated component already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YulNaumenko do you remember?

Copy link
Contributor

Choose a reason for hiding this comment

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

Separated out and deduped last updated component. This is the final one with tests : https://github.com/elastic/kibana/pull/176064/files#diff-36743070b5744453188c3858a3869fa054832cba119926b371108f818cb01a77

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is the commit : 4c8fe91

@logeekal logeekal self-assigned this Feb 20, 2024
@logeekal logeekal added Team:Threat Hunting:Investigations Security Solution Investigations Team 8.14 candidate release_note:skip Skip the PR/issue when compiling release notes labels Feb 20, 2024
@logeekal logeekal added the backport:skip This commit does not require backporting label Feb 20, 2024
@logeekal logeekal marked this pull request as ready for review February 21, 2024 06:52
@logeekal logeekal requested a review from a team as a code owner February 21, 2024 06:52
@@ -37,6 +37,12 @@ describe(
{ product_line: 'security', product_tier: 'essentials' },
{ product_line: 'endpoint', product_tier: 'essentials' },
],
// alertSuppressionForIndicatorMatchRuleEnabled feature flag is also enabled in a global config
kbnServerArgs: [
Copy link
Member

Choose a reason for hiding this comment

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

Why the feature flag has been added globally? We should add FF at the beginning of the spec file.

Copy link
Contributor

Choose a reason for hiding this comment

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

It must be a merge issue. Let me check.. I did not touch this file.

Copy link
Contributor

@logeekal logeekal Mar 28, 2024

Choose a reason for hiding this comment

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

This was added as part of this PR. I think while resolving merge conflicts some issue happenned. I will just correct this in accordance with main. Additionally, I could not find this flag in global config.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MadameSheema , I have restored this file according to main.

context('flyout', () => {
it('should be able to open/close details details/host/user flyout', () => {
cy.log('Event Details Flyout');
openEventDetailsFlyout(0);
Copy link
Member

Choose a reason for hiding this comment

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

the assertion you are doing in the openEventDetailsFlyout I'll add it here to make more visible what is happening, if not seems that we are doing a test without assertions :)

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed here: 84fe0fb

@@ -112,6 +112,10 @@ export const addFieldToTable = (fieldId: string) => {
clearFieldSearch();
};

export const removeFieldFromTable = (fieldId: string) => {
cy.get(GET_DISCOVER_COLUMN_TOGGLE_BTN(fieldId)).first().trigger('click');
Copy link
Member

Choose a reason for hiding this comment

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

Why are we using .trigger('click') instead of click()?

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed here: 84fe0fb

Copy link
Member

@MadameSheema MadameSheema left a comment

Choose a reason for hiding this comment

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

Lots of thanks for addressing all the comments! :)

@logeekal logeekal enabled auto-merge (squash) March 28, 2024 14:44
@@ -254,13 +251,21 @@ export const getTimelineStatus = (
export const defaultTimelineToTimelineModel = (
timeline: TimelineResult,
duplicate: boolean,
timelineType?: TimelineType
timelineType?: TimelineType,
unifiedComponentsInTimelineEnabled?: boolean
Copy link
Contributor

@semd semd Mar 28, 2024

Choose a reason for hiding this comment

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

The current approach forces many components to retrieve this value using useIsExperimentalFeatureEnabled to pass it to this function.

Wouldn't it be easier to use ExperimentalFeaturesService singleton inside this file, instead of receiving this value by parameter? It would simplify the cleaning when we remove this flag too.

Copy link
Contributor

Choose a reason for hiding this comment

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

@semd , I did not even know that it existed. I agree with you but I have three more upcoming PRs for this functionality. Do you mind, if I do that change in next PR ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes sure, it's just a simplification, and also to reduce the scope of the changes. But if you keep it this way it's also fine, as you prefer 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I will have to check the Singleton class API but I will make changes accordingly in the next PR.

I would be glad as well if I could remove this extra param from everywhere.

@semd
Copy link
Contributor

semd commented Mar 28, 2024

securitySolution 16.6MB 17.0MB ⚠️ +459.0KB

I hope we go back to previous sizes when we clean the old version.

Thanks for doing these changes, looks great 💯

@michaelolo24
Copy link
Contributor Author

/ci

@michaelolo24
Copy link
Contributor Author

/ci

1 similar comment
@michaelolo24
Copy link
Contributor Author

/ci

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 5042 5287 +245

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
securitySolution 122 124 +2

Async chunks

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

id before after diff
cloudSecurityPosture 401.3KB 401.3KB +84.0B
discover 590.3KB 590.4KB +166.0B
logsExplorer 1.1MB 1.1MB +4.0B
securitySolution 16.6MB 17.0MB ⚠️ +459.0KB
slo 610.4KB 610.5KB +144.0B
total +459.4KB

Page load bundle

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

id before after diff
securitySolution 72.8KB 73.3KB +518.0B
Unknown metric groups

API count

id before after diff
@kbn/unified-data-table 143 144 +1
securitySolution 193 195 +2
total +3

async chunk count

id before after diff
securitySolution 57 66 +9

ESLint disabled line counts

id before after diff
securitySolution 490 495 +5

References to deprecated APIs

id before after diff
securitySolution 531 533 +2

Total ESLint disabled count

id before after diff
securitySolution 566 571 +5

History

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

cc @logeekal

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

Here are a few observations:

  • in the PR description, we say that this PR fixes this ticket but looking at the tasks on that ticket, a lot of them aren't actually covered by this PR. We should maybe remove the link to the ticket so it doesn't confuse PR later?
  • PR description point 2: the expandable flyout isn't opening, even when using the expandableTimelineFlyoutEnabled flag. This is valid for the document details, host and user flyouts. For all of them, only the old flyout opens (but it does open on top of timeline instead of within the timeline modal along side the table so that's good)
  • there is a weird blinking happening when removing a column. Also I wonder why we fetch the data on removing columns, it's not like we need new data...
    https://github.com/elastic/kibana/assets/17276605/5fb47ce8-a536-4ea3-b915-6217ab49bbd6
  • PR description point 3: I'm confused about that the + and x buttons are?
  • I'm wondering why we trigger a fetch for the data when we move a column around. It's not like we need any new information?
  • Same thing for the column sorting. Are we fetching different data that the 500 (or whatever selected in the table control display option) or just sorting the data in the frontend?
  • It seems that sorting by @timestamp isn't working. Other columns seem to be working fine
    https://github.com/elastic/kibana/assets/17276605/fbca15a3-3212-4a97-bbb1-0ad38b510d84

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

Approving for the Threat Hunting Investigations team, as all the points are raised will be tackled in a subsequent PR (see issue)

@logeekal logeekal merged commit 883beee into elastic:main Apr 2, 2024
34 checks passed
@PhilippeOberti
Copy link
Contributor

@logeekal @michaelolo24 I think it would be nice to update the PR description to really reflect what the code in this PR does, and what it does now. I raised a few points in my last comment, but I think having the PR description as reflective of the code as possible will be beneficiary if we come back to this one day.

@logeekal
Copy link
Contributor

logeekal commented Apr 2, 2024

PR description point 3: I'm confused about that the + and x buttons are?

Below is + and X icons in unified field list

grafik
grafik

PhilippeOberti pushed a commit that referenced this pull request Apr 8, 2024
## Summary

This PR cleans up a bit of the code around timeline tabs. It de-dupes
the layout components and some of the shared functionality between the
tabs. I would also like to move the tabs from using the `connector`
pattern to using `useSelector`, but that'll be done in a follow up PR.
The commit history unfortunately pulls in a bit from [this
pr](#176064), but the 2 commits
for the actual files changed in this PR are as follows:

1. (No code changes, just moving files) Moving the tabs into a nested
tabs folder:
89fa2d8

2. (Actual Code Changes) De-duping the shared components:
c6eecdb

3. (No code changes, moving filed and renaming) Removed the `_content`
parts of the folder names, and moved the `tabs_content` files into the
`tabs` folder:
ec3b959

---------

Co-authored-by: Jatin Kathuria <jatin.kathuria@elastic.co>
Co-authored-by: Kibana Machine <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
8.14 candidate backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:Threat Hunting:Investigations Security Solution Investigations Team v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.