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 wording change after review #544

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
11 changes: 6 additions & 5 deletions public/pages/Indices/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ export async function getAlias(props: { aliasName?: string; commonService: Commo
}

export async function splitIndex(props: {
sourceIndex: String;
targetIndex: String;
sourceIndex: string;
targetIndex: string;
settingsPayload: Required<IndexItem>["settings"];
commonService: CommonService;
coreServices: CoreStart;
Expand Down Expand Up @@ -188,17 +188,18 @@ export async function splitIndex(props: {
** For example, if the source index has 3 primary shards, then all the valid value are 3,6,12,24,…,768.
*/
export function getSplitShardOptions(sourceShards: number) {
const MAX_SHARDS_NUMBER = 1024;
const shardsSelectOptions = [];
if (sourceShards == 1) {
for (let i = 2; i <= 1024; i++) {
for (let i = 2; i <= MAX_SHARDS_NUMBER; i++) {
shardsSelectOptions.push({
label: i.toString(),
});
}
} else {
const SHARDS_HARD_LIMIT = 1024 / 2;
const SHARDS_HARD_LIMIT = MAX_SHARDS_NUMBER / 2;
let shardsLimit = sourceShards;
for (let i = 1; shardsLimit <= SHARDS_HARD_LIMIT; i++) {
while (shardsLimit <= SHARDS_HARD_LIMIT) {
shardsLimit = shardsLimit * 2;
shardsSelectOptions.push({
label: shardsLimit.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
*/
import React, { Component } from "react";
import { EuiSpacer, EuiLink, EuiFlexItem, EuiFlexGroup, EuiButton, EuiButtonEmpty } from "@elastic/eui";
import FormGenerator, { IField, IFormGeneratorRef } from "../../../../components/FormGenerator";
import FormGenerator, { IField, IFormGeneratorRef, IFieldComponentProps } from "../../../../components/FormGenerator";
import { IndexItem } from "../../../../../models/interfaces";
import IndexDetail from "../../../../containers/IndexDetail";
import ContentPanel from "../../../../components/ContentPanel/ContentPanel";
import { IFieldComponentProps } from "../../../../components/FormGenerator";
import AliasSelect, { AliasSelectProps } from "../../../CreateIndex/components/AliasSelect";
import EuiToolTipWrapper from "../../../../components/EuiToolTipWrapper";
import { INDEX_NAMING_PATTERN, INDEX_NAMING_MESSAGE, INDEX_SETTINGS_URL, REPLICA_NUMBER_MESSAGE } from "../../../../utils/constants";
Expand Down Expand Up @@ -193,7 +192,7 @@ export default class SplitIndexForm extends Component<SplitIndexComponentProps>
label: "Specify advanced index settings",
helpText: (
<>
Specify a comma-delimited list of settings.
Specify a comma-delimited list of settings.&nbsp;
<EuiLink href={INDEX_SETTINGS_URL} target="_blank">
View index settings
</EuiLink>
Expand Down
38 changes: 23 additions & 15 deletions public/pages/SplitIndex/container/SplitIndex/SplitIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import React, { Component } from "react";
import { EuiCallOut, EuiSpacer, EuiTitle, EuiButton, EuiLink, EuiText } from "@elastic/eui";
import React, { Component, useContext } from "react";
import { EuiCallOut, EuiSpacer, EuiTitle, EuiButton, EuiLink, EuiFormRow } from "@elastic/eui";
import { get } from "lodash";

import { CatIndex } from "../../../../../server/models/interfaces";
Expand All @@ -24,7 +24,6 @@ import {

import { CommonService, ServicesContext } from "../../../../services";
import { CoreStart } from "opensearch-dashboards/public";
import { useContext } from "react";
import { CoreServicesContext } from "../../../../components/core_services";
import { BREADCRUMBS, ROUTES } from "../../../../utils/constants";

Expand Down Expand Up @@ -57,10 +56,10 @@ export class SplitIndex extends Component<SplitIndexProps> {

isSourceIndexReady = async () => {
const source = queryString.parse(this.props.location.search) as { source: string };
let sourceIndex;
let sourceIndex: CatIndex;
try {
sourceIndex = await getSingleIndice({
indexName: source.source as string,
indexName: source.source,
commonService: this.props.commonService,
coreServices: this.props.coreService,
});
Expand Down Expand Up @@ -134,7 +133,7 @@ export class SplitIndex extends Component<SplitIndexProps> {
);
}

if (sourceSettings && (!blocksWriteValue || (blocksWriteValue !== "true" && blocksWriteValue !== true))) {
if (sourceSettings && blocksWriteValue !== "true" && blocksWriteValue !== true) {
const flat = true;
const blocksWriteSetting = { "index.blocks.write": "true" };
reasons.push(
Expand Down Expand Up @@ -200,18 +199,27 @@ export class SplitIndex extends Component<SplitIndexProps> {
const { sourceIndex, splitIndexFlyoutVisible, reasons, shardsSelectOptions } = this.state;
return (
<div style={{ padding: "0px 50px" }}>
<EuiTitle size="l">
<EuiTitle>
<h1>Split index</h1>
</EuiTitle>

<EuiText color="subdued" size="s" style={{ padding: "5px 0px" }}>
<p style={{ fontWeight: 200 }}>
Split an existing read-only index into a new index with more primary shards . &nbsp;&nbsp;
<EuiLink href={"https://opensearch.org/docs/latest/api-reference/index-apis/split/"} target="_blank" rel="noopener noreferrer">
Learn more.
</EuiLink>
</p>
</EuiText>
<EuiFormRow
fullWidth
helpText={
<div>
Split an existing read-only index into a new index with more primary shards.&nbsp;
<EuiLink
href={"https://opensearch.org/docs/latest/api-reference/index-apis/split/"}
target="_blank"
rel="noopener noreferrer"
>
Learn more.
</EuiLink>
</div>
}
>
<></>
</EuiFormRow>

<EuiSpacer />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,39 @@ HTMLCollection [
style="padding: 0px 50px;"
>
<h1
class="euiTitle euiTitle--large"
class="euiTitle euiTitle--medium"
>
Split index
</h1>
<div
class="euiText euiText--small"
style="padding: 5px 0px;"
class="euiFormRow euiFormRow--fullWidth"
id="some_html_id-row"
>
<div
class="euiTextColor euiTextColor--subdued"
class="euiFormRow__fieldWrapper"
>
<p
style="font-weight: 200;"
<div
class="euiFormHelpText euiFormRow__text"
id="some_html_id-help-0"
>
Split an existing read-only index into a new index with more primary shards .   
<a
class="euiLink euiLink--primary"
href="https://opensearch.org/docs/latest/api-reference/index-apis/split/"
rel="noopener noreferrer"
target="_blank"
>
Learn more.
EuiIconMock
<span
class="euiScreenReaderOnly"
<div>
Split an existing read-only index into a new index with more primary shards. 
<a
class="euiLink euiLink--primary"
href="https://opensearch.org/docs/latest/api-reference/index-apis/split/"
rel="noopener noreferrer"
target="_blank"
>
(opens in a new tab or window)
</span>
</a>
</p>
Learn more.
EuiIconMock
<span
class="euiScreenReaderOnly"
>
(opens in a new tab or window)
</span>
</a>
</div>
</div>
</div>
</div>
<div
Expand Down