-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Filter alert API so it shows only Alerts instead of all documents in the index * Clicking an item in the alert list will open a flyout
- Loading branch information
Robert Austin
authored
Feb 22, 2020
1 parent
6a86b57
commit 1588009
Showing
17 changed files
with
650 additions
and
224 deletions.
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
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.