-
Notifications
You must be signed in to change notification settings - Fork 8.3k
/
field_mapping.tsx
69 lines (63 loc) · 2.2 KB
/
field_mapping.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import { EuiFlexItem, EuiFlexGroup, EuiFormLabel, useEuiFontSize } from '@elastic/eui';
import { css } from '@emotion/react';
import { FieldMappingRowStatic } from './field_mapping_row_static';
import * as i18n from './translations';
import type { CaseConnectorMapping } from '../../containers/configure/types';
export interface FieldMappingProps {
actionTypeName: string;
isLoading: boolean;
mappings: CaseConnectorMapping[];
}
const FieldMappingComponent: React.FC<FieldMappingProps> = ({
actionTypeName,
isLoading,
mappings,
}) => {
const sFontSize = useEuiFontSize('s').fontSize;
return mappings.length ? (
<EuiFlexGroup direction="column" gutterSize="none">
<EuiFlexItem>
{' '}
<EuiFlexGroup responsive={false}>
<EuiFlexItem>
<EuiFormLabel>{i18n.FIELD_MAPPING_FIRST_COL}</EuiFormLabel>
</EuiFlexItem>
<EuiFlexItem data-test-subj="case-configure-field-mappings-second-col-label">
<EuiFormLabel>{i18n.FIELD_MAPPING_SECOND_COL(actionTypeName)}</EuiFormLabel>
</EuiFlexItem>
<EuiFlexItem>
<EuiFormLabel>{i18n.FIELD_MAPPING_THIRD_COL}</EuiFormLabel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<div
data-test-subj="case-configure-field-mappings-row-wrapper"
css={css`
margin: 10px 0;
font-size: ${sFontSize};
`}
>
{mappings.map((item) => (
<FieldMappingRowStatic
key={`${item.source}`}
casesField={item.source}
isLoading={isLoading}
selectedActionType={item.actionType}
selectedThirdParty={item.target ?? 'not_mapped'}
/>
))}
</div>
</EuiFlexItem>
</EuiFlexGroup>
) : null;
};
FieldMappingComponent.displayName = 'FieldMapping';
export const FieldMapping = React.memo(FieldMappingComponent);