-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mappings editor] Add support for constant_keyword field type #76564
Merged
alisonelizabeth
merged 11 commits into
elastic:master
from
alisonelizabeth:feature/mappings_editor/constant_keyword_field
Sep 17, 2020
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
df653c5
add support for constant_keyword field type in mappings editor
alisonelizabeth e7668d1
Update x-pack/plugins/index_management/public/application/components/…
alisonelizabeth 428e751
Update x-pack/plugins/index_management/public/application/components/…
alisonelizabeth 5c81eee
Update x-pack/plugins/index_management/public/application/components/…
alisonelizabeth ac11798
address copy feedback
alisonelizabeth 7cc25b8
Merge branch 'master' into feature/mappings_editor/constant_keyword_f…
elasticmachine d6c3dc6
Merge branch 'master' into feature/mappings_editor/constant_keyword_f…
elasticmachine 37f68ad
Merge branch 'master' of github.com:elastic/kibana into feature/mappi…
alisonelizabeth f919daa
address review feedback
alisonelizabeth 22caf79
add additional validation for meta parameter
alisonelizabeth 5c75148
Merge branch 'master' into feature/mappings_editor/constant_keyword_f…
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
...s/mappings_editor/components/document_fields/fields/field_types/constant_keyword_type.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import React, { FunctionComponent } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { documentationService } from '../../../../../../services/documentation'; | ||
import { UseField, Field, JsonEditorField } from '../../../../shared_imports'; | ||
import { getFieldConfig } from '../../../../lib'; | ||
import { NormalizedField } from '../../../../types'; | ||
import { AdvancedParametersSection, EditFieldFormRow, BasicParametersSection } from '../edit_field'; | ||
|
||
interface Props { | ||
field: NormalizedField; | ||
} | ||
|
||
export const ConstantKeywordType: FunctionComponent<Props> = ({ field }) => { | ||
return ( | ||
<> | ||
<BasicParametersSection> | ||
{/* Value field */} | ||
<EditFieldFormRow | ||
title={i18n.translate('xpack.idxMgmt.mappingsEditor.constantKeyword.valueFieldTitle', { | ||
defaultMessage: 'Set value', | ||
})} | ||
description={i18n.translate( | ||
'xpack.idxMgmt.mappingsEditor.constantKeyword.valueFieldDescription', | ||
{ | ||
defaultMessage: | ||
'The value of this field for all documents in the index. If not specified, defaults to the value specified in the first document indexed.', | ||
} | ||
)} | ||
defaultToggleValue={field.source?.value !== undefined} | ||
> | ||
<UseField path="value" config={getFieldConfig('value')} component={Field} /> | ||
</EditFieldFormRow> | ||
</BasicParametersSection> | ||
|
||
<AdvancedParametersSection> | ||
{/* Meta field */} | ||
<EditFieldFormRow | ||
title={i18n.translate('xpack.idxMgmt.mappingsEditor.constantKeyword.metaFieldTitle', { | ||
defaultMessage: 'Set metadata', | ||
})} | ||
description={i18n.translate( | ||
'xpack.idxMgmt.mappingsEditor.constantKeyword.metaFieldDescription', | ||
{ | ||
defaultMessage: | ||
'Arbitrary information about the field. Specify as JSON key-value pairs.', | ||
} | ||
)} | ||
defaultToggleValue={field.source?.meta !== undefined} | ||
docLink={{ | ||
text: i18n.translate('xpack.idxMgmt.mappingsEditor.constantKeyword.metaDocLinkText', { | ||
defaultMessage: 'Metadata documentation', | ||
}), | ||
href: documentationService.getMetaLink(), | ||
}} | ||
> | ||
<UseField | ||
path="meta" | ||
config={getFieldConfig('meta')} | ||
component={JsonEditorField} | ||
componentProps={{ | ||
euiCodeEditorProps: { | ||
height: '300px', | ||
'aria-label': i18n.translate( | ||
'xpack.idxMgmt.mappingsEditor.constantKeyword.metaFieldAriaLabel', | ||
{ | ||
defaultMessage: 'metadata field data editor', | ||
} | ||
), | ||
}, | ||
}} | ||
/> | ||
</EditFieldFormRow> | ||
</AdvancedParametersSection> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here as in #76671. No need anymore of the
try/catch