diff --git a/x-pack/plugins/entity_manager/public/pages/entity_manager/create/components/identity_fields.tsx b/x-pack/plugins/entity_manager/public/pages/entity_manager/create/components/identity_fields.tsx new file mode 100644 index 0000000000000..167ee4b541b79 --- /dev/null +++ b/x-pack/plugins/entity_manager/public/pages/entity_manager/create/components/identity_fields.tsx @@ -0,0 +1,73 @@ +/* + * 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 { Control, Controller, useFieldArray } from 'react-hook-form'; +import { EntityDefinition } from '@kbn/entities-schema'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiFieldText, + EuiButtonIcon, + EuiFormRow, + EuiSpacer, +} from '@elastic/eui'; + +export function IdentityFieldsInput({ control }: { control: Control }) { + const identityFormFields = useFieldArray({ control, name: 'identityFields' }); + + return ( + identityFormFields.append({ field: '', optional: false })} + /> + } + > + <> + {identityFormFields.fields.map((item, index) => { + return ( + ( + <> + + + { + e.preventDefault(); + identityFormFields.update(index, { ...item, field: e.target.value }); + }} + fullWidth + /> + + + {identityFormFields.fields.length > 1 ? ( + identityFormFields.remove(index)} + /> + ) : null} + + + + + + )} + /> + ); + })} + + + ); +} diff --git a/x-pack/plugins/entity_manager/public/pages/entity_manager/create/components/metadata.tsx b/x-pack/plugins/entity_manager/public/pages/entity_manager/create/components/metadata.tsx new file mode 100644 index 0000000000000..dcd1b2b9fda76 --- /dev/null +++ b/x-pack/plugins/entity_manager/public/pages/entity_manager/create/components/metadata.tsx @@ -0,0 +1,88 @@ +/* + * 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 { Control, Controller, useFieldArray } from 'react-hook-form'; +import { EntityDefinition } from '@kbn/entities-schema'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiFieldText, + EuiButtonIcon, + EuiFormRow, + EuiSpacer, +} from '@elastic/eui'; + +export function MetadataFieldsInput({ control }: { control: Control }) { + const metadataFields = useFieldArray({ control, name: 'metadata' }); + + return ( + + metadataFields.append({ + source: '', + destination: '', + aggregation: { type: 'terms', limit: 10 }, + }) + } + /> + } + > + <> + {metadataFields.fields.map((item, index) => { + return ( + ( + <> + + + + metadataFields.update(index, { ...item, source: e.target.value }) + } + fullWidth + /> + + + + metadataFields.update(index, { ...item, destination: e.target.value }) + } + fullWidth + /> + + + metadataFields.remove(index)} + /> + + + + + + )} + /> + ); + })} + + + ); +} diff --git a/x-pack/plugins/entity_manager/public/pages/entity_manager/create/create.tsx b/x-pack/plugins/entity_manager/public/pages/entity_manager/create/create.tsx index 961edabb14335..26041d727d8f9 100644 --- a/x-pack/plugins/entity_manager/public/pages/entity_manager/create/create.tsx +++ b/x-pack/plugins/entity_manager/public/pages/entity_manager/create/create.tsx @@ -15,6 +15,8 @@ import { useKibana } from '../../../hooks/use_kibana'; import { paths } from '../../../../common/locators/paths'; import { ENTITY_MANAGER_LABEL } from '../../../../common/translations'; import { IndexPatternInput } from './components/index_pattern'; +import { IdentityFieldsInput } from './components/identity_fields'; +import { MetadataFieldsInput } from './components/metadata'; const PAGE_TITLE = i18n.translate('xpack.entityManager.createPage.title', { defaultMessage: 'Create new definition', @@ -23,7 +25,10 @@ const PAGE_TITLE = i18n.translate('xpack.entityManager.createPage.title', { const DEFAULT_VALUES = { id: '', name: '', + type: '', indexPatterns: [], + identityFields: [{ field: '', optional: false }], + metadata: [], }; export function EntityManagerCreatePage() { @@ -50,9 +55,7 @@ export function EntityManagerCreatePage() { }); const { control, handleSubmit } = methods; - const onSubmit: SubmitHandler = (data) => { - console.log(data); - }; + const onSubmit: SubmitHandler = (data) => {}; return ( @@ -69,6 +72,19 @@ export function EntityManagerCreatePage() { )} /> + + ( + + + + )} + /> + )} /> + + + + + + Submit diff --git a/x-pack/plugins/entity_manager/public/pages/entity_manager/details/components/transform_details_panel.tsx b/x-pack/plugins/entity_manager/public/pages/entity_manager/details/components/transform_details_panel.tsx index 5f7afbe1e9a5b..6cd0d8d106520 100644 --- a/x-pack/plugins/entity_manager/public/pages/entity_manager/details/components/transform_details_panel.tsx +++ b/x-pack/plugins/entity_manager/public/pages/entity_manager/details/components/transform_details_panel.tsx @@ -39,7 +39,7 @@ export function TransformDetailsPanel({ stats, transform }: TransformDetailsPane const checkpointStats = [ { - name: 'Last detected chagnes', + name: 'Last detected changes', value: moment(stats.checkpointing.changes_last_detected_at).format('ll LTS'), }, {