44 * you may not use this file except in compliance with the Elastic License.
55 */
66import React , { useEffect } from 'react' ;
7- import { EuiFlexGroup , EuiFlexItem , EuiTitle , EuiButtonEmpty , EuiSpacer } from '@elastic/eui' ;
7+ import {
8+ EuiFlexGroup ,
9+ EuiFlexItem ,
10+ EuiTitle ,
11+ EuiButtonEmpty ,
12+ EuiSpacer ,
13+ EuiLink ,
14+ } from '@elastic/eui' ;
815import { FormattedMessage } from '@kbn/i18n/react' ;
916import { i18n } from '@kbn/i18n' ;
1017
@@ -25,56 +32,82 @@ import { schemas, nameConfig, nameConfigWithoutValidations } from '../template_f
2532const UseField = getUseField ( { component : Field } ) ;
2633const FormRow = getFormRow ( { titleTag : 'h3' } ) ;
2734
28- const fieldsMeta = {
29- name : {
30- title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.nameTitle' , {
31- defaultMessage : 'Name' ,
32- } ) ,
33- description : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.nameDescription' , {
34- defaultMessage : 'A unique identifier for this template.' ,
35- } ) ,
36- testSubject : 'nameField' ,
37- } ,
38- indexPatterns : {
39- title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.indexPatternsTitle' , {
40- defaultMessage : 'Index patterns' ,
41- } ) ,
42- description : i18n . translate (
43- 'xpack.idxMgmt.templateForm.stepLogistics.indexPatternsDescription' ,
44- {
45- defaultMessage : 'The index patterns to apply to the template.' ,
46- }
47- ) ,
48- testSubject : 'indexPatternsField' ,
49- } ,
50- order : {
51- title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.orderTitle' , {
52- defaultMessage : 'Merge order' ,
53- } ) ,
54- description : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.orderDescription' , {
55- defaultMessage : 'The merge order when multiple templates match an index.' ,
56- } ) ,
57- testSubject : 'orderField' ,
58- } ,
59- priority : {
60- title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.priorityTitle' , {
61- defaultMessage : 'Priority' ,
62- } ) ,
63- description : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.priorityDescription' , {
64- defaultMessage : 'Only the highest priority template will be applied.' ,
65- } ) ,
66- testSubject : 'priorityField' ,
67- } ,
68- version : {
69- title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.versionTitle' , {
70- defaultMessage : 'Version' ,
71- } ) ,
72- description : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.versionDescription' , {
73- defaultMessage : 'A number that identifies the template to external management systems.' ,
74- } ) ,
75- testSubject : 'versionField' ,
76- } ,
77- } ;
35+ function getFieldsMeta ( esDocsBase : string ) {
36+ return {
37+ name : {
38+ title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.nameTitle' , {
39+ defaultMessage : 'Name' ,
40+ } ) ,
41+ description : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.nameDescription' , {
42+ defaultMessage : 'A unique identifier for this template.' ,
43+ } ) ,
44+ testSubject : 'nameField' ,
45+ } ,
46+ indexPatterns : {
47+ title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.indexPatternsTitle' , {
48+ defaultMessage : 'Index patterns' ,
49+ } ) ,
50+ description : i18n . translate (
51+ 'xpack.idxMgmt.templateForm.stepLogistics.indexPatternsDescription' ,
52+ {
53+ defaultMessage : 'The index patterns to apply to the template.' ,
54+ }
55+ ) ,
56+ testSubject : 'indexPatternsField' ,
57+ } ,
58+ dataStream : {
59+ title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.dataStreamTitle' , {
60+ defaultMessage : 'Data stream' ,
61+ } ) ,
62+ description : (
63+ < FormattedMessage
64+ id = "xpack.idxMgmt.templateForm.stepLogistics.dataStreamDescription"
65+ defaultMessage = "Wheter indices that match the index patterns should automatically create a data stream. {docsLink}"
66+ values = { {
67+ docsLink : (
68+ < >
69+ < br />
70+ < EuiLink href = { `${ esDocsBase } /data-streams.html` } target = "_blank" >
71+ { i18n . translate ( 'xpack.idxMgmt.mappingsEditor.dynamicMappingDocumentionLink' , {
72+ defaultMessage : 'Learn more about data streams.' ,
73+ } ) }
74+ </ EuiLink >
75+ </ >
76+ ) ,
77+ } }
78+ />
79+ ) ,
80+ testSubject : 'dataStreamField' ,
81+ } ,
82+ order : {
83+ title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.orderTitle' , {
84+ defaultMessage : 'Merge order' ,
85+ } ) ,
86+ description : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.orderDescription' , {
87+ defaultMessage : 'The merge order when multiple templates match an index.' ,
88+ } ) ,
89+ testSubject : 'orderField' ,
90+ } ,
91+ priority : {
92+ title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.priorityTitle' , {
93+ defaultMessage : 'Priority' ,
94+ } ) ,
95+ description : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.priorityDescription' , {
96+ defaultMessage : 'Only the highest priority template will be applied.' ,
97+ } ) ,
98+ testSubject : 'priorityField' ,
99+ } ,
100+ version : {
101+ title : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.versionTitle' , {
102+ defaultMessage : 'Version' ,
103+ } ) ,
104+ description : i18n . translate ( 'xpack.idxMgmt.templateForm.stepLogistics.versionDescription' , {
105+ defaultMessage : 'A number that identifies the template to external management systems.' ,
106+ } ) ,
107+ testSubject : 'versionField' ,
108+ } ,
109+ } ;
110+ }
78111
79112interface LogisticsForm {
80113 [ key : string ] : any ;
@@ -144,7 +177,9 @@ export const StepLogistics: React.FunctionComponent<Props> = React.memo(
144177 return subscription . unsubscribe ;
145178 } , [ onChange ] ) ; // eslint-disable-line react-hooks/exhaustive-deps
146179
147- const { name, indexPatterns, order, priority, version } = fieldsMeta ;
180+ const { name, indexPatterns, dataStream, order, priority, version } = getFieldsMeta (
181+ documentationService . getEsDocsBase ( )
182+ ) ;
148183
149184 return (
150185 < >
@@ -207,6 +242,16 @@ export const StepLogistics: React.FunctionComponent<Props> = React.memo(
207242 />
208243 </ FormRow >
209244
245+ { /* Create data stream */ }
246+ { isLegacy !== true && (
247+ < FormRow title = { dataStream . title } description = { dataStream . description } >
248+ < UseField
249+ path = "dataStream"
250+ componentProps = { { 'data-test-subj' : dataStream . testSubject } }
251+ />
252+ </ FormRow >
253+ ) }
254+
210255 { /* Order */ }
211256 { isLegacy && (
212257 < FormRow title = { order . title } description = { order . description } >
0 commit comments