diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/field_mapping.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/field_mapping.tsx index 04a30af5e3b2b..52b881a1eb75f 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/field_mapping.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/field_mapping.tsx @@ -8,15 +8,11 @@ import React, { useCallback, useMemo } from 'react'; import { EuiFormRow, EuiFlexItem, EuiFlexGroup, EuiSuperSelectOption } from '@elastic/eui'; import styled from 'styled-components'; -import { CaseField, ActionType, ThirdPartyField } from '../../../../../../../case/common/api'; import { FieldMappingRow } from './field_mapping_row'; import * as i18n from './translations'; import { setActionTypeToMapping, setThirdPartyToMapping } from './utils'; -import { - ThirdPartyField as ConnectorConfigurationThirdPartyField, - AllThirdPartyFields, -} from './types'; +import { ThirdPartyField as ConnectorConfigurationThirdPartyField } from './types'; import { CasesConfigurationMapping } from '../types'; import { connectorConfiguration } from '../config'; import { createDefaultMapping } from '../servicenow_connectors'; @@ -26,7 +22,7 @@ const FieldRowWrapper = styled.div` font-size: 14px; `; -const actionTypeOptions: Array> = [ +const actionTypeOptions: Array> = [ { value: 'nothing', inputDisplay: <>{i18n.FIELD_MAPPING_EDIT_NOTHING}, @@ -45,12 +41,10 @@ const actionTypeOptions: Array> = [ ]; const getThirdPartyOptions = ( - caseField: CaseField, + caseField: string, thirdPartyFields: Record -): Array> => - (Object.keys(thirdPartyFields) as AllThirdPartyFields[]).reduce< - Array> - >( +): Array> => + (Object.keys(thirdPartyFields) as string[]).reduce>>( (acc, key) => { if (thirdPartyFields[key].validSourceFields.includes(caseField)) { return [ @@ -87,7 +81,7 @@ const FieldMappingComponent: React.FC = ({ connectorActionTypeId, }) => { const onChangeActionType = useCallback( - (caseField: CaseField, newActionType: ActionType) => { + (caseField: string, newActionType: string) => { const myMapping = mapping ?? defaultMapping; onChangeMapping(setActionTypeToMapping(caseField, newActionType, myMapping)); }, @@ -96,7 +90,7 @@ const FieldMappingComponent: React.FC = ({ ); const onChangeThirdParty = useCallback( - (caseField: CaseField, newThirdPartyField: ThirdPartyField) => { + (caseField: string, newThirdPartyField: string) => { const myMapping = mapping ?? defaultMapping; onChangeMapping(setThirdPartyToMapping(caseField, newThirdPartyField, myMapping)); }, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/field_mapping_row.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/field_mapping_row.tsx index 495b47410d2f9..beca8f1fbbc77 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/field_mapping_row.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/field_mapping_row.tsx @@ -14,19 +14,17 @@ import { } from '@elastic/eui'; import { capitalize } from 'lodash'; -import { CaseField, ActionType, ThirdPartyField } from '../../../../../../../case/common/api/cases'; -import { AllThirdPartyFields } from './types'; export interface RowProps { id: string; disabled: boolean; - securitySolutionField: CaseField; - thirdPartyOptions: Array>; - actionTypeOptions: Array>; - onChangeActionType: (caseField: CaseField, newActionType: ActionType) => void; - onChangeThirdParty: (caseField: CaseField, newThirdPartyField: ThirdPartyField) => void; - selectedActionType: ActionType; - selectedThirdParty: ThirdPartyField; + securitySolutionField: string; + thirdPartyOptions: Array>; + actionTypeOptions: Array>; + onChangeActionType: (caseField: string, newActionType: string) => void; + onChangeThirdParty: (caseField: string, newThirdPartyField: string) => void; + selectedActionType: string; + selectedThirdParty: string; } const FieldMappingRowComponent: React.FC = ({ diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/types.ts b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/types.ts index 4c30932077a61..6cd2200e1dc74 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/types.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/types.ts @@ -4,38 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IErrorObject, ActionType } from '../../../../../types'; +import { ActionType } from '../../../../../types'; -import { - ActionType as ThirdPartySupportedActions, - CaseField, -} from '../../../../../../../case/common/api'; - -export { ThirdPartyField as AllThirdPartyFields } from '../../../../../../../case/common/api'; - -export { ActionType, CaseField }; +export { ActionType }; export interface ThirdPartyField { label: string; - validSourceFields: CaseField[]; - defaultSourceField: CaseField; - defaultActionType: ThirdPartySupportedActions; -} - -export type Optional = Omit & Partial; - -export interface ConnectorFlyoutFormProps { - errors: IErrorObject; - action: T; - onChangeSecret: (key: string, value: string) => void; - onBlurSecret: (key: string) => void; - onChangeConfig: (key: string, value: string) => void; - onBlurConfig: (key: string) => void; -} - -export interface ConnectorFlyoutHOCProps { - ConnectorFormComponent: React.FC>; - connectorActionTypeId: string; - configKeys?: string[]; - secretKeys?: string[]; + validSourceFields: string[]; + defaultSourceField: string; + defaultActionType: string; } diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/utils.ts b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/utils.ts index d3139e80ae3b1..a173d90515302 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/utils.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/case_mappings/utils.ts @@ -3,13 +3,11 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { ActionType, ThirdPartyField } from '../../../../../../../case/common/api'; -import { CaseField } from './types'; import { CasesConfigurationMapping } from '../types'; export const setActionTypeToMapping = ( - caseField: CaseField, - newActionType: ActionType, + caseField: string, + newActionType: string, mapping: CasesConfigurationMapping[] ): CasesConfigurationMapping[] => { const findItemIndex = mapping.findIndex((item) => item.source === caseField); @@ -26,8 +24,8 @@ export const setActionTypeToMapping = ( }; export const setThirdPartyToMapping = ( - caseField: CaseField, - newThirdPartyField: ThirdPartyField, + caseField: string, + newThirdPartyField: string, mapping: CasesConfigurationMapping[] ): CasesConfigurationMapping[] => mapping.map((item) => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx index 2eaa31a111a47..452d9c288926e 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx @@ -33,7 +33,6 @@ describe('ServiceNowActionConnectorFields renders', () => { errors={{ apiUrl: [], username: [], password: [] }} editActionConfig={() => {}} editActionSecrets={() => {}} - editActionProperty={() => {}} docLinks={deps!.docLinks} /> ); @@ -72,7 +71,6 @@ describe('ServiceNowActionConnectorFields renders', () => { errors={{ apiUrl: [], username: [], password: [] }} editActionConfig={() => {}} editActionSecrets={() => {}} - editActionProperty={() => {}} docLinks={deps!.docLinks} /> ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.tsx index 66e4bf7d38443..a5c4849cb63d9 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.tsx @@ -15,21 +15,12 @@ import { } from '@elastic/eui'; import { isEmpty } from 'lodash'; -import { IErrorObject, ActionConnectorFieldsProps } from '../../../../types'; +import { ActionConnectorFieldsProps } from '../../../../types'; import * as i18n from './translations'; import { ServiceNowActionConnector, CasesConfigurationMapping } from './types'; import { connectorConfiguration } from './config'; import { FieldMapping } from './case_mappings/field_mapping'; -export interface ConnectorFlyoutFormProps { - errors: IErrorObject; - action: T; - onChangeSecret: (key: string, value: string) => void; - onBlurSecret: (key: string) => void; - onChangeConfig: (key: string, value: string) => void; - onBlurConfig: (key: string) => void; -} - const ServiceNowConnectorFields: React.FC> = ({ action, editActionSecrets, editActionConfig, errors, consumer }) => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/types.ts b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/types.ts index 7be249440b743..92252efc3a41c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/types.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/types.ts @@ -4,9 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -// to remove -import { CaseField, ThirdPartyField, ActionType } from '../../../../../../case/common/api'; - export interface ServiceNowActionConnector { config: ServiceNowConfig; secrets: ServiceNowSecrets; @@ -43,7 +40,7 @@ interface ServiceNowSecrets { // to remove export interface CasesConfigurationMapping { - source: CaseField; - target: ThirdPartyField; - actionType: ActionType; + source: string; + target: string; + actionType: string; } diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.tsx index cf39b072c222a..813f3598a748d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.tsx @@ -170,7 +170,6 @@ export const ActionConnectorForm = ({ errors={errors} editActionConfig={setActionConfigProperty} editActionSecrets={setActionSecretsProperty} - editActionProperty={setActionProperty} http={http} docLinks={docLinks} consumer={consumer} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_reducer.ts b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_reducer.ts index 7bc148c2dc31a..2e56f4b026b4a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_reducer.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_reducer.ts @@ -25,7 +25,6 @@ export interface AlertReducerAction { key: string; value: {}; index?: number; - subKey?: string; }; } diff --git a/x-pack/plugins/triggers_actions_ui/public/types.ts b/x-pack/plugins/triggers_actions_ui/public/types.ts index 37ba9f5cc7c48..a4a13d7ec849c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/types.ts +++ b/x-pack/plugins/triggers_actions_ui/public/types.ts @@ -29,7 +29,6 @@ export interface ActionConnectorFieldsProps { action: TActionConnector; editActionConfig: (property: string, value: any) => void; editActionSecrets: (property: string, value: any) => void; - editActionProperty?: (property: string, value: any) => void; errors: IErrorObject; docLinks: DocLinksStart; http?: HttpSetup; @@ -77,7 +76,6 @@ export interface ActionConnector { referencedByCount?: number; config: Record; isPreconfigured: boolean; - consumer?: string | null; } export type ActionConnectorWithoutId = Omit;