diff --git a/cypress/integration/create_index.js b/cypress/integration/create_index.js index f1a78f55d..1b6709568 100644 --- a/cypress/integration/create_index.js +++ b/cypress/integration/create_index.js @@ -181,7 +181,7 @@ describe("Create Index", () => { .type('{ "index.blocks.write": true, "index.number_of_shards": "3" }', { parseSpecialCharSequences: false, force: true }) .end() .wait(1000) - .get('[placeholder="The number of replica shards each primary shard should have."]') + .get('[placeholder="Specify number of replicas."]') .clear() .type(2) .end(); diff --git a/public/lib/field/rules/index.ts b/public/lib/field/rules/index.ts index 9ca515d6d..d26b0d365 100644 --- a/public/lib/field/rules/index.ts +++ b/public/lib/field/rules/index.ts @@ -45,6 +45,10 @@ const rules = { const isNum = typeof value === "number"; const isStr = typeof value === "string"; + if (value === "") { + return ""; + } + if (isNum) { key = "number"; } else if (isStr) { diff --git a/public/pages/Aliases/containers/CreateAlias/index.tsx b/public/pages/Aliases/containers/CreateAlias/index.tsx index 5003d8d12..4cbb815ec 100644 --- a/public/pages/Aliases/containers/CreateAlias/index.tsx +++ b/public/pages/Aliases/containers/CreateAlias/index.tsx @@ -123,7 +123,9 @@ export default function CreateAlias(props: ICreateAliasProps) { {isEdit && filterByMinimatch(props.alias?.alias || "", SYSTEM_ALIAS) ? ( <> - You are editing a system-like alias, please be careful before you do any change to it. + + This alias may contain critical system data. Changing system aliases may break OpenSearch. + ) : null} @@ -202,14 +204,20 @@ export default function CreateAlias(props: ICreateAliasProps) { alias: values.alias, index, })); - result = await services?.commonService.apiCaller({ - endpoint: "indices.updateAliases", - data: { - body: { - actions, + if (actions.length === 0) { + result = { + ok: true, + }; + } else { + result = await services?.commonService.apiCaller({ + endpoint: "indices.updateAliases", + data: { + body: { + actions, + }, }, - }, - }); + }); + } } else { result = await services?.commonService.apiCaller({ endpoint: "indices.putAlias", diff --git a/public/pages/Aliases/containers/DeleteAliasModal/DeleteAliasModal.tsx b/public/pages/Aliases/containers/DeleteAliasModal/DeleteAliasModal.tsx index 5b3b320e0..727c1f3ee 100644 --- a/public/pages/Aliases/containers/DeleteAliasModal/DeleteAliasModal.tsx +++ b/public/pages/Aliases/containers/DeleteAliasModal/DeleteAliasModal.tsx @@ -74,7 +74,9 @@ export default function DeleteAliasModal(props: DeleteAliasModalProps) { {hasSystemIndex ? ( <> - You are trying to delete system-like alias, please be careful. + + These aliases may contain critical system data. Deleting system aliases may break OpenSearch. + ) : null} diff --git a/public/pages/CreateIndex/components/IndexDetail/IndexDetail.tsx b/public/pages/CreateIndex/components/IndexDetail/IndexDetail.tsx index a55f1ba11..f718fdcee 100644 --- a/public/pages/CreateIndex/components/IndexDetail/IndexDetail.tsx +++ b/public/pages/CreateIndex/components/IndexDetail/IndexDetail.tsx @@ -261,6 +261,9 @@ const IndexDetail = ( }, { validator(rule, value, values) { + if (!value) { + return Promise.reject("Number of primary shards is required."); + } if (Number(value) !== parseInt(value)) { return Promise.reject("Number of primary shards must be an integer."); } @@ -270,7 +273,7 @@ const IndexDetail = ( }, ], props: { - placeholder: "The number of primary shards in the index. Default is 1.", + placeholder: "Specify primary shard count.", }, }, }, @@ -290,6 +293,9 @@ const IndexDetail = ( }, { validator(rule, value, values) { + if (!value) { + return Promise.reject("Number of replicas is required."); + } if (Number(value) !== parseInt(value)) { return Promise.reject("Number of replicas must be an integer."); } @@ -299,7 +305,7 @@ const IndexDetail = ( }, ], props: { - placeholder: "The number of replica shards each primary shard should have.", + placeholder: "Specify number of replicas.", }, }, }, @@ -329,7 +335,9 @@ const IndexDetail = ( <> {isEdit && !readonly && filterByMinimatch(value?.index as string, SYSTEM_INDEX) ? ( <> - You are editing a system-like index, please be careful before you do any change to it. + + This index may contain critical system data. Changing system indexes may break OpenSearch. + ) : null} @@ -475,13 +483,13 @@ const IndexDetail = ( helpText: ( <>

- Specify a comma-delimited list of settings. + Specify a comma-delimited list of settings.{" "} View index settings.

- All the settings will be handled in flat structure. + All the settings will be handled in flat structure.{" "} - See previous settings + See previous mappings diff --git a/public/pages/CreateIndexTemplate/components/IndexSettings/IndexSettings.tsx b/public/pages/CreateIndexTemplate/components/IndexSettings/IndexSettings.tsx index 8d08b50f6..058fb6888 100644 --- a/public/pages/CreateIndexTemplate/components/IndexSettings/IndexSettings.tsx +++ b/public/pages/CreateIndexTemplate/components/IndexSettings/IndexSettings.tsx @@ -50,6 +50,9 @@ export default function IndexSettings(props: SubDetailProps) { }, { validator(rule, value) { + if (!value) { + return Promise.reject("Number of primary shards is required."); + } if (Number(value) !== parseInt(value)) { return Promise.reject("Number of primary shards must be an integer."); } @@ -78,6 +81,9 @@ export default function IndexSettings(props: SubDetailProps) { }, { validator(rule, value) { + if (!value) { + return Promise.reject("Number of replicas is required."); + } if (Number(value) !== parseInt(value)) { return Promise.reject("Number of replicas must be an integer"); } diff --git a/public/pages/CreateIndexTemplate/containers/CreateIndexTemplate/__snapshots__/CreateIndexTemplate.test.tsx.snap b/public/pages/CreateIndexTemplate/containers/CreateIndexTemplate/__snapshots__/CreateIndexTemplate.test.tsx.snap index 10df6b780..3d704df9a 100644 --- a/public/pages/CreateIndexTemplate/containers/CreateIndexTemplate/__snapshots__/CreateIndexTemplate.test.tsx.snap +++ b/public/pages/CreateIndexTemplate/containers/CreateIndexTemplate/__snapshots__/CreateIndexTemplate.test.tsx.snap @@ -23,7 +23,7 @@ exports[` spec it goes to templates page when click cance style="flex-direction: row;" >