Skip to content

Commit f9c67ee

Browse files
author
Esteban Beltran
committed
Address PR comments
1 parent 7914970 commit f9c67ee

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

x-pack/plugins/security_solution/public/management/pages/event_filters/store/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ const refreshListDataIfNeeded: MiddlewareActionHandler = async (store, eventFilt
231231
dispatch({
232232
type: 'eventFiltersListPageDataChanged',
233233
payload: {
234-
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored
234+
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored (#830)
235235
type: 'LoadingResourceState',
236236
previousState: getCurrentListPageDataState(state),
237237
},

x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.test.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
* 2.0.
66
*/
77

8-
import { CreateExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
8+
import {
9+
CreateExceptionListItemSchema,
10+
UpdateEndpointListItemSchema,
11+
} from '@kbn/securitysolution-io-ts-list-types';
912
import { applyMiddleware, createStore, Store } from 'redux';
1013
import { coreMock } from '../../../../../../../../src/core/public/mocks';
1114
import { getFoundExceptionListItemSchemaMock } from '../../../../../../lists/common/schemas/response/found_exception_list_item_schema.mock';
@@ -224,22 +227,23 @@ describe('Host isolation exceptions middleware', () => {
224227

225228
describe('When updating an item from host isolation exceptions', () => {
226229
const fakeId = 'dc5d1d00-2766-11ec-981f-7f84cfc8764f';
227-
const fakeException = {
228-
...createEmptyHostIsolationException(),
229-
name: 'name edit me',
230-
description: 'initial description',
231-
id: fakeId,
232-
item_id: fakeId,
233-
entries: [
234-
{
235-
field: 'destination.ip',
236-
operator: 'included',
237-
type: 'match',
238-
value: '10.0.0.5',
239-
},
240-
],
241-
};
230+
let fakeException: UpdateEndpointListItemSchema;
242231
beforeEach(() => {
232+
fakeException = {
233+
...createEmptyHostIsolationException(),
234+
name: 'name edit me',
235+
description: 'initial description',
236+
id: fakeId,
237+
item_id: fakeId,
238+
entries: [
239+
{
240+
field: 'destination.ip',
241+
operator: 'included',
242+
type: 'match',
243+
value: '10.0.0.5',
244+
},
245+
],
246+
};
243247
getOneHostIsolationExceptionItemMock.mockReset();
244248
getOneHostIsolationExceptionItemMock.mockImplementation(async () => {
245249
return fakeException;

x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async function createHostIsolationException(
7979
dispatch({
8080
type: 'hostIsolationExceptionsFormStateChanged',
8181
payload: {
82-
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored
82+
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored (#830)
8383
type: 'LoadingResourceState',
8484
previousState: entry,
8585
},
@@ -122,7 +122,7 @@ async function loadHostIsolationExceptionsList(
122122
dispatch({
123123
type: 'hostIsolationExceptionsPageDataChanged',
124124
payload: {
125-
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored
125+
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored (#830)
126126
type: 'LoadingResourceState',
127127
previousState: getCurrentListPageDataState(store.getState()),
128128
},
@@ -164,7 +164,7 @@ async function deleteHostIsolationExceptionsItem(
164164
dispatch({
165165
type: 'hostIsolationExceptionsDeleteStatusChanged',
166166
payload: {
167-
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored
167+
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored (#830)
168168
type: 'LoadingResourceState',
169169
previousState: store.getState().deletion.status,
170170
},
@@ -221,7 +221,7 @@ async function updateHostIsolationExceptionsItem(
221221
try {
222222
const entry = transformOutput(exception as UpdateExceptionListItemSchema);
223223
// Clean unnecessary fields for update action
224-
[
224+
const fieldsToRemove: Array<keyof ExceptionListItemSchema> = [
225225
'created_at',
226226
'created_by',
227227
'created_at',
@@ -230,7 +230,9 @@ async function updateHostIsolationExceptionsItem(
230230
'tie_breaker_id',
231231
'updated_at',
232232
'updated_by',
233-
].forEach((field) => {
233+
];
234+
235+
fieldsToRemove.forEach((field) => {
234236
delete entry[field as keyof UpdateExceptionListItemSchema];
235237
});
236238
const response: ExceptionListItemSchema = await updateOneHostIsolationExceptionItem(

x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form_flyout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export const HostIsolationExceptionsFormFlyout: React.FC<{}> = memo(() => {
103103
setException(exceptionToEdit);
104104
}
105105
}
106-
// initialize an empty exception to create
107106
}, [dispatch, exception, exceptionToEdit, location.id, location.show, onCancel]);
108107

109108
// handle creation and edit success

x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ const fetchEditTrustedAppIfNeeded = async (
412412
dispatch({
413413
type: 'trustedAppCreationEditItemStateChanged',
414414
payload: {
415-
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored
415+
// @ts-expect-error-next-line will be fixed with when AsyncResourceState is refactored (#830)
416416
type: 'LoadingResourceState',
417417
previousState: editItemState(currentState)!,
418418
},

0 commit comments

Comments
 (0)