mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
# Backport This will backport the following commits from `main` to `8.13`: - [[Index Management] Fix allow_auto_create field in index template form (#178321)](https://github.com/elastic/kibana/pull/178321) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-03-12T18:19:03Z","message":"[Index Management] Fix allow_auto_create field in index template form (#178321)\n\nFixes https://github.com/elastic/kibana/issues/177938\r\n\r\n## Summary\r\n\r\nThis PR fixes the \"Allow auto create\" field in the index template form\r\nso that the default value is `undefined` instead of `false`.\r\n\r\nBefore:\r\n<img width=\"1200\" alt=\"Screenshot 2024-03-08 at 14 18 47\"\r\nsrc=\"c5edf280
-f60d-49fe-9614-c8aa3a9e8737\">\r\n\r\n\r\nNow:\r\n<img width=\"1209\" alt=\"Screenshot 2024-03-08 at 14 06 43\"\r\nsrc=\"a887c4f6
-52db-4609-904c-f8f60de8abca\">\r\n\r\n**How to test:**\r\n1. Start Es and Kibana (these changes should be tested in both stateful\r\nand serverless).\r\n2. Go to Stack Management -> Index Management -> Index Templates\r\n3. Start creating a new index template.\r\n4. Try changing the value in the \"Allow auto create\" field and verify\r\nthat the value is correctly displayed in the last (Review) step, in the\r\nSummary tab.\r\n5. After creating an index template, verify that the details flyout\r\ncorrectly displays the \"Allow auto create\" value.\r\n6. Try editing a created index template and verify that the form\r\ncontains the correct value in the \"Allow auto create\" field.\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"f549bffb15679cb21cd51ba7bad060e73f839e2e","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Index Management","Team:Deployment Management","release_note:skip","ui-copy","backport:prev-minor","v8.13.0","v8.14.0"],"title":"[Index Management] Fix allow_auto_create field in index template form","number":178321,"url":"https://github.com/elastic/kibana/pull/178321","mergeCommit":{"message":"[Index Management] Fix allow_auto_create field in index template form (#178321)\n\nFixes https://github.com/elastic/kibana/issues/177938\r\n\r\n## Summary\r\n\r\nThis PR fixes the \"Allow auto create\" field in the index template form\r\nso that the default value is `undefined` instead of `false`.\r\n\r\nBefore:\r\n<img width=\"1200\" alt=\"Screenshot 2024-03-08 at 14 18 47\"\r\nsrc=\"c5edf280
-f60d-49fe-9614-c8aa3a9e8737\">\r\n\r\n\r\nNow:\r\n<img width=\"1209\" alt=\"Screenshot 2024-03-08 at 14 06 43\"\r\nsrc=\"a887c4f6
-52db-4609-904c-f8f60de8abca\">\r\n\r\n**How to test:**\r\n1. Start Es and Kibana (these changes should be tested in both stateful\r\nand serverless).\r\n2. Go to Stack Management -> Index Management -> Index Templates\r\n3. Start creating a new index template.\r\n4. Try changing the value in the \"Allow auto create\" field and verify\r\nthat the value is correctly displayed in the last (Review) step, in the\r\nSummary tab.\r\n5. After creating an index template, verify that the details flyout\r\ncorrectly displays the \"Allow auto create\" value.\r\n6. Try editing a created index template and verify that the form\r\ncontains the correct value in the \"Allow auto create\" field.\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"f549bffb15679cb21cd51ba7bad060e73f839e2e"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/178321","number":178321,"mergeCommit":{"message":"[Index Management] Fix allow_auto_create field in index template form (#178321)\n\nFixes https://github.com/elastic/kibana/issues/177938\r\n\r\n## Summary\r\n\r\nThis PR fixes the \"Allow auto create\" field in the index template form\r\nso that the default value is `undefined` instead of `false`.\r\n\r\nBefore:\r\n<img width=\"1200\" alt=\"Screenshot 2024-03-08 at 14 18 47\"\r\nsrc=\"c5edf280
-f60d-49fe-9614-c8aa3a9e8737\">\r\n\r\n\r\nNow:\r\n<img width=\"1209\" alt=\"Screenshot 2024-03-08 at 14 06 43\"\r\nsrc=\"a887c4f6
-52db-4609-904c-f8f60de8abca\">\r\n\r\n**How to test:**\r\n1. Start Es and Kibana (these changes should be tested in both stateful\r\nand serverless).\r\n2. Go to Stack Management -> Index Management -> Index Templates\r\n3. Start creating a new index template.\r\n4. Try changing the value in the \"Allow auto create\" field and verify\r\nthat the value is correctly displayed in the last (Review) step, in the\r\nSummary tab.\r\n5. After creating an index template, verify that the details flyout\r\ncorrectly displays the \"Allow auto create\" value.\r\n6. Try editing a created index template and verify that the form\r\ncontains the correct value in the \"Allow auto create\" field.\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"f549bffb15679cb21cd51ba7bad060e73f839e2e"}}]}] BACKPORT--> --------- Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com> Co-authored-by: Elena Stoeva <elenastoeva99@gmail.com>
This commit is contained in:
parent
45434581c4
commit
c095a98518
24 changed files with 227 additions and 55 deletions
|
@ -38,7 +38,7 @@ const templateToClone = getComposableTemplate({
|
|||
name: TEMPLATE_NAME,
|
||||
indexPatterns: ['indexPattern1'],
|
||||
template: {},
|
||||
allowAutoCreate: true,
|
||||
allowAutoCreate: 'TRUE',
|
||||
});
|
||||
|
||||
describe('<TemplateClone />', () => {
|
||||
|
|
|
@ -528,7 +528,7 @@ describe('<TemplateCreate />', () => {
|
|||
await actions.completeStepOne({
|
||||
name: TEMPLATE_NAME,
|
||||
indexPatterns: DEFAULT_INDEX_PATTERNS,
|
||||
allowAutoCreate: true,
|
||||
allowAutoCreate: 'TRUE',
|
||||
});
|
||||
// Component templates
|
||||
await actions.completeStepTwo('test_component_template_1');
|
||||
|
@ -556,7 +556,7 @@ describe('<TemplateCreate />', () => {
|
|||
body: JSON.stringify({
|
||||
name: TEMPLATE_NAME,
|
||||
indexPatterns: DEFAULT_INDEX_PATTERNS,
|
||||
allowAutoCreate: true,
|
||||
allowAutoCreate: 'TRUE',
|
||||
dataStream: {},
|
||||
_kbnMeta: {
|
||||
type: 'default',
|
||||
|
@ -655,7 +655,7 @@ describe('<TemplateCreate />', () => {
|
|||
},
|
||||
index_patterns: DEFAULT_INDEX_PATTERNS,
|
||||
data_stream: {},
|
||||
allow_auto_create: false,
|
||||
allow_auto_create: 'NO_OVERWRITE',
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
|
|
@ -145,7 +145,7 @@ describe('<TemplateEdit />', () => {
|
|||
name: 'test',
|
||||
indexPatterns: ['myPattern*'],
|
||||
version: 1,
|
||||
allowAutoCreate: false,
|
||||
allowAutoCreate: 'NO_OVERWRITE',
|
||||
dataStream: {
|
||||
hidden: true,
|
||||
anyUnknownKey: 'should_be_kept',
|
||||
|
@ -210,7 +210,7 @@ describe('<TemplateEdit />', () => {
|
|||
await actions.completeStepOne({
|
||||
indexPatterns: UPDATED_INDEX_PATTERN,
|
||||
priority: 3,
|
||||
allowAutoCreate: true,
|
||||
allowAutoCreate: 'TRUE',
|
||||
});
|
||||
// Component templates
|
||||
await actions.completeStepTwo();
|
||||
|
@ -265,7 +265,7 @@ describe('<TemplateEdit />', () => {
|
|||
indexPatterns: UPDATED_INDEX_PATTERN,
|
||||
priority: 3,
|
||||
version: templateToEdit.version,
|
||||
allowAutoCreate: true,
|
||||
allowAutoCreate: 'TRUE',
|
||||
_kbnMeta: {
|
||||
type: 'default',
|
||||
hasDatastream: false,
|
||||
|
|
|
@ -192,7 +192,17 @@ export const formSetup = async (initTestBed: SetupFunc<TestSubjects>) => {
|
|||
}
|
||||
|
||||
if (allowAutoCreate) {
|
||||
form.toggleEuiSwitch('allowAutoCreateField.input');
|
||||
let optionIndex = 0;
|
||||
if (allowAutoCreate === 'TRUE') {
|
||||
optionIndex = 1;
|
||||
}
|
||||
if (allowAutoCreate === 'FALSE') {
|
||||
optionIndex = 2;
|
||||
}
|
||||
const radioGroup = find('allowAutoCreateField.input');
|
||||
const radioOption = radioGroup.childAt(optionIndex).find('input');
|
||||
radioOption.simulate('change', { target: { checked: true } });
|
||||
component.update();
|
||||
}
|
||||
});
|
||||
component.update();
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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 { i18n } from '@kbn/i18n';
|
||||
|
||||
export const allowAutoCreateRadioIds = {
|
||||
NO_OVERWRITE_RADIO_OPTION: 'NO_OVERWRITE',
|
||||
TRUE_RADIO_OPTION: 'TRUE',
|
||||
FALSE_RADIO_OPTION: 'FALSE',
|
||||
};
|
||||
|
||||
export const allowAutoCreateRadioValues = {
|
||||
[allowAutoCreateRadioIds.NO_OVERWRITE_RADIO_OPTION]: undefined,
|
||||
[allowAutoCreateRadioIds.TRUE_RADIO_OPTION]: true,
|
||||
[allowAutoCreateRadioIds.FALSE_RADIO_OPTION]: false,
|
||||
};
|
||||
|
||||
export const allowAutoCreateRadios = [
|
||||
{
|
||||
id: allowAutoCreateRadioIds.NO_OVERWRITE_RADIO_OPTION,
|
||||
label: i18n.translate(
|
||||
'xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreate.noOverwriteRadioOptionLabel',
|
||||
{
|
||||
defaultMessage: 'Do not overwrite cluster setting',
|
||||
}
|
||||
),
|
||||
},
|
||||
{
|
||||
id: allowAutoCreateRadioIds.TRUE_RADIO_OPTION,
|
||||
label: i18n.translate(
|
||||
'xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreate.trueRadioOptionLabel',
|
||||
{
|
||||
defaultMessage: 'True',
|
||||
}
|
||||
),
|
||||
},
|
||||
{
|
||||
id: allowAutoCreateRadioIds.FALSE_RADIO_OPTION,
|
||||
label: i18n.translate(
|
||||
'xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreate.falseRadioOptionLabel',
|
||||
{
|
||||
defaultMessage: 'False',
|
||||
}
|
||||
),
|
||||
},
|
||||
];
|
|
@ -54,3 +54,4 @@ export { MAJOR_VERSION } from './plugin';
|
|||
|
||||
export { Section, IndexDetailsSection } from './home_sections';
|
||||
export type { IndexDetailsTab, IndexDetailsTabId } from './home_sections';
|
||||
export * from './allow_auto_create';
|
||||
|
|
|
@ -8,7 +8,13 @@
|
|||
// TODO: https://github.com/elastic/kibana/issues/110892
|
||||
/* eslint-disable @kbn/eslint/no_export_all */
|
||||
|
||||
export { API_BASE_PATH, INTERNAL_API_BASE_PATH, BASE_PATH, MAJOR_VERSION } from './constants';
|
||||
export {
|
||||
API_BASE_PATH,
|
||||
INTERNAL_API_BASE_PATH,
|
||||
BASE_PATH,
|
||||
MAJOR_VERSION,
|
||||
allowAutoCreateRadioIds,
|
||||
} from './constants';
|
||||
|
||||
export { getTemplateParameter, splitSizeAndUnits } from './lib';
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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 { deserializeTemplate, serializeTemplate } from './template_serialization';
|
||||
import { TemplateDeserialized, TemplateSerialized } from '../types';
|
||||
|
||||
const defaultSerializedTemplate: TemplateSerialized = {
|
||||
template: {},
|
||||
index_patterns: ['test'],
|
||||
data_stream: {},
|
||||
};
|
||||
|
||||
const defaultDeserializedTemplate: TemplateDeserialized = {
|
||||
name: 'my_template',
|
||||
indexPatterns: ['test'],
|
||||
_kbnMeta: {
|
||||
type: 'default',
|
||||
hasDatastream: true,
|
||||
},
|
||||
allowAutoCreate: 'NO_OVERWRITE',
|
||||
};
|
||||
|
||||
const allowAutoCreateRadioOptions = ['NO_OVERWRITE', 'TRUE', 'FALSE'];
|
||||
const allowAutoCreateSerializedValues = [undefined, true, false];
|
||||
|
||||
describe('Template serialization', () => {
|
||||
describe('serialization of allow_auto_create parameter', () => {
|
||||
describe('deserializeTemplate()', () => {
|
||||
allowAutoCreateSerializedValues.forEach((value, index) => {
|
||||
test(`correctly deserializes ${value} value`, () => {
|
||||
expect(
|
||||
deserializeTemplate({
|
||||
...defaultSerializedTemplate,
|
||||
name: 'my_template',
|
||||
allow_auto_create: value,
|
||||
})
|
||||
).toHaveProperty('allowAutoCreate', allowAutoCreateRadioOptions[index]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('serializeTemplate()', () => {
|
||||
allowAutoCreateRadioOptions.forEach((option, index) => {
|
||||
test(`correctly serializes ${option} radio option`, () => {
|
||||
expect(
|
||||
serializeTemplate({
|
||||
...defaultDeserializedTemplate,
|
||||
allowAutoCreate: option,
|
||||
})
|
||||
).toHaveProperty('allow_auto_create', allowAutoCreateSerializedValues[index]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -13,6 +13,7 @@ import {
|
|||
TemplateType,
|
||||
} from '../types';
|
||||
import { deserializeESLifecycle } from './data_stream_serialization';
|
||||
import { allowAutoCreateRadioValues, allowAutoCreateRadioIds } from '../constants';
|
||||
|
||||
const hasEntries = (data: object = {}) => Object.entries(data).length > 0;
|
||||
|
||||
|
@ -38,7 +39,7 @@ export function serializeTemplate(templateDeserialized: TemplateDeserialized): T
|
|||
data_stream: dataStream,
|
||||
composed_of: composedOf,
|
||||
ignore_missing_component_templates: ignoreMissingComponentTemplates,
|
||||
allow_auto_create: allowAutoCreate,
|
||||
allow_auto_create: allowAutoCreateRadioValues?.[allowAutoCreate],
|
||||
_meta,
|
||||
deprecated,
|
||||
};
|
||||
|
@ -83,7 +84,12 @@ export function deserializeTemplate(
|
|||
composedOf: composedOf ?? [],
|
||||
ignoreMissingComponentTemplates: ignoreMissingComponentTemplates ?? [],
|
||||
dataStream,
|
||||
allowAutoCreate,
|
||||
allowAutoCreate:
|
||||
allowAutoCreate === true
|
||||
? allowAutoCreateRadioIds.TRUE_RADIO_OPTION
|
||||
: allowAutoCreate === false
|
||||
? allowAutoCreateRadioIds.FALSE_RADIO_OPTION
|
||||
: allowAutoCreateRadioIds.NO_OVERWRITE_RADIO_OPTION,
|
||||
_meta,
|
||||
deprecated,
|
||||
_kbnMeta: {
|
||||
|
|
|
@ -49,7 +49,7 @@ export interface TemplateDeserialized {
|
|||
ignoreMissingComponentTemplates?: string[];
|
||||
version?: number;
|
||||
priority?: number; // Composable template only
|
||||
allowAutoCreate?: boolean;
|
||||
allowAutoCreate: string;
|
||||
order?: number; // Legacy template only
|
||||
ilmPolicy?: {
|
||||
name: string;
|
||||
|
|
|
@ -13,6 +13,7 @@ import {
|
|||
EuiButtonEmpty,
|
||||
EuiSpacer,
|
||||
EuiLink,
|
||||
EuiCode,
|
||||
} from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
@ -27,11 +28,13 @@ import {
|
|||
Forms,
|
||||
JsonEditorField,
|
||||
NumericField,
|
||||
RadioGroupField,
|
||||
} from '../../../../shared_imports';
|
||||
import { UnitField, timeUnits } from '../../shared';
|
||||
import { DataRetention } from '../../../../../common';
|
||||
import { documentationService } from '../../../services/documentation';
|
||||
import { schemas, nameConfig, nameConfigWithoutValidations } from '../template_form_schemas';
|
||||
import { allowAutoCreateRadios } from '../../../../../common/constants';
|
||||
|
||||
// Create or Form components with partial props that are common to all instances
|
||||
const UseField = getUseField({ component: Field });
|
||||
|
@ -132,12 +135,15 @@ function getFieldsMeta(esDocsBase: string) {
|
|||
title: i18n.translate('xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreateTitle', {
|
||||
defaultMessage: 'Allow auto create',
|
||||
}),
|
||||
description: i18n.translate(
|
||||
'xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreateDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'Indices can be automatically created even if auto-creation of indices is disabled via actions.auto_create_index.',
|
||||
}
|
||||
description: (
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreateDescription"
|
||||
defaultMessage="This setting overwrites the value of the {settingName} cluster setting. If set to {true} in a template, then indices can be automatically created using that template."
|
||||
values={{
|
||||
settingName: <EuiCode>action.auto_create_index</EuiCode>,
|
||||
true: <EuiCode>true</EuiCode>,
|
||||
}}
|
||||
/>
|
||||
),
|
||||
testSubject: 'allowAutoCreateField',
|
||||
},
|
||||
|
@ -399,7 +405,14 @@ export const StepLogistics: React.FunctionComponent<Props> = React.memo(
|
|||
<FormRow title={allowAutoCreate.title} description={allowAutoCreate.description}>
|
||||
<UseField
|
||||
path="allowAutoCreate"
|
||||
componentProps={{ 'data-test-subj': allowAutoCreate.testSubject }}
|
||||
component={RadioGroupField}
|
||||
componentProps={{
|
||||
'data-test-subj': allowAutoCreate.testSubject,
|
||||
euiFieldProps: {
|
||||
options: allowAutoCreateRadios,
|
||||
name: 'allowAutoCreate radio group',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</FormRow>
|
||||
)}
|
||||
|
|
|
@ -22,6 +22,7 @@ import {
|
|||
EuiCodeBlock,
|
||||
} from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { allowAutoCreateRadioIds } from '../../../../../common/constants';
|
||||
import { serializers } from '../../../../shared_imports';
|
||||
|
||||
import { serializeLegacyTemplate, serializeTemplate } from '../../../../../common/lib';
|
||||
|
@ -192,19 +193,30 @@ export const StepReview: React.FunctionComponent<Props> = React.memo(
|
|||
</EuiDescriptionListDescription>
|
||||
|
||||
{/* Allow auto create */}
|
||||
{isLegacy !== true && (
|
||||
<>
|
||||
<EuiDescriptionListTitle>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.templateForm.stepReview.summaryTab.allowAutoCreateLabel"
|
||||
defaultMessage="Allow auto create"
|
||||
/>
|
||||
</EuiDescriptionListTitle>
|
||||
<EuiDescriptionListDescription>
|
||||
{getDescriptionText(allowAutoCreate)}
|
||||
</EuiDescriptionListDescription>
|
||||
</>
|
||||
)}
|
||||
{isLegacy !== true &&
|
||||
allowAutoCreate !== allowAutoCreateRadioIds.NO_OVERWRITE_RADIO_OPTION && (
|
||||
<>
|
||||
<EuiDescriptionListTitle>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.templateForm.stepReview.summaryTab.allowAutoCreateLabel"
|
||||
defaultMessage="Allow auto create"
|
||||
/>
|
||||
</EuiDescriptionListTitle>
|
||||
<EuiDescriptionListDescription>
|
||||
{allowAutoCreate === allowAutoCreateRadioIds.TRUE_RADIO_OPTION ? (
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.templateForm.stepReview.summaryTab.yesDescriptionText"
|
||||
defaultMessage="Yes"
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.templateForm.stepReview.summaryTab.noDescriptionText"
|
||||
defaultMessage="No"
|
||||
/>
|
||||
)}
|
||||
</EuiDescriptionListDescription>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* components */}
|
||||
{isLegacy !== true && (
|
||||
|
|
|
@ -11,6 +11,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
|
|||
import { EuiSpacer, EuiButton, EuiPageHeader } from '@elastic/eui';
|
||||
import { ScopedHistory } from '@kbn/core/public';
|
||||
|
||||
import { allowAutoCreateRadioIds } from '../../../../common/constants';
|
||||
import { TemplateDeserialized } from '../../../../common';
|
||||
import { serializers, Forms, GlobalFlyout } from '../../../shared_imports';
|
||||
import {
|
||||
|
@ -123,6 +124,7 @@ export const TemplateForm = ({
|
|||
hasDatastream: false,
|
||||
isLegacy,
|
||||
},
|
||||
allowAutoCreate: allowAutoCreateRadioIds.NO_OVERWRITE_RADIO_OPTION,
|
||||
};
|
||||
|
||||
const {
|
||||
|
|
|
@ -20,6 +20,7 @@ import {
|
|||
} from '../../../shared_imports';
|
||||
|
||||
import {
|
||||
allowAutoCreateRadioIds,
|
||||
INVALID_INDEX_PATTERN_CHARS,
|
||||
INVALID_TEMPLATE_NAME_CHARS,
|
||||
} from '../../../../common/constants';
|
||||
|
@ -238,11 +239,11 @@ export const schemas: Record<string, FormSchema> = {
|
|||
},
|
||||
|
||||
allowAutoCreate: {
|
||||
type: FIELD_TYPES.TOGGLE,
|
||||
type: FIELD_TYPES.RADIO_GROUP,
|
||||
label: i18n.translate('xpack.idxMgmt.templateForm.stepLogistics.fieldAllowAutoCreateLabel', {
|
||||
defaultMessage: 'Allow auto create (optional)',
|
||||
defaultMessage: 'Allow auto create',
|
||||
}),
|
||||
defaultValue: false,
|
||||
defaultValue: allowAutoCreateRadioIds.NO_OVERWRITE_RADIO_OPTION,
|
||||
},
|
||||
_meta: {
|
||||
label: i18n.translate('xpack.idxMgmt.templateForm.stepLogistics.metaFieldEditorLabel', {
|
||||
|
|
|
@ -25,6 +25,7 @@ import { getLifecycleValue } from '../../../../../lib/data_streams';
|
|||
import { TemplateDeserialized } from '../../../../../../../common';
|
||||
import { ILM_PAGES_POLICY_EDIT } from '../../../../../constants';
|
||||
import { useIlmLocator } from '../../../../../services/use_ilm_locator';
|
||||
import { allowAutoCreateRadioIds } from '../../../../../../../common/constants';
|
||||
|
||||
interface Props {
|
||||
templateDetails: TemplateDeserialized;
|
||||
|
@ -216,19 +217,22 @@ export const TabSummary: React.FunctionComponent<Props> = ({ templateDetails })
|
|||
)}
|
||||
|
||||
{/* Allow auto create */}
|
||||
{isLegacy !== true && (
|
||||
<>
|
||||
<EuiDescriptionListTitle>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.templateDetails.summaryTab.allowAutoCreateDescriptionListTitle"
|
||||
defaultMessage="Allow auto create"
|
||||
/>
|
||||
</EuiDescriptionListTitle>
|
||||
<EuiDescriptionListDescription>
|
||||
{allowAutoCreate ? i18nTexts.yes : i18nTexts.no}
|
||||
</EuiDescriptionListDescription>
|
||||
</>
|
||||
)}
|
||||
{isLegacy !== true &&
|
||||
allowAutoCreate !== allowAutoCreateRadioIds.NO_OVERWRITE_RADIO_OPTION && (
|
||||
<>
|
||||
<EuiDescriptionListTitle>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.templateDetails.summaryTab.allowAutoCreateDescriptionListTitle"
|
||||
defaultMessage="Allow auto create"
|
||||
/>
|
||||
</EuiDescriptionListTitle>
|
||||
<EuiDescriptionListDescription>
|
||||
{allowAutoCreate === allowAutoCreateRadioIds.TRUE_RADIO_OPTION
|
||||
? i18nTexts.yes
|
||||
: i18nTexts.no}
|
||||
</EuiDescriptionListDescription>
|
||||
</>
|
||||
)}
|
||||
</EuiDescriptionList>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
|
|
|
@ -67,6 +67,7 @@ export {
|
|||
NumericField,
|
||||
JsonEditorField,
|
||||
ComboBoxField,
|
||||
RadioGroupField,
|
||||
} from '@kbn/es-ui-shared-plugin/static/forms/components';
|
||||
|
||||
export { isJSON } from '@kbn/es-ui-shared-plugin/static/validators/string';
|
||||
|
|
|
@ -13,7 +13,7 @@ export const templateSchema = schema.object({
|
|||
version: schema.maybe(schema.number()),
|
||||
order: schema.maybe(schema.number()),
|
||||
priority: schema.maybe(schema.number()),
|
||||
allowAutoCreate: schema.maybe(schema.boolean()),
|
||||
allowAutoCreate: schema.string(),
|
||||
template: schema.maybe(
|
||||
schema.object({
|
||||
settings: schema.maybe(schema.object({}, { unknowns: 'allow' })),
|
||||
|
|
|
@ -22,7 +22,7 @@ export const getComposableTemplate = ({
|
|||
hasDatastream = false,
|
||||
isLegacy = false,
|
||||
type = 'default',
|
||||
allowAutoCreate = false,
|
||||
allowAutoCreate = 'NO_OVERWRITE',
|
||||
composedOf = [],
|
||||
}: Partial<
|
||||
TemplateDeserialized & {
|
||||
|
@ -70,7 +70,7 @@ export const getTemplate = ({
|
|||
hasDatastream = false,
|
||||
isLegacy = false,
|
||||
type = 'default',
|
||||
allowAutoCreate = false,
|
||||
allowAutoCreate = 'NO_OVERWRITE',
|
||||
}: Partial<
|
||||
TemplateDeserialized & {
|
||||
isLegacy?: boolean;
|
||||
|
|
|
@ -20850,7 +20850,6 @@
|
|||
"xpack.idxMgmt.templateForm.saveButtonLabel": "Enregistrer le modèle",
|
||||
"xpack.idxMgmt.templateForm.saveTemplateError": "Impossible de créer le modèle",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.addMetadataLabel": "Ajouter des métadonnées",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreateDescription": "Les index peuvent être créés automatiquement même si l'auto-création des index est désactivée via actions.auto_création_index.",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreateTitle": "Autoriser l'auto-création",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.dataRetentionDescription": "Les données seront conservées au moins pour cette durée avant leur suppression automatique.",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.dataRetentionFieldDecimalError": "La valeur doit être un nombre entier.",
|
||||
|
|
|
@ -20828,7 +20828,6 @@
|
|||
"xpack.idxMgmt.templateForm.saveButtonLabel": "テンプレートを保存",
|
||||
"xpack.idxMgmt.templateForm.saveTemplateError": "テンプレートを作成できません",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.addMetadataLabel": "メタデータを追加",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreateDescription": "actions.auto_create_indexでインデックスの自動作成が無効になっている場合でも、インデックスを自動的に作成できます。",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreateTitle": "自動作成を許可",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.dataRetentionDescription": "データは自動的に削除されるまで、少なくともこの期間保存されます。",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.dataRetentionFieldDecimalError": "値は整数でなければなりません。",
|
||||
|
|
|
@ -20857,7 +20857,6 @@
|
|||
"xpack.idxMgmt.templateForm.saveButtonLabel": "保存模板",
|
||||
"xpack.idxMgmt.templateForm.saveTemplateError": "无法创建模板",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.addMetadataLabel": "添加元数据",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreateDescription": "即使通过 actions.auto_create_index 禁止自动创建索引,仍可以自动创建索引。",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.allowAutoCreateTitle": "允许自动创建",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.dataRetentionDescription": "将至少在这个时长内保留数据,然后自动将其删除。",
|
||||
"xpack.idxMgmt.templateForm.stepLogistics.dataRetentionFieldDecimalError": "此值应为整数。",
|
||||
|
|
|
@ -51,6 +51,7 @@ export function templatesHelpers(getService: FtrProviderContext['getService']) {
|
|||
type: 'default',
|
||||
hasDatastream: false,
|
||||
},
|
||||
allowAutoCreate: 'NO_OVERWRITE',
|
||||
};
|
||||
|
||||
if (isLegacy) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
import { TemplateDeserialized } from '@kbn/index-management-plugin/common';
|
||||
import { TemplateDeserialized, allowAutoCreateRadioIds } from '@kbn/index-management-plugin/common';
|
||||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
import { templatesApi } from './lib/templates.api';
|
||||
import { templatesHelpers } from './lib/templates.helpers';
|
||||
|
@ -99,6 +99,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'ignoreMissingComponentTemplates',
|
||||
'version',
|
||||
'_kbnMeta',
|
||||
'allowAutoCreate',
|
||||
].sort();
|
||||
|
||||
expect(Object.keys(indexTemplateFound).sort()).to.eql(expectedKeys);
|
||||
|
@ -119,6 +120,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'order',
|
||||
'version',
|
||||
'_kbnMeta',
|
||||
'allowAutoCreate',
|
||||
'composedOf',
|
||||
'ignoreMissingComponentTemplates',
|
||||
].sort();
|
||||
|
@ -145,6 +147,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'dataStream',
|
||||
'version',
|
||||
'_kbnMeta',
|
||||
'allowAutoCreate',
|
||||
].sort();
|
||||
|
||||
expect(Object.keys(templateWithDSL).sort()).to.eql(expectedWithDSLKeys);
|
||||
|
@ -168,6 +171,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'ignoreMissingComponentTemplates',
|
||||
'version',
|
||||
'_kbnMeta',
|
||||
'allowAutoCreate',
|
||||
].sort();
|
||||
|
||||
expect(Object.keys(templateWithILM).sort()).to.eql(expectedWithILMKeys);
|
||||
|
@ -191,6 +195,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'priority',
|
||||
'version',
|
||||
'_kbnMeta',
|
||||
'allowAutoCreate',
|
||||
].sort();
|
||||
const expectedTemplateKeys = ['aliases', 'mappings', 'settings'].sort();
|
||||
|
||||
|
@ -211,6 +216,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'order',
|
||||
'version',
|
||||
'_kbnMeta',
|
||||
'allowAutoCreate',
|
||||
'composedOf',
|
||||
'ignoreMissingComponentTemplates',
|
||||
].sort();
|
||||
|
@ -366,6 +372,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
const templateName = `deprecated_template-${getRandomString()}`;
|
||||
const indexTemplate: TemplateDeserialized = {
|
||||
_kbnMeta: { hasDatastream: false, type: 'default' },
|
||||
allowAutoCreate: allowAutoCreateRadioIds.NO_OVERWRITE_RADIO_OPTION,
|
||||
name: templateName,
|
||||
indexPatterns: [getRandomString()],
|
||||
template: {},
|
||||
|
|
|
@ -103,6 +103,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'hasAliases',
|
||||
'hasMappings',
|
||||
'_kbnMeta',
|
||||
'allowAutoCreate',
|
||||
'composedOf',
|
||||
'ignoreMissingComponentTemplates',
|
||||
].sort();
|
||||
|
@ -124,6 +125,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'indexPatterns',
|
||||
'template',
|
||||
'_kbnMeta',
|
||||
'allowAutoCreate',
|
||||
'composedOf',
|
||||
'ignoreMissingComponentTemplates',
|
||||
].sort();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue