-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SecuritySolutions] Update CellActions to support all types used by Discover #160524
Conversation
396b129
to
31c4e8b
Compare
21c3f89
to
2e58c2a
Compare
@elasticmachine merge upstream |
9e00969
to
7b3412a
Compare
a34886f
to
8f0c76d
Compare
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
@elasticmachine merge upstream |
f5f0ddf
to
3b359fe
Compare
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! This is not a very rewarding job, but this standarization was very necessary. It will open the cell-actions framework to support any use case.
Thanks Pablo! 👏
): value is string | number | boolean => isString(value) || isNumber(value) || isBoolean(value); | ||
|
||
const isNonMixedTypeArray = ( | ||
value: Array<string | number | boolean> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT:
value: Array<string | number | boolean> | |
value: SerializableArray |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function only receives Array<string | number | boolean>
because we call it after filtering out other values. We could use a more generic type like SerializableArray
but the extra types won't be used. Also, If we receive a SerializableArray
the type guard would have to be expanded to tring[] | number[] | boolean[] | null[] | undefined[] | SerializableArray | SerializableRecord[]
. I am not sure if it is worth it.
export const isValueSupportedByDefaultActions = ( | ||
value: NonNullableSerializable[] | ||
): value is DefaultActionsSupportedValue => | ||
value.every(isNonNullablePrimitiveValue) && isNonMixedTypeArray(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the value.every(isNonNullablePrimitiveValue)
needed? The value parameter is already NonNullableSerializable[]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isNonNullablePrimitiveValue
is required to drop non-primitive values like SerializableArray
and SerializableRecord
.
The confusion is due to the bad naming. isNonNullablePrimitiveValue
checks if the value is string
, number
, or boolean
, which are primitive and not nullable. I will inline the function to avoid naming it. 😆
src/plugins/discover/public/components/discover_grid/discover_grid.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on these changes! This is a big improvement for cell actions and makes it applicable to a much wider range of use cases 🙌
I tested locally with a custom Security dashboard including less common scenarios like no timestamp, flattened fields, and field conflicts, and everything seemed to work as expected. LGTM 👍
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Async chunks
Public APIs missing exports
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @machadoum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Original issue: #144943
Summary
Serializable
.execute
to ensure the field value is compatible.How to test it?
Checklist