-
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
[CellActions] Support for empty value in addToTimeline action #149527
[CellActions] Support for empty value in addToTimeline action #149527
Conversation
@elasticmachine merge upstream |
getIconType: (): string => COPY_TO_CLIPBOARD_ICON, | ||
getDisplayName: () => COPY_TO_CLIPBOARD, | ||
getDisplayNameTooltip: () => COPY_TO_CLIPBOARD, | ||
isCompatible: async ({ field }) => fieldHasCellActions(field.name), |
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.
Note: Adding fieldHasCellActions
on a generic action like this makes it hard to reuse in other applications.
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.
Yes, you are right, good point.
But different solutions may have different criteria to show it, the same for Filter In/Out actions. We want these actions to not be displayed with those fields on all Security pages.
When we make these actions generic we'll have to have this in mind. We could have a factory and allow overriding the isCompatible
function (and other props) when they are created and attached to the trigger, or just add an isVisible
function to the action factory.
We can discuss it more deeply with @YulNaumenko
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.
Good job! 👏 👏
I tested it locally and everything seems to be working.
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
History
To update your PR or re-run it, just comment with: cc @semd |
…c#149527) part of: elastic#145666 ## Summary This PR contains changes in the `dataProvider` function for the addToTimeline action: - add support for empty values excluding the field, to make it consistent with the legacy implementation. - id changes removing the "draggable" word. - extracted `getIdForField` function to reduce the main function complexity (linter warning appeared) This PR also introduces the `CellAction` type for action creation: - `isCompatible` method parameters uses the new `CellActionCompatibilityContext` type instead of `CellActionExecutionContext`, it omits the `field.value` and the references values, they are not needed to check the compatibility and, in some situations, it is not possible to pass them. - use CellAction type in all SecuritySolution action creators - action creators now return plain objects instead of using `createAction` (deprecated) function. - all actions now check `fieldHasCellActions(field.name)` in the `inCompatible` function, to keep the consistency with legacy code. - `useLoadAction` hooks now integrate the error control, components don't need to check the `error` anymore. Co-authored-by: Kibana Machine <[email protected]>
part of: #145666
Summary
This PR contains changes in the
dataProvider
function for the addToTimeline action:getIdForField
function to reduce the main function complexity (linter warning appeared)This PR also introduces the
CellAction
type for action creation:isCompatible
method parameters uses the newCellActionCompatibilityContext
type instead ofCellActionExecutionContext
, it omits thefield.value
and the references values, they are not needed to check the compatibility and, in some situations, it is not possible to pass them.createAction
(deprecated) function.fieldHasCellActions(field.name)
in theinCompatible
function, to keep the consistency with legacy code.useLoadAction
hooks now integrate the error control, components don't need to check theerror
anymore.