-
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
Add a flyout to alert list. #57926
Merged
Merged
Add a flyout to alert list. #57926
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
07e448d
add a flyout
e7c891c
Removing TODOs, added issue
3d6f4ab
Rename `queryParams` selector
4aeeba7
Removing TODOs, added issue
6340270
Removed TODOs, added issue
26c3ca6
Removed sample code
09fe7dc
DO IT
517d796
return alerts from alert api.
dc98ea0
remove copy paste
f2847b4
Fix query builder test
7d18af0
GO FOR IT
9686b88
add tests
b5ce863
use davis technique
eb25f76
add tests that test it
daafb55
use currentTarget cause candace said so
0d67dad
use react router link. its an actual link, and its easier to test w/ …
26a5ac2
rewrite the tests
60db616
remove todos
66c4590
Add comments
5a30168
remove snapshot as it was not stable (relied on timezone)
626e2fb
respect existing query params when opening or closing flyouyt
5b78baf
pedro
dbffe17
DO IT
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { coreMock } from 'src/core/public/mocks'; | |
import { AlertResultList } from '../../../../../common/types'; | ||
import { isOnAlertPage } from './selectors'; | ||
import { createBrowserHistory } from 'history'; | ||
import { mockAlertResultList } from './mock_alert_result_list'; | ||
|
||
describe('alert list tests', () => { | ||
let store: Store<AlertListState, AppAction>; | ||
|
@@ -28,37 +29,7 @@ describe('alert list tests', () => { | |
describe('when the user navigates to the alert list page', () => { | ||
beforeEach(() => { | ||
coreStart.http.get.mockImplementation(async () => { | ||
const response: AlertResultList = { | ||
alerts: [ | ||
{ | ||
'@timestamp': new Date(1542341895000), | ||
agent: { | ||
id: 'ced9c68e-b94a-4d66-bb4c-6106514f0a2f', | ||
version: '3.0.0', | ||
}, | ||
event: { | ||
action: 'open', | ||
}, | ||
file_classification: { | ||
malware_classification: { | ||
score: 3, | ||
}, | ||
}, | ||
host: { | ||
hostname: 'HD-c15-bc09190a', | ||
ip: '10.179.244.14', | ||
os: { | ||
name: 'Windows', | ||
}, | ||
}, | ||
thread: {}, | ||
}, | ||
], | ||
total: 1, | ||
request_page_size: 10, | ||
request_page_index: 0, | ||
result_from_index: 0, | ||
}; | ||
const response: AlertResultList = mockAlertResultList(); | ||
return response; | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whitespace |
||
|
This file contains 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
This file contains 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
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/mock_alert_result_list.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { AlertResultList } from '../../../../../common/types'; | ||
|
||
export const mockAlertResultList: (options?: { | ||
total?: number; | ||
request_page_size?: number; | ||
request_page_index?: number; | ||
}) => AlertResultList = (options = {}) => { | ||
const { | ||
total = 1, | ||
request_page_size: requestPageSize = 10, | ||
request_page_index: requestPageIndex = 0, | ||
} = options; | ||
|
||
// Skip any that are before the page we're on | ||
const numberToSkip = requestPageSize * requestPageIndex; | ||
|
||
// total - numberToSkip is the count of non-skipped ones, but return no more than a pageSize, and no less than 0 | ||
const actualCountToReturn = Math.max(Math.min(total - numberToSkip, requestPageSize), 0); | ||
|
||
const alerts = []; | ||
for (let index = 0; index < actualCountToReturn; index++) { | ||
alerts.push({ | ||
'@timestamp': new Date(1542341895000).toString(), | ||
agent: { | ||
id: 'ced9c68e-b94a-4d66-bb4c-6106514f0a2f', | ||
version: '3.0.0', | ||
}, | ||
event: { | ||
action: 'open', | ||
}, | ||
file_classification: { | ||
malware_classification: { | ||
score: 3, | ||
}, | ||
}, | ||
host: { | ||
hostname: 'HD-c15-bc09190a', | ||
ip: '10.179.244.14', | ||
os: { | ||
name: 'Windows', | ||
}, | ||
}, | ||
thread: {}, | ||
}); | ||
} | ||
const mock: AlertResultList = { | ||
alerts, | ||
total, | ||
request_page_size: requestPageSize, | ||
request_page_index: requestPageIndex, | ||
result_from_index: 0, | ||
}; | ||
return mock; | ||
}; |
Oops, something went wrong.
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.
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.
why
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.
@alexk307 worth a discussion but: https://github.com/elastic/endpoint-app-team/issues/187