Skip to content

Commit

Permalink
Removed sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
oatkiller committed Feb 19, 2020
1 parent 2549efc commit 82c17c4
Showing 1 changed file with 1 addition and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,17 @@ import { HttpFetchQuery } from 'kibana/public';
import { AlertResultList } from '../../../../../common/types';
import { AppAction } from '../action';
import { MiddlewareFactory, AlertListState } from '../../types';
import { isOnAlertPage, queryParams } from './selectors';
import { isOnAlertPage, paginationDataFromUrl } from './selectors';

export const alertMiddlewareFactory: MiddlewareFactory<AlertListState> = coreStart => {
return api => next => async (action: AppAction) => {
next(action);
const state = api.getState();
if (action.type === 'userChangedUrl' && isOnAlertPage(state)) {
const response: AlertResultList = {
total: 1,
request_page_size: 1,
request_page_index: 0,
result_from_index: 0,
alerts: [
{
'@timestamp': new Date().toString(),
agent: { id: '', version: '' },
event: {
action: '',
},
file_classification: {
malware_classification: {
score: 1,
},
},
host: {
hostname: '',
ip: '',
os: {
name: '',
},
},
thread: {},
},
],
};
api.dispatch({ type: 'serverReturnedAlertsData', payload: response });
/*
* TODO dont commit this file
const response: AlertResultList = await coreStart.http.get(`/api/endpoint/alerts`, {
query: paginationDataFromUrl(state) as HttpFetchQuery,
});
api.dispatch({ type: 'serverReturnedAlertsData', payload: response });
*/
}
};
};

0 comments on commit 82c17c4

Please sign in to comment.