-
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
[Security Solution][Endpoint] Add an additional hint message for Console commands pending more than 15s #135500
[Security Solution][Endpoint] Add an additional hint message for Console commands pending more than 15s #135500
Conversation
Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt) |
Will work on tests tomorrow |
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! 🚢
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.
...curity_solution/public/management/components/console/components/command_execution_output.tsx
Outdated
Show resolved
Hide resolved
...urity_solution/public/management/components/console/components/long_running_command_hint.tsx
Outdated
Show resolved
Hide resolved
const elapsedSeconds = moment().diff(moment(enteredAt), 'seconds'); | ||
|
||
if (elapsedSeconds >= 15) { | ||
setIsLongRunningCommand(true); | ||
return; | ||
} | ||
|
||
timeoutId = setTimeout(() => { | ||
setIsLongRunningCommand(true); | ||
}, (15 - elapsedSeconds) * 1000); | ||
} |
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.
So here the elapsedSeconds
never increments or is always 0
. Basically, the timeout is set to execute after 15 seconds and sets the isLongRunningCommand
to true
. We're not actually using the time difference here.
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.
Not sure what you mean.
Let me explain this logic around elapsedSeconds
. You can enter a command and then close the Responder window... When we re-open that same responder window, we need to determine how much time has elapsed since the command was entered so that we can correctly calculate the setTimeout()
ms.
Example:
- I enter a command at
:00 s
and immediately close the console - I reopen the console just 5s later.
- the
setTimeout()
should now only wait10s
since 5s has already elapsed... so the(15 - elapsedSeconds)
does that. - This logic here will only be triggered if
15s
has not yet elapsed
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.
Oh, I see. When the command is executed and the console stays open beyond 15 seconds the elapsedSeconds
is always 0 and thus the elapsedSeconds >= 15
block does not execute is what I meant. I didn't test it by closing and then re-opening the console, in which case the block does execute and it works as expected.
From Ash Co-authored-by: Ashokaditya <1849116+ashokaditya@users.noreply.github.com>
@ashokaditya thanks for pointing out that "flicker" issue. I just looked at the |
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.
🚢 it!
…how-hint-on-long-running-actions
💚 Build SucceededMetrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
Summary
CommandExecutionResult
to use new text componentChecklist