File tree Expand file tree Collapse file tree 4 files changed +25
-9
lines changed
public/applications/endpoint Expand file tree Collapse file tree 4 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 44 * you may not use this file except in compliance with the Elastic License.
55 */
66
7- export interface AlertData {
7+ /**
8+ * A deep readonly type that will make all children of a given object readonly recursively
9+ */
10+ export type Immutable < T > = T extends undefined | null | boolean | string | number
11+ ? T
12+ : T extends Array < infer U >
13+ ? ImmutableArray < U >
14+ : T extends Map < infer K , infer V >
15+ ? ImmutableMap < K , V >
16+ : T extends Set < infer M >
17+ ? ImmutableSet < M >
18+ : ImmutableObject < T > ;
19+
20+ export type ImmutableArray < T > = ReadonlyArray < Immutable < T > > ;
21+ export type ImmutableMap < K , V > = ReadonlyMap < Immutable < K > , Immutable < V > > ;
22+ export type ImmutableSet < T > = ReadonlySet < Immutable < T > > ;
23+ export type ImmutableObject < T > = { readonly [ K in keyof T ] : Immutable < T [ K ] > } ;
24+
25+ export type AlertData = Immutable < {
826 value : {
927 source : {
1028 endgame : {
@@ -26,11 +44,11 @@ export interface AlertData {
2644 hostname : string ;
2745 ip : string ;
2846 os : {
29- name : string ; // TODO Union types?
47+ name : string ;
3048 } ;
3149 } ;
3250 } ;
3351 } ;
34- }
52+ } > ;
3553
3654export type PageId = 'alertsPage' | 'endpointListPage' ;
Original file line number Diff line number Diff line change 44 * you may not use this file except in compliance with the Elastic License.
55 */
66
7- import { AlertData } from '../../../../../endpoint_app_types' ;
7+ import { AlertData , Immutable } from '../../../../../endpoint_app_types' ;
88
9- export interface AlertListState {
9+ export type AlertListState = Immutable < {
1010 alerts : AlertData [ ] ;
11- }
11+ } > ;
Original file line number Diff line number Diff line change 66
77import { Reducer } from 'redux' ;
88import { EndpointListState } from './types' ;
9- import { EndpointListAction } from './action' ;
109import { AppAction } from '../action' ;
1110
1211const initialState = ( ) : EndpointListState => {
Original file line number Diff line number Diff line change 77import { memo , useState , useMemo } from 'react' ;
88import React from 'react' ;
99import { EuiDataGrid } from '@elastic/eui' ;
10- import { useDispatch , useSelector } from 'react-redux' ;
11- import { AlertAction } from '../../store/alerts/action' ;
10+ import { useSelector } from 'react-redux' ;
1211import * as selectors from '../../store/selectors' ;
1312import { usePageId } from '../use_page_id' ;
1413
You can’t perform that action at this time.
0 commit comments