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

[Endpoint] Alert Details Overview #58412

Merged
merged 16 commits into from
Mar 3, 2020

Conversation

dplumlee
Copy link
Contributor

@dplumlee dplumlee commented Feb 24, 2020

Summary

Adds to the alert details flyout with expanded alert details in an accordion style layout

Screen Shot 2020-02-29 at 2 24 52 AM

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@dplumlee dplumlee added WIP Work in progress Team:Endpoint Response Endpoint Response Team labels Feb 24, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/endpoint-response (Team:Endpoint Response)

@peluja1012 peluja1012 added the Feature:Endpoint Elastic Endpoint feature label Feb 27, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/endpoint-app-team (Feature:Endpoint)

@@ -87,6 +87,7 @@ export interface EndpointAppLocation {
export type AlertListData = AlertResultList;
export type AlertListState = Immutable<AlertResultList> & {
readonly location?: Immutable<EndpointAppLocation>;
readonly alert_details?: Immutable<AlertData>;
Copy link
Contributor

Choose a reason for hiding this comment

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

You should rebase with master. AlertListState has changed a bit.

@@ -0,0 +1,338 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to i18n this whole file

</EuiText>
<EuiSpacer />
<EuiText>
Endpoint Status: <EuiHealth color="success">Online</EuiHealth>
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

id="alertDetailsSourceProcessTokenAccordion"
buttonContent="Source Process Token"
paddingSize="l"
initialIsOpen={true}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should only expand the first one by default

<EuiDescriptionList
type="column"
listItems={hostDetailsColumns}
style={{ maxWidth: '400px' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use https://styled-components.com/ instead of inline styles?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is actually just copied over from the eui example, ill probably end up removing it, but for future styles, yes

<EuiSpacer />

{/* Start of Alert Details overview component TODO: delete this comment eventually */}
<EuiAccordion
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should pull these out into their own components because we'll have to reuse them in the near future when we add more alert types. The new components could take isOpen as a prop and pass that down to initialIsOpen.

Copy link
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

I did not run it locally, but code is looking good 👍

I saw a few TODO in description: "" - I assume you are still working on that since this is marked as wip.

Also - this is more of an unknown for me: I noticed several of your components share the same id for i18n.translate(). Wondering if that is a problem for localization since the keys are being duplicated across multiple components

variant: string;
};
};
host: HostFields;
Copy link
Contributor

Choose a reason for hiding this comment

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

ping @nnamdifrankie - Just FYI. Does not change the type, just breaks out into smaller interfaces for reuse purposes 😃

if (action.type === 'userChangedUrl' && isOnAlertPage(state) && hasSelectedAlert(state)) {
const uiParams = uiQueryParams(state);
const response: AlertData = await coreStart.http.get(
`/api/endpoint/alerts/${uiParams.selected_alert}`
Copy link
Contributor

Choose a reason for hiding this comment

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

at some point - need to add error handling

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, i have a task for it in the github issue

@@ -26,6 +26,7 @@ export const mockAlertResultList: (options?: {
const alerts = [];
for (let index = 0; index < actualCountToReturn; index++) {
alerts.push({
// TODO: Update this data to the new type
Copy link
Contributor

Choose a reason for hiding this comment

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

can you reference an Issue that is tracking this TODO (if its not going to be included in this PR)?

Copy link
Contributor

Choose a reason for hiding this comment

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

It will be included in this PR

<EuiSpacer />
<EuiText>
<p>
Endgame MalwareScore detected the opening of a document with a blah blah blah on{' '}
Copy link
Contributor

Choose a reason for hiding this comment

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

🤣
I'm assuming you will remove this before commit to master

Copy link
Contributor

Choose a reason for hiding this comment

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

Good call haha

Copy link
Contributor

Choose a reason for hiding this comment

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

done


return (
<>
<section className="details-overview-summary">
Copy link
Contributor

Choose a reason for hiding this comment

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

you still working on this one? i18n needed below

Copy link
Contributor

Choose a reason for hiding this comment

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

good call. done.

@@ -137,7 +143,7 @@ export const AlertIndex = memo(() => {
return (
<Link
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be using a connected EuiLink. I think @parkiino 's PR will include a common one in our components/ dir, so you can use that when its merged in.

@@ -213,28 +211,44 @@ export const AlertIndex = memo(() => {
</h2>
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody />
<EuiFlyoutBody>
{selectedAlertData ? <AlertDetailsOverview /> : <EuiLoadingSpinner size="xl" />}
Copy link
Contributor

Choose a reason for hiding this comment

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

@parkiino - we probably should use this same loading component in Management Host details ⬆️ to stay consistent.

aria-label="Alert List"
rowCount={total}
columns={columns}
columnVisibility={useMemo(
Copy link
Contributor

Choose a reason for hiding this comment

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

for consistency - consider moving this useMemo to the top of the of this component

@dplumlee dplumlee added release_note:skip Skip the PR/issue when compiling release notes and removed WIP Work in progress labels Feb 28, 2020
@dplumlee dplumlee force-pushed the alert-details-overview branch 2 times, most recently from 28a89f5 to d0880d5 Compare February 29, 2020 19:33
@dplumlee dplumlee changed the title Alert Details Overview [Endpoint] Alert Details Overview Mar 1, 2020
@dplumlee
Copy link
Contributor Author

dplumlee commented Mar 1, 2020

@elasticmachine merge upstream

Copy link
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

Just some minor comments that can be addressed (if needed) in subsequent PRs

const middleware = alertMiddlewareFactory(coreStart);
store = createStore(alertListReducer, applyMiddleware(middleware));

selectorIsTrue = async selector => {
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: I was going to create something similar as well - some of my Policy middleware tests started to fail in Release branch and kibana-operation turn them off. The only think I was thinking about doing that differs from this approach was that I was going to reject the Promise after some x times.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i do agree the test is kind of brittle, i think the goal is to remove it when qualters creates a functional test for the flyout/resolver in his 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.

@paul-tavares we originally had it reject after 10 times, but since no additional actions are ever dispatched (no user exists after all) that limit was never hit. At the moment jest just times out after 4.5 seconds

data-testid="alertTypeCellLink"
to={urlFromQueryParams({ ...queryParams, selected_alert: 'TODO' })}
onClick={() =>
Copy link
Contributor

Choose a reason for hiding this comment

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

missing href??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does it require an href? we're getting all the functionality we need from just the onclick since its just changing the search query in the url

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the href is needed if you would like to enable users to open the link in a separate tab/window or be able to copy the link

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, we've opened a ticket for it to address

Copy link
Contributor

Choose a reason for hiding this comment

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

oh geez

<p>
<FormattedMessage
id="xpack.endpoint.application.endpoint.alertDetails.overview.summary"
defaultMessage="Endgame MalwareScore detected the opening of a document on {hostname} on {date}"
Copy link
Contributor

Choose a reason for hiding this comment

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

probably remove "Endgame?"

Copy link
Contributor

@oatkiller oatkiller left a comment

Choose a reason for hiding this comment

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

do good

title: i18n.translate('xpack.endpoint.application.endpoint.alertDetails.fileSize', {
defaultMessage: 'File Size',
}),
description: alertData.file.size,
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO formatting

Copy link
Contributor

Choose a reason for hiding this comment

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

Added task

title: i18n.translate('xpack.endpoint.application.endpoint.alertDetails.alertType', {
defaultMessage: 'Alert Type',
}),
description: alertData.event.category,
Copy link
Contributor

Choose a reason for hiding this comment

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

make a ticket? i18n

Copy link
Contributor

Choose a reason for hiding this comment

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

title: i18n.translate('xpack.endpoint.application.endpoint.alertDetails.eventType', {
defaultMessage: 'Event Type',
}),
description: alertData.event.kind,
Copy link
Contributor

Choose a reason for hiding this comment

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

probably also

Copy link
Contributor

Choose a reason for hiding this comment

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

added task

title: i18n.translate('xpack.endpoint.application.endpoint.alertDetails.hostIP', {
defaultMessage: 'Host IP',
}),
description: alertData.host.ip.join(','),
Copy link
Contributor

Choose a reason for hiding this comment

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

', '

* you may not use this file except in compliance with the Elastic License.
*/

export { GeneralAccordion } from './general_accordion';
Copy link
Contributor

Choose a reason for hiding this comment

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

y?

<EuiText>Alert Status: Open</EuiText>
<EuiSpacer />
</section>
<EuiTabbedContent tabs={tabs} initialSelectedTab={tabs[0]} />
Copy link
Contributor

Choose a reason for hiding this comment

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

consider syncing the tab selection with the URL (maybe make it a future improvement?)
https://elastic.github.io/eui/#/navigation/tabs

Copy link
Contributor

Choose a reason for hiding this comment

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

<FileAccordion alertData={alertDetailsData} />
<EuiSpacer />
<SourceProcessAccordion alertData={alertDetailsData} />
<EuiSpacer />
Copy link
Contributor

Choose a reason for hiding this comment

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

oh geez

data-testid="alertTypeCellLink"
to={urlFromQueryParams({ ...queryParams, selected_alert: 'TODO' })}
onClick={() =>
Copy link
Contributor

Choose a reason for hiding this comment

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

oh geez

return (
<div className={className} data-test-subj="alertResolver" data-testid="alertResolver">
<Provider store={store}>
<Resolver selectedEvent={(alertDetailsData as unknown) as LegacyEndpointEvent} />
Copy link
Contributor

Choose a reason for hiding this comment

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

</Provider>
</div>
);
React.memo(({ className }: { className?: string }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

consider taking in a LegacyEndpointEvent. The component that renders this could get selectedAlertDetailsData and then check if its a LegacyEndpointEvent via a predicate function and then pass it down. that way there is no unsafe casting

data: {
buffer: string;
decompressed_size: number;
encoding: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

These fields are not going to be used by the UI, right? Anything the UI won't use should be optional or even removed from the types.

Copy link
Contributor

Choose a reason for hiding this comment

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

but we can do that in subsequent PRs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding this to this ticket elastic/endpoint-app-team#189

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@dplumlee dplumlee merged commit ffab68d into elastic:master Mar 3, 2020
@dplumlee dplumlee deleted the alert-details-overview branch March 3, 2020 00:32
@EricDavisX
Copy link
Contributor

@peluja1012 I'm clearly behind in pushing 'test considerations' on the PRs we have, now that *that is the desired process. However, I think the test idea are in another castle. I am curious whats our process is tho? ...This was closed out without fulfilling all of the tasks (which is ok by me) or they just need to be updated, lol. If not, can we plan to always put a prominent link to the new 'remaining work' ticket or PR that's been insta-opened?

And there aren't any browser tests for a UI focused pr, @dplumlee do you want to work with me to get up to speed on the Functional Test Runner jazz so we can bang out some tests for this new component?

gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 3, 2020
* master: (26 commits)
  [Endpoint] Alert Details Overview (elastic#58412)
  Service map language icons (elastic#58633)
  [SIEM] [Case] Comments to case view (elastic#58315)
  Remove appBasePath from docs + add mock for AppMountParameters (elastic#58775)
  [kbn/optimizer] fix ui/* url rewrites in dist (elastic#58627)
  Dashboard a11y tests (elastic#58122)
  Downgrade "setting up plugin" log to debug (elastic#58776)
  [CI] Pipeline refactoring (elastic#56447)
  [Advanced Settings] Fix a11y of unsaved indicator (elastic#58511)
  put params into short url instead of behind it (elastic#58846)
  show timepicker in timelion and tsvb (elastic#58857)
  improve graph missing workspace error message (elastic#58876)
  [Maps] direct Discover "visualize" to open Maps application (elastic#58549)
  Disallow duplicate percentiles (elastic#57444) (elastic#58299)
  removing references to visTypes uiExports (elastic#58337)
  [SIEM] Default the Timeline events filter to show All events (elastic#58953)
  [Remote clusters] Add indexManagement as required plugin (elastic#58915)
  [DOCS] Rework of main get started page (elastic#58260)
  [Endpoint] [Tests] fixes elastic#57946 flaky endpoint policy list test (elastic#58348)
  [Endpoint] add resolver middleware (elastic#58288)
  ...
dgieselaar pushed a commit to dgieselaar/kibana that referenced this pull request Mar 3, 2020
@EricDavisX
Copy link
Contributor

I spoke with Pedro and we're going to review the tasks list. And I see a note that Kevin Q has a pr that will cover the Functional browser tests so seeing that its all good now.

gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 3, 2020
…s/kibana into alerting/fix-flaky-instance-test

* 'alerting/fix-flaky-instance-test' of github.com:gmmorris/kibana:
  [Endpoint] Alert Details Overview (elastic#58412)
  Service map language icons (elastic#58633)
  [SIEM] [Case] Comments to case view (elastic#58315)
  Remove appBasePath from docs + add mock for AppMountParameters (elastic#58775)
  [kbn/optimizer] fix ui/* url rewrites in dist (elastic#58627)
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 58412 or prevent reminders by adding the backport:skip label.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 4, 2020
dplumlee added a commit to dplumlee/kibana that referenced this pull request Mar 4, 2020
dplumlee added a commit to dplumlee/kibana that referenced this pull request Mar 4, 2020
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Endpoint Elastic Endpoint feature release_note:skip Skip the PR/issue when compiling release notes Team:Endpoint Response Endpoint Response Team v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants