Skip to content
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

Minor changes for v2.5 #559

Merged
merged 10 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/integration/create_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions public/lib/field/rules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 16 additions & 8 deletions public/pages/Aliases/containers/CreateAlias/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ export default function CreateAlias(props: ICreateAliasProps) {
<EuiModalBody>
{isEdit && filterByMinimatch(props.alias?.alias || "", SYSTEM_ALIAS) ? (
<>
<EuiCallOut color="warning">You are editing a system-like alias, please be careful before you do any change to it.</EuiCallOut>
<EuiCallOut color="warning">
This alias may contain critical system data. Changing system aliases may break OpenSearch.
</EuiCallOut>
<EuiSpacer />
</>
) : null}
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export default function DeleteAliasModal(props: DeleteAliasModalProps) {
<EuiModalBody>
{hasSystemIndex ? (
<>
<EuiCallOut color="warning">You are trying to delete system-like alias, please be careful.</EuiCallOut>
<EuiCallOut color="warning">
These aliases may contain critical system data. Deleting system aliases may break OpenSearch.
</EuiCallOut>
<EuiSpacer />
</>
) : null}
Expand Down
18 changes: 13 additions & 5 deletions public/pages/CreateIndex/components/IndexDetail/IndexDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand All @@ -270,7 +273,7 @@ const IndexDetail = (
},
],
props: {
placeholder: "The number of primary shards in the index. Default is 1.",
placeholder: "Specify primary shard count.",
},
},
},
Expand All @@ -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.");
}
Expand All @@ -299,7 +305,7 @@ const IndexDetail = (
},
],
props: {
placeholder: "The number of replica shards each primary shard should have.",
placeholder: "Specify number of replicas.",
},
},
},
Expand Down Expand Up @@ -329,7 +335,9 @@ const IndexDetail = (
<>
{isEdit && !readonly && filterByMinimatch(value?.index as string, SYSTEM_INDEX) ? (
<>
<EuiCallOut color="warning">You are editing a system-like index, please be careful before you do any change to it.</EuiCallOut>
<EuiCallOut color="warning">
This index may contain critical system data. Changing system indexes may break OpenSearch.
</EuiCallOut>
<EuiSpacer />
</>
) : null}
Expand Down Expand Up @@ -475,13 +483,13 @@ const IndexDetail = (
helpText: (
<>
<p>
Specify a comma-delimited list of settings.
Specify a comma-delimited list of settings.{" "}
<EuiLink external href={INDEX_SETTINGS_URL} target="_blank">
View index settings.
</EuiLink>
</p>
<p>
All the settings will be handled in flat structure.
All the settings will be handled in flat structure.{" "}
<EuiLink
href={`https://opensearch.org/docs/${docVersion}/api-reference/index-apis/get-index/#url-parameters`}
external
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const IndexMapping = (
});
}}
>
See previous settings
See previous mappings
</EuiButton>
<EuiSpacer />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports[`<CreateIndexTemplate /> spec it goes to templates page when click cance
style="flex-direction: row;"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary"
style="margin-right: 20px;"
type="button"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<FieldInstance>) =>
})
.catch(() => {
// do nothing
props.history.replace(ROUTES.TEMPLATES);
});
}
return () => {
Expand Down Expand Up @@ -134,7 +135,6 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<FieldInstance>) =>
{readonly ? (
<EuiFlexItem grow={false} style={{ flexDirection: "row" }}>
<EuiButton
fill
style={{ marginRight: 20 }}
onClick={() => {
const showValue: TemplateItemRemote = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function CloseIndexModal(props: CloseIndexModalProps) {
<EuiModalBody>
<>
<EuiCallOut color="warning" hidden={!showWarning}>
You are closing system like index, please be careful before you do any change to it.
This index may contain critical system data. Closing system indexes may break OpenSearch.
</EuiCallOut>
<EuiSpacer />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ HTMLCollection [
<div
class="euiTextColor euiTextColor--default"
>
You are closing system like index, please be careful before you do any change to it.
This index may contain critical system data. Closing system indexes may break OpenSearch.
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ describe("<DeleteIndexModal /> spec", () => {
it("renders the component", async () => {
const { getByText } = render(<DeleteIndexModal selectedItems={[".kibana", "test"]} visible onConfirm={() => {}} onClose={() => {}} />);

await waitFor(() => expect(getByText("You are trying to delete system-like index, please be careful.")).toBeInTheDocument());
await waitFor(() =>
expect(getByText("These indexes may contain critical system data. Deleting system indexes may break OpenSearch.")).toBeInTheDocument()
);
expect(document.body.children).toMatchSnapshot();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export default function DeleteIndexModal(props: DeleteIndexModalProps) {
<EuiModalBody>
{hasSystemIndex ? (
<>
<EuiCallOut color="warning">You are trying to delete system-like index, please be careful.</EuiCallOut>
<EuiCallOut color="warning">
These indexes may contain critical system data. Deleting system indexes may break OpenSearch.
</EuiCallOut>
<EuiSpacer />
</>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ HTMLCollection [
<div
class="euiTextColor euiTextColor--default"
>
You are trying to delete system-like index, please be careful.
These indexes may contain critical system data. Deleting system indexes may break OpenSearch.
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Object {
>
<input
class="euiFieldNumber"
placeholder="The number of primary shards in the index. Default is 1."
placeholder="Specify primary shard count."
type="number"
value="1"
/>
Expand Down Expand Up @@ -336,7 +336,7 @@ Object {
>
<input
class="euiFieldNumber"
placeholder="The number of replica shards each primary shard should have."
placeholder="Specify number of replicas."
type="number"
value="1"
/>
Expand Down Expand Up @@ -459,6 +459,7 @@ Object {
>
<p>
Specify a comma-delimited list of settings.

<a
class="euiLink euiLink--primary"
href="https://opensearch.org/docs/latest/api-reference/index-apis/create-index#index-settings"
Expand All @@ -476,6 +477,7 @@ Object {
</p>
<p>
All the settings will be handled in flat structure.

<a
class="euiLink euiLink--primary"
href="https://opensearch.org/docs/undefined/api-reference/index-apis/get-index/#url-parameters"
Expand Down