[EDR Workflows] Initialize SelectorComponent value in Scripts picker#225451
Closed
tomsonpl wants to merge 36 commits intoelastic:mainfrom
Closed
[EDR Workflows] Initialize SelectorComponent value in Scripts picker#225451tomsonpl wants to merge 36 commits intoelastic:mainfrom
tomsonpl wants to merge 36 commits intoelastic:mainfrom
Conversation
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
|
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
32aa098 to
7e003e7
Compare
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
History
cc @tomsonpl |
Contributor
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
Contributor
Author
|
closing in favor of: #227463 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously, #204965 introduced a
stringbased Selector Component, however the Response Console's framework wasn't adjusted to fully support it:Selector Components Not Restoring State from History:
When users selected a command from history (e.g., custom script execution), the selector UI (such as script dropdowns) could not restore its value from the previously entered command text. This left the UI out of sync with the command, confusing users and breaking workflows.
Broken Paste Functionality:
Pasting a full command (including arguments meant for selectors) into the console did not populate the selector UI components. As a result, users who pasted commands from documentation or shared snippets would see empty or incorrect selector states, making it difficult to execute or edit those commands.
These issues stemmed from the lack of a unified mechanism for synchronizing between the command text and selector state. Command-specific logic was difficult to maintain and extend.
How was it resolved?
This PR introduces a unified, handler-based approach to command parsing and selector state management:
Command Handlers:
Each supported command (e.g.,
runscript) now has a dedicated handler responsible for:Central Registry:
All command handlers are registered in a central registry, allowing the system to dynamically delegate parsing and state management to the correct handler for each command. This eliminates scattered logic and makes the system much more maintainable.
Bidirectional Synchronization:
Selector components now reliably initialize their state from both command history and pasted text (where applicable). Any changes in the selector UI are immediately reflected in the command text, and vice versa.
Additional Architectural Improvements
Based on code review feedback, this PR also addresses architectural concerns with the
CustomScriptSelectorcomponent:🔧 Standard React Component:
Converted from function-returning-component pattern (
CustomScriptSelector('agentType')) to standard React component (<CustomScriptSelector />)🔧 Console Framework Encapsulation:
Removed direct
useConsoleStateDispatch()coupling and replaced with proper callback-based architecture (onChange,requestFocus)🔧 Command Metadata Integration:
Agent type now extracted from
command.commandDefinition.meta?.agentTypeinstead of function parameters, following console framework patterns🔧 Enhanced Interface:
Added
command: CommandandrequestFocus?: () => voidprops toCommandArgumentValueSelectorPropsfor better component integrationThese changes ensure the console remains a generic, maintainable framework while providing clean interfaces for selector components.
Result
Screen.Recording.2025-06-27.at.12.15.47.mov
Closes: #225269
Closes: #225407